RTSP Gstreamer h265 сервер/клиент

Как я могу написать конвейер, который передает потоки видеотестов h265, закодированные в RTSP, и другой, который воспроизводит первый?

Насколько я понимаю, это должен быть действующий сервер

gst-launch-1.0 -v videotestsrc ! video/x-raw,width=1280,height=720 ! x265enc ! rtph265pay ! udpsink host=127.0.0.1 port=5000

Выход

Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0.GstPad:src: caps = "video/x-raw\,\ format\=\(string\)I420\,\ width\=\(int\)1280\,\ height\=\(int\)720\,\ framerate\=\(fraction\)30/1\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ interlace-mode\=\(string\)progressive"
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = "video/x-raw\,\ format\=\(string\)I420\,\ width\=\(int\)1280\,\ height\=\(int\)720\,\ framerate\=\(fraction\)30/1\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ interlace-mode\=\(string\)progressive"
/GstPipeline:pipeline0/GstX265Enc:x265enc0.GstPad:sink: caps = "video/x-raw\,\ format\=\(string\)I420\,\ width\=\(int\)1280\,\ height\=\(int\)720\,\ framerate\=\(fraction\)30/1\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ interlace-mode\=\(string\)progressive"
Redistribute latency...
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = "video/x-raw\,\ format\=\(string\)I420\,\ width\=\(int\)1280\,\ height\=\(int\)720\,\ framerate\=\(fraction\)30/1\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ interlace-mode\=\(string\)progressive"
/GstPipeline:pipeline0/GstX265Enc:x265enc0.GstPad:src: caps = "video/x-h265\,\ stream-format\=\(string\)byte-stream\,\ alignment\=\(string\)au\,\ level\=\(string\)3.1\,\ tier\=\(string\)main\,\ profile\=\(string\)main\,\ width\=\(int\)1280\,\ height\=\(int\)720\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ framerate\=\(fraction\)30/1"
/GstPipeline:pipeline0/GstRtpH265Pay:rtph265pay0.GstPad:sink: caps = "video/x-h265\,\ stream-format\=\(string\)byte-stream\,\ alignment\=\(string\)au\,\ level\=\(string\)3.1\,\ tier\=\(string\)main\,\ profile\=\(string\)main\,\ width\=\(int\)1280\,\ height\=\(int\)720\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ framerate\=\(fraction\)30/1"
/GstPipeline:pipeline0/GstRtpH265Pay:rtph265pay0.GstPad:src: caps = "application/x-rtp\,\ media\=\(string\)video\,\ payload\=\(int\)96\,\ clock-rate\=\(int\)90000\,\ encoding-name\=\(string\)H265\,\ ssrc\=\(uint\)2573237941\,\ timestamp-offset\=\(uint\)1713951204\,\ seqnum-offset\=\(uint\)27727\,\ a-framerate\=\(string\)30"
/GstPipeline:pipeline0/GstUDPSink:udpsink0.GstPad:sink: caps = "application/x-rtp\,\ media\=\(string\)video\,\ payload\=\(int\)96\,\ clock-rate\=\(int\)90000\,\ encoding-name\=\(string\)H265\,\ ssrc\=\(uint\)2573237941\,\ timestamp-offset\=\(uint\)1713951204\,\ seqnum-offset\=\(uint\)27727\,\ a-framerate\=\(string\)30"
/GstPipeline:pipeline0/GstRtpH265Pay:rtph265pay0.GstPad:src: caps = "application/x-rtp\,\ media\=\(string\)video\,\ clock-rate\=\(int\)90000\,\ encoding-name\=\(string\)H265\,\ sprop-parameter-sets\=\(string\)\"QAEMAf//AWAAAAMAkAAAAwAAAwBdlZgJAA\\\=\\\=\\\,QgEBAWAAAAMAkAAAAwAAAwBdoAKAgC0WWVmkkyuAQAAAAwBAAAAHggA\\\=\\\,RAHBcrRiQAA\\\=\"\,\ payload\=\(int\)96\,\ seqnum-offset\=\(uint\)27727\,\ timestamp-offset\=\(uint\)1713951204\,\ ssrc\=\(uint\)2573237941\,\ a-framerate\=\(string\)30"
/GstPipeline:pipeline0/GstUDPSink:udpsink0.GstPad:sink: caps = "application/x-rtp\,\ media\=\(string\)video\,\ clock-rate\=\(int\)90000\,\ encoding-name\=\(string\)H265\,\ sprop-parameter-sets\=\(string\)\"QAEMAf//AWAAAAMAkAAAAwAAAwBdlZgJAA\\\=\\\=\\\,QgEBAWAAAAMAkAAAAwAAAwBdoAKAgC0WWVmkkyuAQAAAAwBAAAAHggA\\\=\\\,RAHBcrRiQAA\\\=\"\,\ payload\=\(int\)96\,\ seqnum-offset\=\(uint\)27727\,\ timestamp-offset\=\(uint\)1713951204\,\ ssrc\=\(uint\)2573237941\,\ a-framerate\=\(string\)30"
/GstPipeline:pipeline0/GstRtpH265Pay:rtph265pay0: timestamp = 1713951204
/GstPipeline:pipeline0/GstRtpH265Pay:rtph265pay0: seqnum = 27727
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock

