[FFmpeg-devel] FFMPEG for V4L2 M2M devices ?

Dave Stevenson dave.stevenson at raspberrypi.com
Mon Jul 12 13:02:39 EEST 2021


On Sat, 10 Jul 2021 at 00:56, Brad Hards <bradh at frogmouth.net> wrote:
>
> On Saturday, 10 July 2021 8:53:27 AM AEST Andrii wrote:
> > I am working on porting a Kodi player to an NVidia Jetson Nano device. I've
> > been developing a decoder for quite some time now, and realized that the
> > best approach would be to have it inside of ffmpeg, instead of embedding
> > the decoder into Kodi as it heavily relies on FFMPEG. Just wondering if
> > there is any effort in making FFMPEG suppring M2M V4L devices ?
>
> https://git.ffmpeg.org/gitweb/ffmpeg.git/blob_plain/HEAD:/libavcodec/v4l2_m2m.c[1]
>
> I guess that would be the basis for further work as required to meet your needs.

Do note that there are 2 V4L2 M2M decoder APIs - the stateful API[1] ,
and the stateless API [2]. They differ in the amount of bitstream
parsing and buffer management that the driver implements vs expecting
the client to do.

The *_v4l2m2m drivers within FFMPEG support the stateful API (ie the
kernel driver has bitstream parsing). For Raspberry Pi we use that to
support the (older) H264 implementation, and FFMPEG master does that
very well.

The Pi HEVC decoder uses the V4L2 stateless API. Stateless HEVC
support hasn't been merged to the mainline kernel as yet, so there are
downstream patches to support that.

A quick Google implies that NVidia already has a stateful V4L2 M2M
driver in their vendor kernel. Other than the strange choice of device
node name (/dev/nvhost-nvdec), the details at [3] make it look like a
normal V4L2 M2M decoder that has a good chance of working against
h264_v4l2m2m.

[1] https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/dev-decoder.html
[2] https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/dev-stateless-decoder.html
[3] https://docs.nvidia.com/jetson/l4t-multimedia/group__V4L2Dec.html

  Dave

> Brad
>
> --------
> [1] https://git.ffmpeg.org/gitweb/ffmpeg.git/blob_plain/HEAD:/libavcodec/v4l2_m2m.c
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list