Can we decode AVC/HEVC file frame by frame?

Hi,

I am trying to use Nvidia video decoder in our project but failed. The sample 00_video_decode works fine but we have to use it in a different way. The design of our existing project has a restriction that only one completed slice with nalu can be input to the output plane, and it expects one decoded frame from the capture plane immediately.

I played around the arguments of the sample video_decode, like --input-nalu, --blocking-mode = 1, --disable-rendering, but still it needs to feed at least 3 frames before getting the first decoded frame.

There is another decoder we are using for software avc decoding, which allows to setup a flag to disable re-ordering inside their API so that we can get the decoded frame right after inputting one encoded slice. And we do the re-order ourselves. Not sure if it is the same situation here.

Could you please let me know if Nvidia decoder can do this 1-to-1 decoding? If so, which settings should I enable/disable? If not, may I ask why?

Thanks a lot!

Julie

Hi,
The h264 or h265 stream may have reference frame number = 2 so decoder has to keep 2 frames for decoding. Also if B frames are present, decoder has to keep more frames. Please try with the stream with reference frame number = 1 and only IDR/I/P frames.

Thank you very much for the explanation! @DaneLLL

I used 01_video_encode sample to get an encoded H.264 file with -nrf 1 (default) and -nbf 0 (default). And I double checked this file has only I and P frames. But with this h.264 file, the capture plane still can’t successfully dequeue until several frames queued in output plane. I guess I still missed something…

Please let me know if you have anything in your mind. Thanks again!

Hi,
Please enable the two options and check if there is further improvement:

--max-perf           Enable maximum Performance
--disable-dpb

It works! Thanks, @DaneLLL!

Looks like the option --disable-dpb is what I am looking for. With this option, we can get the decoded frame once queuing one frame in output plane. I guess DPB works on the frames’ order, so if I disable DPB for a H.264 file with B frames, the frames’ order will be wrong. But we can handle the order ourselves. Is my understanding correct? Will it affect any other features?

Hi,
Your understanding is correct. For certain stream that the frames are not put in display order, it may not be outputted in correct display order when --disable-dpb is set.

Awesome, got it, really appreciate it!

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