v4l2 video encoder

Nicolas Dufresne nicolas at ndufresne.ca
Wed Feb 24 13:01:59 UTC 2021


Le mer. 24 févr. 2021 04 h 45, Bing Song <bing.song at nxp.com> a écrit :

> Hi,
>
>
>
> Gst-transcoding will use v4l2videodec and v4l2videoenc. The default of
> v4l2videoenc input is MMAP mode. It cause video frame copy in v4l2videoenc
> input. How to avoid the video frame buffer copy?
>

This needs to be fixed inside v4l2videoenc class. Currently the import is
not using the new try_import calls, so it is unsafe as it does not
communicate padding and strides to the driver. I have a partial solution to
this that I made last week, I need to cleanup and make an MR.

Now, it's partial as it only validate the very first buffer, it should keep
validating in case something changes.

The next Todo before actually making it try to import by default is to
figure out how we will handle copy fallback. We could reset the encoder and
reallocate, but this method would not be reversible, and would produce a
spurious keyframe (meaning the gops might not always be as requested). We
need to decide if that would be good enough, in real app, we do hope we
will not have to fallback. The alternative would be to have scratch buffers
on the side as backup buffers, but the would use a big chunk of memory.

Meanwhile, one can always track the encoder being added to the pipeline
(deep-element-added signal, or state transition message) and set the
output-io-mode to dmabuf-import mode, and hope that buffers are properly
aligned.


>
> Regards,
>
> Bing
> _______________________________________________
> 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/20210224/e8853e75/attachment.htm>


More information about the gstreamer-devel mailing list