obs-studio
obs-studio copied to clipboard
obs-ffmpeg: Implement texture encoding for VAAPI
Description
Implement texture encoding for VAAPI
Motivation and Context
Based on #8312
How Has This Been Tested?
Tested with mesa driver.
Types of changes
- Performance enhancement (non-breaking change which improves efficiency)
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.
Encoder crashes/fails on intel when using bframes. Unfortunately ffmpeg encoder dying this way hangs obs... Otherwise it seems to work.
--- Edit
Actually caught a
warning: [FFmpeg VAAPI encoder: 'advanced_video_recording'] Failed to export VA surface handle: operation failed
warning: [FFmpeg VAAPI encoder: 'advanced_video_recording'] vaapi_encode: failed to create texture hw frame
With a shorter attempt. But this is just logged during shutdown it may be unrelated to the PR.
Not sure why would it cause issues with bframes, it is copying into VA surfaces allocated by ffmpeg which should keep them until they are used and only release them after.
Can you post full log?
Sorry I forgot to mention the most important part that it was with AV1, which does not support bframes on intel iirc. Confirmed this happens with the existing master so its unrelated to this PR.
So that looks like intel driver issue. Both obs and ffmpeg checks if the driver support bframes for given profile.
Got my multi gpu device, and I guess im lucky and I'm not seeing the fallback warning so I presume its working at copying textures across devices without falling back to host memory. Tested and it is working cross device.
Added libdrm dep to non-legacy cmake and changed the function names in logging.
It seems master might be broken, gpu_encode_available ends up being false as the video mix's using_nv12_tex = false. In this case the regular encode path is taken, however the texture encoder doesnt fallback as it is working as expected. So libobs ends up jumping into the missing encode
function on the texture encoder.
With #10567 it should be working again.