RTSP Gstreamer h265服务器/客户端

时间:2016-10-03 14:30:40

标签: gstreamer rtsp h.265

我怎样才能编写一个流水线来管道在RTSP上编码的videotestsrc h265和另一个播放前者的流水线?

据我所知,这应该是一个有效的服务器

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 ...

1 个答案:

答案 0 :(得分:0)

尝试在解码之前添加解析器,例如: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

请注意depay和decode

之间的h265parse元素