微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决“内部数据流错误”在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 举报,一经查实,本站将立刻删除。