obs-studio
obs-studio copied to clipboard
obs-ffmpeg: Add HDR and HEVC to VA-API encoder
Description
Add HEVC support to create HDR videos using FFmpeg VA-API on Linux.
EDIT (jpark37): I have reworked the changes to add NV12 back to support narrow SDR again. I've also consolidated the files, so no new files are added.
Motivation and Context
HDR streaming.
How Has This Been Tested?
- HDR video was recorded using "FFmpeg HEVC VAAPI" encoder with AMD hardware device selected. Video parameters were tested using the
ffprobe
tool. The recorded video was played usingmpv
. - HDR Video was streamed to YouTube using "FFmpeg HEVC VAAPI" encoder with AMD hardware device selected. Video parameters were tested using the
Stats for nerds
YouTube feature. The streamed video was viewed usingchrome web browser
.
AMD Ryzen 7 5700U with Radeon Graphics
EDIT (jpark37): I've tested recordings with these combinations on my Rocket Lake on Ubuntu 22.10.
- H.264, Rec. 709, NV12
- HEVC, Rec. 709, NV12
- HEVC, Rec. 2100 (PQ), P010
- HEVC, Rec. 2100 (HLG), P010
- ENABLE_HEVC=OFF builds, and the encoders are removed
I was unable to test streaming because we seem to require CBR, and the Intel HEVC encoder reports that it only supports CQP (for me at least).
Types of changes
- New feature (non-breaking change which adds functionality)
Checklist:
- [x] My code has been run through clang-format.
- [x] I have read the contributing document.
- [x] My code is not on the master branch.
- [x] The code has been tested.
- [x] All commit messages are properly formatted and commits squashed where appropriate.
- [x] I have included updates to all appropriate documentation.
This PR should stay as draft until #6678 is tested and merged.
I've reworked the changes to bring back NV12 support, and fit our style.
The PR itself is ready, but I'm holding this in draft status until #7850 is merged because I stacked the changes on top.
Back to draft because I remounted on #7916.
Also suspect we need to be using VAHdrMetaDataHDR10 for metadata, but the only code example I could find is FFmpeg vf_tonemap_vaapi.c, which is a filter and not an encoder. It might still be applicable, but that's not a research project I want to take on.
#7916 was merged, so back to reviewable.
Resolved the merge conflict.