AV1 support for HW decoding #1691
Replies: 6 comments
-
A few questions:
|
Beta Was this translation helpful? Give feedback.
-
I re-compiled ffmpeg without libaom and the above code stopped working, whereas the ffmpeg command that uses HW decoding continued to work
Full Logs
Tested on an GCP L4.
Yes, compiled ffmpeg with CUDA support & shared libraries, installed on the system (sudo make install && sudo ldconfig) before (re-)installing pyav from master |
Beta Was this translation helpful? Give feedback.
-
If you run Can you do The way allow_software_fallback works right now is a bit misleading. It controls the case where the hardware decoder can be found and opened, but something goes wrong trying to set it up to decode the actual video (eg. resolution too high, subsampling mode not supported, etc). In that case if allow_software_fallback is set, we allow the decoder to do software decoding instead. In the case that the hardware decoder is never there to begin with, we silently fall back to software decoding, regardless of the allow_software_fallback setting. This is necessary because in many files you have multiple streams with different encodings, and there will be at least one that can't be hardware decoded (eg MJPEG). We don't want to fail in those cases. Maybe we can raise an exception if no stream can be accelerated. |
Beta Was this translation helpful? Give feedback.
-
strangely, the paths diverge here.
both systems have AV1 HW support
|
Beta Was this translation helpful? Give feedback.
-
Yeah that is very strange. In the first case, it seems like everything looks fine on our side, except the decoder is doing software decode behind our back. I'm not sure what would cause that. I suspect this will require a deeper dive into libav than I have time for. If you want to debug this, I would start from the ffmpeg hw_decode example, see if that works. If it does, compare all the libav calls it makes to the ones we make, and see if you spot any relevant difference. The existing implementation should already follow that pretty closely. For the second case, you can add some prints here to figure out why we can't find a matching hardware config even though it seems to exist. |
Beta Was this translation helpful? Give feedback.
-
My suspicion is that we are looking up a decoder to use from just the stream, and it returns the general av1 decoder. That's supposed to support accessing hardware decoders through some hooks. This is supposed to work, and does work with h264 and hevc, but seemingly not with av1 for some reason. The comments here suggests it's better to use the external decoder directly instead. But it's not clear how to find a suitable decoder in that case (we are using avcodec_find_decoder right now). |
Beta Was this translation helpful? Give feedback.
-
Overview
#1685 implemented HW support for CUDA devices. This support works for H264, VP9 but not AV1 (on supported devices)
Expected behavior
Decoding to be done on GPU.
Actual behavior
Decoding is done in software (even though
allow_software_fallback is False
)Traceback:
n/a
Investigation
sample media: av1.webm
Sanity Check:
FFmpeg:
Py Sample:
Reproduction
see above
Versions
Built from master, post PR Implemented hardware decoding #1685
Research
I have done the following:
Additional context
Tests done on an RTX4090, reproduced also on an L4 in GCP
Beta Was this translation helpful? Give feedback.
All reactions