首页 > 解决方案 > gstreamer 通过 udp 接收和重新组合 h.264 视频

问题描述

我正在尝试从 Tello 无人机捕获视频流gstreamer

我试过一个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

我会尝试使用这些选项并报告。

标签: ffmpeggstreamerh.264

解决方案


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

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


推荐阅读