encoding pipeline from v4l2 usb camera with v4l2video8convert and v4l2h264enc

Nicolas Dufresne nicolas at ndufresne.ca
Sun Jan 19 17:04:36 UTC 2020


Le dim. 19 janv. 2020 06 h 15, Constantine Elster <
constantine.elster at valerann.com> a écrit :

> 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"
>

While reading this, I was worried you had hit some much more serious issue.
Short story, you need h264parse between the encoder and the muxer.

The HW encoder produces H264 using Annex B format (with start code), but
ISOMP4 require AVCc format, h264parse element can negotiate and convert
this for you.


> Would appreciate any ideas how to understand what's wrong, how to debug
> and make it work.
>
> Thank you very much,
>   -- Constantine.
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20200119/17319bab/attachment-0001.htm>


More information about the gstreamer-devel mailing list