gstreamer通过udp接收和重新解码h.264视频

时间:2019-04-30 12:13:24

标签: ffmpeg gstreamer h.264

我正在尝试使用gstreamer

从Tello无人机捕获视频流

我尝试使用

gstreamer管道
gst-launch-1.0 -v udpsrc buffer-size=622080 skip-first-bytes=2 port=6038 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)RAW,width=(string)960, height=(string)720, payload=(int)96, a-framerate=25" \
    ! queue \
    ! rtpvrawdepay \
    ! autovideosink

但这输出(带有export GST_DEBUG=*:3

WARNING: from element /GstPipeline:pipeline0/GstRtpVRawDepay:rtpvrawdepay0: Could not decode stream.
Additional debug info:
gstrtpbasedepayload.c(506): GstFlowReturn gst_rtp_base_depayload_handle_buffer(GstRTPBaseDepayload *, GstRTPBaseDepayloadClass *, GstBuffer *) (): /GstPipeline:pipeline0/GstRtpVRawDepay:rtpvrawdepay0:

有关流的信息可以在这里查看:https://github.com/m6c7l/dji-ryze-tello/tree/master/example/video

可以使用以下命令ffmpeg将视频传送到ffmpeg -i - -f image2pipe -pix_fmt rgb24 -vcodec rawvideo -

我缺少一个gstreamer管道,该管道可以将这些NAL拼凑成一个h264帧。

更新:输出playbin

我尝试使用export GST_DEBUG=*:3运行命令,并且反复得到以下输出:

gst-launch-1.0 -v playbin uri=udp://0.0.0.0:6038
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: ring-buffer-max-size = 0
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: buffer-size = -1
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: buffer-duration = -1
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: use-buffering = false
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: download = false
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: uri = udp://0.0.0.0:6038
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: connection-speed = 0
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: source = "\(GstUDPSrc\)\ source"
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:src: caps = video/x-h264, stream-format=(string)byte-stream
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstH264Parse:h264parse0.GstPad:sink: caps = video/x-h264, stream-format=(string)byte-stream
0:01:19.923679000  3202 0x7f9639857320 WARN               h264parse gsth264parse.c:1351:gst_h264_parse_handle_frame:<h264parse0> broken/invalid nal Type: 1 Slice, Size: 16113 will be dropped
0:01:19.924320000  3202 0x7f9639857320 WARN               h264parse gsth264parse.c:1351:gst_h264_parse_handle_frame:<h264parse0> broken/invalid nal Type: 1 Slice, Size: 17237 will be dropped
0:01:19.925063000  3202 0x7f9639857320 WARN       codecparsers_h264 gsth264parser.c:2039:gst_h264_parse_pps: failed to read SE
0:01:19.925075000  3202 0x7f9639857320 WARN       codecparsers_h264 gsth264parser.c:2046:gst_h264_parse_pps: error parsing "Picture parameter set"
0:01:19.925081000  3202 0x7f9639857320 WARN               h264parse gsth264parse.c:882:gst_h264_parse_process_nal:<h264parse0> failed to parse PPS:
0:01:19.925089000  3202 0x7f9639857320 WARN               h264parse gsth264parse.c:1351:gst_h264_parse_handle_frame:<h264parse0> broken/invalid nal Type: 8 PPS, Size: 5 will be dropped
0:01:19.925106000  3202 0x7f9639857320 WARN       codecparsers_h264 gsth264parser.c:2039:gst_h264_parse_pps: failed to read SE

我将尝试使用这些选项并进行报告。

1 个答案:

答案 0 :(得分:0)

您正在尝试处理GStreamer管道中的原始视频,即使它应处理H.264编码的视频。尝试类似的命令(未经测试的命令):

  

gst-launch-1.0 -v playbin2 uri = udp://0.0.0.0:6038