encoding pipeline from v4l2 usb camera with v4l2video8convert and v4l2h264enc

Milian Wolff milian.wolff at kdab.com
Sun Jan 19 12:12:59 UTC 2020


On Sonntag, 19. Januar 2020 11:06:55 CET Constantine Elster wrote:
> Hi devs,
> 
> I'm trying to construct a pipeline that captures frames from a USB camera
> (YUV) and encodes them with HW encoder and saves into a file. My setup is
> iMX6 board running Ubuntu 18.04 on 4.20 mainline kernel.
> 
> When I try a sw encoder, it works okay albeit I get very high 100% CPU
> usage. The working pipeline based on software plugins:
> gst-launch-1.0 -v v4l2src device="/dev/video2" num-buffers=200 !
> "video/x-raw, format=(string)UYVY, width=(int)640, height=(int)480,
> pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)45/1,
> colorimetry=bt709" ! videoconvert ! x264enc ! mp4mux ! filesink
> location=aha.mp4
> 
> My attempt to replace sw based plugins by HW based with efficient memory
> management:
> gst-launch-1.0 -v v4l2src device="/dev/video9" num-buffers=200 !
> "video/x-raw, format=(string)UYVY, width=(int)640, height=(int)480,
> pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)45/1,
> colorimetry=bt709" ! *v4l2video8convert* *output-io-mode=dmabuf-import* !
> *v4l2h264enc* *output-io-mode=dmabuf-import* ! mp4mux ! filesink
> location=aha.mp4
> 
> I get the following error: "WARNING: erroneous pipeline: could not link
> v4l2h264enc0 to mp4mux0"
> 
> Would appreciate any ideas how to understand what's wrong, how to debug and
> make it work.

To debug, I suggest you compare the SRC of `gst-inspect-1.0 v4l2h264enc` with 
the SINK of `gst-inspect-1.0 mp4mux`. My guess is that you may be able to fix 
the issue by adding a `h264parse` element in the middle to fix the alignment 
since `mp4mux` requires `au` alignment, whereas the encoder may output `nal` 
frames?

Good luck

-- 
Milian Wolff | milian.wolff at kdab.com | Senior Software Engineer
KDAB (Deutschland) GmbH, a KDAB Group company
Tel: +49-30-521325470
KDAB - The Qt, C++ and OpenGL Experts
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3826 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20200119/941ba7c7/attachment.bin>


More information about the gstreamer-devel mailing list