I’m working on modifying FFmpeg’s v4l2_m2m code to support Jetson nano H264/HEVC.
There are problems with your v4l2 drivers that don’t allow the encoder to be added.
Issue with POLLIN flag
ffmpeg uses poll() to decide whether to deque the capture buffers. poll() is called with an infinite timeout so that it acts as a throttle from the hardware device. The issue is that even when the POLLIN flag is raised in revents (indicating that capture buffers can be dequeued without blocking), the ioctl call returns -1 with EAGAIN quite a lot of the time. This is incorrect behaviour and means there is no throttling.
Segfault when no sleep at exit
A lot of the time I see a segfault if there is no sleep after the v4l2 device is closed and ffmpeg is exiting. This seems related to the race condition in this post.
Maybe solving 1) will solve this issue.
Your v4l2 drivers need nvbuf_utils.h. At the moment this doesn’t have an open source license. Please release under something that’s LGPL compatible. Also, please provide pkg-config.pc file for nvbuf_utils that exists on your boards and lives in /usr/share/pkgconfig. This will make linking to nvbuf_utils a lot easier.