Gstreamer udpsrc 错误 "reason error (-5)" 由于 "Invalid JPEG file structure: two SOF markers"

Gstreamer udpsrc error "reason error (-5)" due to "Invalid JPEG file structure: two SOF markers"

我正在使用以下命令通过网络从摄像机接收 UDP 流:

gst-launch-1.0 udpsrc port=53247 ! jpegdec ! xvimagesink sync=false

我能够在几秒钟内正确接收来自摄像头的视频流,但随后视频停止并显示以下错误消息:

** (gst-launch-1.0:7888): CRITICAL **: gst_adapter_push: assertion 'GST_IS_BUFFER (buf)' failed
ERROR: from element /GstPipeline:pipeline0/GstUDPSrc:udpsrc0: Internal data flow error.
Additional debug info:
gstbasesrc.c(2865): gst_base_src_loop (): /GstPipeline:pipeline0/GstUDPSrc:udpsrc0:
streaming task paused, reason error (-5)
Execution ended after 0:00:08.152866431
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

有关流的唯一可用信息如下:

数据格式:UDP包/JPEG

图片分辨率:VGA (640 x 480)

帧速率:30 fps

我设法获得了有关将 --gst-debug-level=2 参数添加到我的命令的错误的更多信息。

显示的附加警告消息如下:

0:00:11.518477156  6569      0x2577940 WARN            videodecoder gstvideodecoder.c:3443:_gst_video_decoder_error:<jpegdec0> error: Failed to decode JPEG image
0:00:11.518555417  6569      0x2577940 WARN            videodecoder gstvideodecoder.c:3445:_gst_video_decoder_error:<jpegdec0> error: Decode error #60: Invalid JPEG file structure: two SOF markers
0:00:11.519470502  6569      0x2577990 WARN                 basesrc gstbasesrc.c:2865:gst_base_src_loop:<udpsrc0> error: Internal data flow error.
0:00:11.519569256  6569      0x2577990 WARN                 basesrc gstbasesrc.c:2865:gst_base_src_loop:<udpsrc0> error: streaming task paused, reason error (-5)

我的命令有什么问题?

基于我对这篇文章的修改,我终于找到了解决问题的方法:

Play two webcams in MJPG format simultaneously using gstreamer

运行命令如下(没有调试选项):

gst-launch-1.0 udpsrc port=53247 ! 'image/jpeg,width=640,height=480,framerate=30/1' ! jpegparse ! jpegdec ! autovideosink sync=false

选项 do-timestamp=true 使我的视频在一段时间后出现延迟,所以我选择了选项 sync=false