“内部数据流错误”在gstreamer中使用omxh264enc时

问题描述

我目前正在尝试将RaspBerry Pi摄像机的实时供稿转换为H264,并使用gstreamer将其存储为mp4视频。由于我使用的是RaspBerry Pi 1,因此我需要使用硬件加速视频编码,否则编码器将无法跟上。

我尝试了以下管道,该管道手动输入RGB图像数据:

appsrc name=src format=time is-live=true caps=video/x-raw,format=(string)RGB,width=640,height=480,bpp=24,depth=24,framerate=20/1 ! autovideoconvert ! queue ! omxh264enc ! mp4mux ! filesink location=output.mp4

但是,它失败并显示以下输出

0:00:01.193743067  2469  0x1f5b320 WARN             autoconvert gstautoconvert.c:1048:gst_auto_convert_sink_query:<autoconvertchild> Got query allocation while no element was selected,letting through
0:00:01.205271623  2469  0x1f5b2c0 WARN             omxvideoenc gstomxvideoenc.c:2944:gst_omx_video_enc_propose_allocation:<omxh264enc-omxh264enc0> allocation query does not contain caps
0:00:02.109098855  2469  0x1f5b320 WARN          v4l2bufferpool gstv4l2bufferpool.c:1189:gst_v4l2_buffer_pool_dqbuf:<v4l2convert0:pool:src> Driver should never set v4l2_buffer.field to ANY
0:00:02.172643411  2469 0xa2703200 WARN                GST_PADS gstpad.c:4226:gst_pad_peer_query:<omxh264enc-omxh264enc0:src> Could not send sticky events
0:00:02.193615605  2469 0xa2703200 WARN             omxvideoenc gstomxvideoenc.c:1602:gst_omx_video_enc_loop:<omxh264enc-omxh264enc0> error: Internal data stream error.
0:00:02.197108471  2469 0xa2703200 WARN             omxvideoenc gstomxvideoenc.c:1602:gst_omx_video_enc_loop:<omxh264enc-omxh264enc0> error: stream stopped,reason not-negotiated
0:00:02.329828367  2469  0x1f7eaa0 WARN              bufferpool gstbufferpool.c:1394:gst_buffer_pool_set_flushing:<v4l2convert0:pool:sink> can't change flushing state of inactive pool
0:00:02.333992206  2469  0x1f7eaa0 WARN              bufferpool gstbufferpool.c:1394:gst_buffer_pool_set_flushing:<v4l2convert0:pool:sink> can't change flushing state of inactive pool

奇怪的是,如果我将omxh264enc替换为非加速版本x264enc,它就可以工作(尽管在几帧之后就落后了)。

我认为Internal data stream error之前的警告可能会指示出实际出了什么问题,但我从中无法理解。

完整的代码可以在这里找到:https://pastebin.com/pgr940yu,以及该代码的完整的调试输出可以在这里找到:https://pastebin.com/CLwAfxMG

非常感谢!

最好, 霍曼

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)