<div dir="ltr">Thank you very much Milian! Looks better with h264parse. Still getting an error, though now different one.<div><br></div><div>I added h264parse to the pipeline:</div><div><span style="font-family:monospace">gst-launch-1.0 -vvv v4l2src device="/dev/video9" num-buffers=200 ! "video/x-raw, format=(string)UYVY, width=(int)640, height=(int)480, pixel-aspect-ratio=(fraction)</span><span style="font-family:monospace">1/1, framerate=(fraction)60/1, colorimetry=bt709" ! </span>v4l2video8convert<span style="font-family:monospace"> output-io-mode=dmabuf-import ! v4l2h264enc output-io-mode=dmabuf-import !</span><span style="font-family:monospace"> </span><b style="font-family:monospace">h264parse</b><span style="font-family:monospace"> </span><span style="font-family:monospace">! mp4mux ! filesink location=aha.mp4</span><br></div><div><div><font face="monospace"><br></font></div><div><u>Output:</u></div><div><font face="arial, sans-serif"><u></u></font></div><div><font face="monospace">Setting pipeline to PAUSED ...<br>Pipeline is live and does not need PREROLL ...<br>Setting pipeline to PLAYING ...<br>New clock: GstSystemClock<br>/GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-raw, format=(string)UYVY, width=(int)640, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)60/1, colorimetry=(string)bt709, interlace-mode=(string)progressive<br>/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw, format=(string)UYVY, width=(int)640, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)60/1, colorimetry=(string)bt709, interlace-mode=(string)progressive<br>/GstPipeline:pipeline0/v4l2video8convert:v4l2video8convert0.GstPad:src: caps = video/x-raw, framerate=(fraction)60/1, interlace-mode=(string)progressive, format=(string)I420, width=(int)640, height=(int)480, colorimetry=(string)bt709<br>/GstPipeline:pipeline0/v4l2h264enc:v4l2h264enc0.GstPad:src: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, profile=(string)baseline, level=(string)4, width=(int)640, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)60/1, interlace-mode=(string)progressive, colorimetry=(string)bt709<br>/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:sink: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, profile=(string)baseline, level=(string)4, width=(int)640, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)60/1, interlace-mode=(string)progressive, colorimetry=(string)bt709<br>Redistribute latency...<br>/GstPipeline:pipeline0/v4l2h264enc:v4l2h264enc0.GstPad:sink: caps = video/x-raw, framerate=(fraction)60/1, interlace-mode=(string)progressive, format=(string)I420, width=(int)640, height=(int)480, colorimetry=(string)bt709<br>/GstPipeline:pipeline0/v4l2video8convert:v4l2video8convert0.GstPad:sink: caps = video/x-raw, format=(string)UYVY, width=(int)640, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)60/1, colorimetry=(string)bt709, interlace-mode=(string)progressive<br>/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-raw, format=(string)UYVY, width=(int)640, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)60/1, colorimetry=(string)bt709, interlace-mode=(string)progressive<br><b>ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.<br>Additional debug info:<br>gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:<br>streaming stopped, reason error (-5)</b><br>Execution ended after 0:00:00.436501205<br>Setting pipeline to PAUSED ...<br>Setting pipeline to READY ...<br>Setting pipeline to NULL ...<br>Freeing pipeline ...</font></div><div><font face="monospace"><br></font></div><div><font face="arial, sans-serif">Any hint on debugging would be appreciated!</font></div><div><font face="arial, sans-serif">Thank you,</font></div><div><font face="arial, sans-serif">  -- Constantine.</font></div><div><font face="monospace"><br></font></div><div><font face="monospace"><br></font></div><div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jan 19, 2020 at 2:13 PM Milian Wolff <<a href="mailto:milian.wolff@kdab.com" target="_blank">milian.wolff@kdab.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Sonntag, 19. Januar 2020 11:06:55 CET Constantine Elster wrote:<br>
> Hi devs,<br>
> <br>
> I'm trying to construct a pipeline that captures frames from a USB camera<br>
> (YUV) and encodes them with HW encoder and saves into a file. My setup is<br>
> iMX6 board running Ubuntu 18.04 on 4.20 mainline kernel.<br>
> <br>
> When I try a sw encoder, it works okay albeit I get very high 100% CPU<br>
> usage. The working pipeline based on software plugins:<br>
> gst-launch-1.0 -v v4l2src device="/dev/video2" num-buffers=200 !<br>
> "video/x-raw, format=(string)UYVY, width=(int)640, height=(int)480,<br>
> pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)45/1,<br>
> colorimetry=bt709" ! videoconvert ! x264enc ! mp4mux ! filesink<br>
> location=aha.mp4<br>
> <br>
> My attempt to replace sw based plugins by HW based with efficient memory<br>
> management:<br>
> gst-launch-1.0 -v v4l2src device="/dev/video9" num-buffers=200 !<br>
> "video/x-raw, format=(string)UYVY, width=(int)640, height=(int)480,<br>
> pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)45/1,<br>
> colorimetry=bt709" ! *v4l2video8convert* *output-io-mode=dmabuf-import* !<br>
> *v4l2h264enc* *output-io-mode=dmabuf-import* ! mp4mux ! filesink<br>
> location=aha.mp4<br>
> <br>
> I get the following error: "WARNING: erroneous pipeline: could not link<br>
> v4l2h264enc0 to mp4mux0"<br>
> <br>
> Would appreciate any ideas how to understand what's wrong, how to debug and<br>
> make it work.<br>
<br>
To debug, I suggest you compare the SRC of `gst-inspect-1.0 v4l2h264enc` with <br>
the SINK of `gst-inspect-1.0 mp4mux`. My guess is that you may be able to fix <br>
the issue by adding a `h264parse` element in the middle to fix the alignment <br>
since `mp4mux` requires `au` alignment, whereas the encoder may output `nal` <br>
frames?<br>
<br>
Good luck<br>
<br>
-- <br>
Milian Wolff | <a href="mailto:milian.wolff@kdab.com" target="_blank">milian.wolff@kdab.com</a> | Senior Software Engineer<br>
KDAB (Deutschland) GmbH, a KDAB Group company<br>
Tel: +49-30-521325470<br>
KDAB - The Qt, C++ and OpenGL Experts</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><font color="#666666"><br></font></div><font color="#666666">Director, Software Engineering</font><div><font color="#666666"><i><a href="http://www.valerann.com" target="_blank">www.valerann.com</a></i></font><div><font color="#888888"><br></font><span style="color:rgb(136,136,136)"><div dir="ltr"><img src="https://drive.google.com/a/valerann.com/uc?id=1cUa5VQGZCb9MrjxREFelyMkD3jH9H2Yx&export=download" width="96" height="96" style="color: rgb(34, 34, 34);"><span style="color:rgb(153,153,153);font-size:12.8px">       </span><span style="color:rgb(153,153,153);font-size:x-small;font-family:arial,helvetica,sans-serif"><a href="https://www.ces.tech/Innovation-Awards/Honorees/2020/Best-Of/T/The-Valerann-Smart-Roads-System.aspx" style="color:rgb(17,85,204)" target="_blank"><img src="https://drive.google.com/a/valerann.com/uc?id=1Oz_UDdgdrtleGGbfg5QoGBcrqC5Ni-Et&export=download" width="69" height="96"></a></span><br></div></span></div></div></div></div>