Repository navigation
obs-ffmpeg: Fix B-frame offset calculation in AMF - #13762
Merged
Merged
Conversation
derrod
reviewed
Aug 6, 2026
lexano-ivs
force-pushed
the
lexano/amd-b-frame
branch
2 times, most recently
from
August 6, 2026 20:36
3e96e49 to
dc09615
Compare
AVC and AV1 encoders in AMF that support B-frames were incrementing `dts_offset` even when B-frames were set to 0. For AVC, adjust the `dts_offset` only when B-frames are supported and are greater than 0, and clamp to maximum supported. For AV1, remove the dts_offset code completely because it is being ignored anyway. AV1 handles B-frames and offsets differently; refer to [1] for details. [1]: obsproject#10996
lexano-ivs
force-pushed
the
lexano/amd-b-frame
branch
from
August 7, 2026 15:14
dc09615 to
65c625a
Compare
HoboStreamer
pushed a commit
to HoboStreamer/ovbs-studio
that referenced
this pull request
Aug 12, 2026
derrod
approved these changes
Aug 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AMF AVC and AV1 encoders support B-frames in more recent GPUs, however the
enc->dts_offsetwas being incremented even when b-frames were set to 0.For AVC, this caused IVS Stages to reject the stream because the offset is used to infer the presence of B-frames, which are not supported by IVS Stages (and WebRTC).
For AV1, the code is not needed and was removed. See below for details.
Description
For AVC, only increment the
enc->dts_offsetif the AMF encoder supports B-frames and b-frames are greater than 0.For AV1, remove the
dts_offsetcalculation fromamf_av1_create_internal. This code was dead βconvert_to_encoder_packetalready excludes AV1 from the DTS subtraction (added inb2d83efcf, PR #10996), since AV1 handles frame reordering transparently and doesn't require decode-order delay compensation at the mux layer.The AV1
dts_offsetblock was introduced in1a2f8c284(AMD AV1 B-frame support) as a mechanical copy of the AVC pattern without accounting for this exclusion. This aligns with the NVENC implementation (plugins/obs-nvenc/nvenc.c), which similarly guards its DTS adjustment withif (enc->codec != CODEC_AV1)and has no offset calculation in its AV1 path.Motivation and Context
The original bug report at #13723 provides the details.
How Has This Been Tested?
I created an IVS Stage and reproduced the problem initially, then implemented the fix and tested on the same stage. There were no disconnects after the fix was in place.
Types of changes
Checklist: