-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented hardware decoding #1685
base: main
Are you sure you want to change the base?
Conversation
...I. = Intra frame-only codec | ||
....L = Lossless compression | ||
.....H = Hardware decoding supported | ||
------''') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you doing this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was @mikeboers 's change. I suppose because having two fields that are just opposites of each other is redundant?
12 tests are also failing on my physical MacOS machine. The errors are the same as Github Actions |
Sorry about that. I thought they were existing failures but I forgot to do a |
All tests pass locally for me now. Also made |
This implements hardware decoding continuing from the work of @rvillalba-novetta and @mikeboers in PyAV-Org/PyAV@main...rvillalba-novetta:PyAV:hwaccel (and children commits)
This implements hardware decoding continuing from the original work of @rvillalba-novetta and refactoring by @mikeboers in main...rvillalba-novetta:PyAV:hwaccel (and children commits)
I've completed the refactoring, fixed a few bugs, and brought the changes up to date with both PyAV at HEAD and ffmpeg 7.
I've also added a test and an example script. The test cannot be run in CI for obvious reasons (GitHub runners don't have GPUs), but I've manually run it on Mac, Windows, and Linux (WSL).
I understand that @mikeboers didn't find it worthwhile back in the days, but the situation has changed significantly since then - now almost every machine has a supported decoder, and modern encodings (HEVC, VP9, AV1) are so compute-intensive to decode that they have practically been designed for hardware decoding. As an example, I've been working with 4K HEVC videos (standard format coming out of action cameras and phones these days), and my Apple M3 can only decode them at 15 fps, while VideoToolbox easily does 100+ fps. I believe now and especially going forward, hardware decoding will be a necessity for almost any application that cares about performance or need realtime decoding.
Performance tests with a 4K HEVC video (using the new example script) -
MacBook Air M3:
CPU (M3) - 16.3 fps
GPU (M3, videotoolbox) - 121.4 fps
Windows:
CPU (AMD Ryzen 5 3500X) - 15.6 fps
GPU (NVIDIA RTX 3060 Ti, using d3d11va) - 49.1 fps
Linux (WSL):
CPU (AMD Ryzen 5 3500X) - 15.5 fps
GPU (NVIDIA RTX 3060 Ti, using cuda) - 91.3 fps
Notes:
Thanks!