0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-19 20:32:15 +02:00

obs-ffmpeg: Fix issue with B-frames introducing motion blur

If a user sets both AdaptiveMiniGOP=true and EnablePreAnalysis=true
in the AMF/FFmpeg options field, AMF will adaptively insert
B-pictures, and no longer uses the fixed B pattern.

For a fixed B-frames pattern, it is expected that increasing B-frames
can cause a quality drop for certain content such as with high motion.
AdaptiveMiniGOP is recommended when using B-frames to improve the
quality in such cases. AdaptiveMiniGOP is dependent on PreAnalysis
which means that trying to enable it without having PreAnalysis turned
ON will have no negative effect (AdaptiveMiniGOP won't be enabled).
This commit is contained in:
rhutsAMD 2024-01-03 15:35:03 -05:00 committed by Ryan Foster
parent 0a8e00c478
commit e657e62c29

View File

@ -1396,9 +1396,17 @@ static bool amf_avc_init(void *data, obs_data_t *settings)
int64_t bf = obs_data_get_int(settings, "bf");
if (enc->bframes_supported) {
set_avc_property(enc, MAX_CONSECUTIVE_BPICTURES, 3);
set_avc_property(enc, MAX_CONSECUTIVE_BPICTURES, bf);
set_avc_property(enc, B_PIC_PATTERN, bf);
/* AdaptiveMiniGOP is suggested for some types of content such
* as those with high motion. This only takes effect if
* Pre-Analysis is enabled.
*/
if (bf > 0) {
set_avc_property(enc, ADAPTIVE_MINIGOP, true);
}
} else if (bf != 0) {
warn("B-Frames set to %lld but b-frames are not "
"supported by this device",