Так что я попытался

gst-launch-1.0 udpsrc uri=udp://127.0.0.1:5000 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H265, payload=(int)96, seqnum-offset=(uint)27727, timestamp-offset=(uint)1713951204, ssrc=(uint)2573237941, a-framerate=(string)30" ! rtph265depay ! vaapidecode ! vaapipostproc ! vaapisink

но не повезло

libva info: VA-API version 0.39.3
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Got context from element 'pipeline0': gst.vaapi.Display=context, gst.vaapi.Display=(GstVaapiDisplay)NULL;
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstVaapiDecode:vaapidecode0: No valid frames decoded before end of stream
Additional debug info:
gstvideodecoder.c(1167): gst_video_decoder_sink_event_default (): /GstPipeline:pipeline0/GstVaapiDecode:vaapidecode0:
no valid frames found
Execution ended after 0:00:00.025823038
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

person Riccardo Cagnasso    schedule 03.10.2016    source источник
comment
Вы пытались отладить свой конвейер, чтобы увидеть, какая часть вызывает проблему? попробуйте запустить конвейер с параметром -v, а затем добавьте ! fakesink после каждого элемента, пока конвейер не перестанет работать, чтобы определить, какой элемент вызывает проблему.   -  person Samer Tufail    schedule 03.10.2016


Ответы (1)


Попробуйте добавить синтаксический анализатор перед декодированием, например: gst-launch-1.0 udpsrc uri=udp://127.0.0.1:5000 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H265, payload=(int)96, seqnum-offset=(uint)27727, timestamp-offset=(uint)1713951204, ssrc=(uint)2573237941, a-framerate=(string)30" ! rtph265depay ! h265parse ! vaapidecode ! vaapipostproc ! vaapisink

Обратите внимание на элемент h265parse между depay и decode.

person Samer Tufail    schedule 03.10.2016
comment
Теперь я не получаю ошибки, но воспроизведение действительно не начинается. С GST_DEBUG=2 я получаю много 0:00:20.071134377 12142 0xb2c230 WARN h265parse gsth265parse.c:981:gst_h265_parse_handle_frame:‹h265parse0› пока нет SPS/PPS, nal Type: 0 Slice_TRAIL_N, Size: 75009:0 будет удален :20.104555777 12142 0xb2c230 ПРЕДУПРЕЖДЕНИЕ h265parse - person Riccardo Cagnasso; 07.10.2016
comment
что происходит? что-нибудь рендерит на vaapisink? или это черный экран? - person Samer Tufail; 07.10.2016