<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hey,</p>
<p>I have asked this question before on Stackoverflow, but I think
it might be better targeted to ask it here.</p>
<div class="s-prose js-post-body" itemprop="text">
<p>I am currently trying to convert a live feed from a Raspberry
Pi camera to H264 and store it as a mp4 video using gstreamer.
Since I am using a Raspberry Pi 1, I need to use the hardware
accelerated video encoding as otherwise the encoder cannot keep
up.</p>
<p>I tried the following pipeline, which I feed manually with RGB
image data:</p>
<pre><code>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
</code></pre>
<p>However, it fails with the following output:</p>
<pre><code>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
</code></pre>
<p>Curiously, if I replace <code>omxh264enc</code> with the
non-accelerated version <code>x264enc</code>, it works
(although it falls behind after a couple of frames).</p>
<p>I assume that the warnings right before <code>Internal data
stream error</code> might give some indication to what is
actually going wrong, but I cannot make much sense out of them.<br>
</p>
<p>The full code can be found here: <a
href="https://pastebin.com/pgr940yu" rel="nofollow noreferrer">https://pastebin.com/pgr940yu</a>,
as well as the full debug output of that code here: <a
href="https://pastebin.com/CLwAfxMG" rel="nofollow noreferrer">https://pastebin.com/CLwAfxMG</a>.</p>
<p>Thanks a lot in advance!</p>
<p>Best,
Homan</p>
</div>
</body>
</html>