VIDIOC_STREAMOFF followed by VIDIOC_STREAMON during encode results in subsequent calls to dequeue capture buffer to get stuck

According to the documentation here (4.5.2. Memory-to-Memory Stateful Video Encoder Interface — The Linux Kernel documentation) this should be a way of resetting the encoder so that it doesn’t depend on earlier frames, which I am trying to use as a workaround for forceIDR not working for the AV1 Orin NX encoder (see V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE not working with AV1 encoder - #8 by oviano).

However, I have tried various combinations to initiate a drain/reset but they always result in the next call to VIDIOC_DQBUF for the capture buffers to lock, and the process has to be killed to recover it.

The only way I can get this to work is to stop both the capture and output queues, free up all the buffers and re-initialise the encoder. This works but takes a bit too long for my liking (up to 10ms).

Let’s continue discussion in the topic. Please help try the command:
V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE not working with AV1 encoder - #9 by DaneLLL

I’ve responded in that thread - but this looks like a separate issue, albeit one that won’t be so important to me personally if the forceIDR has/gets resolved.

It seems that it’s not possible to reset the encoder state, without doing a full initialisation of the encoder.


This is correct. There are some on-the-fly parameters we can set without re-initializing encoder. For changing most parameters, the encoder has to be terminated and re-initialized.

Ok thanks!

It would be great to have all this sort of stuff documented, without trial and error it’s almost impossible to understand what parts of the V4L2 spec your encoder follows and what parts it doesn’t.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.