You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: obs-ffmpeg: a recording started while the replay buffer runs still waits for the next keyframe with VA-API, AOM AV1 and SVT-AV1 (follow-up to #594, upstream obsproject/obs-studio#12069) #597
Follow-up to #594 (upstream obsproject/obs-studio#12069). #594 added the optional request_keyframe callback to obs_encoder_info, which libobs calls when an output starts on a video encoder another output already runs, but only obs-x264 implements it. With the other encoders, a recording started while the replay buffer runs still waits for the encoder's next scheduled keyframe: it misses its first seconds, and one stopped before that keyframe takes seconds to stop and leaves an unreadable file.
Location
plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c: the VA-API encoders have no request_keyframe. With the default keyframe interval (0 = auto) they make a keyframe every 120 frames, 6 s at 20 fps.
Data loss: recordings miss their first seconds or are empty and unreadable; the stop hangs for seconds. Same as #593, with encoders other than x264.
How it is reached
Advanced output, replay buffer enabled (it shares the recording encoder), recording encoder FFmpeg VA-API H.264/HEVC, AOM AV1 or SVT-AV1, 20 fps. Start the replay buffer, start recording a few seconds later, stop it after a few seconds.
Reproduced
Headless, private config, obs-websocket; Advanced output, mkv, 20 fps, replay buffer 20 s, a Media Source looping a clip. Each round: start the replay buffer, start recording 3 s later and stop it after 6 s; then a round that starts recording 1 s after the replay buffer and stops it after 2 s. Two rounds of each.
Current release (AppImage 33.0.0-beta6-799), SVT-AV1: the 6 s recordings hold 2.97 s; stopping the 2 s recordings takes 3.17 s and leaves 674-byte files ffprobe cannot read (Duplicate element, invalid as first byte of an EBML number). VA-API could not be run in the AppImage on the test machine (its bundled libva does not load the system's VA-API driver), so VA-API was reproduced with a master build:
Current master, VA-API H.264 (default settings, keyframe interval 120 frames): the 6 s recordings hold 3.0 s; stopping the 2 s recordings takes 3.18 s and leaves unreadable 735-byte files. SVT-AV1 in the same build: 2.7 s, and 3.4 s stops with unreadable files.
Proposed fix and failing test
Fix: implement request_keyframe in obs-ffmpeg for VA-API H.264 and HEVC and for AOM AV1 and SVT-AV1: the next frame goes to FFmpeg with pict_type = AV_PICTURE_TYPE_I, which FFmpeg's VA-API encoders turn into an IDR frame, libaom into a forced keyframe and SVT-AV1 into a key picture.
RED test: extend test_encoder_join_keyframe with cases that load the built obs-x264 and obs-ffmpeg modules and run the same join with the real encoders (10 s keyframe interval). The joining output's first packet must be a keyframe made from the frame the encoder got when the output joined, within a few frames. Today the four obs-ffmpeg cases get nothing within 3 s; x264 passes. Each case skips when its encoder is not available (no VA-API device, FFmpeg without the library), as in CI.
Not covered: NVENC, QSV and AMF (no such hardware to test on), VA-API AV1 (the test GPU has no AV1 encoding), and OpenH264 (the system FFmpeg used here is built without libopenh264).
RED: test_encoder_join_keyframe gets real-encoder cases (x264, VA-API H.264/HEVC, AOM AV1, SVT-AV1); the four obs-ffmpeg ones fail: the joining output waits for the next scheduled keyframe.
Activity
rdoupe commentedon Oct 13, 2026
Claiming: this issue.
test_encoder_join_keyframegets real-encoder cases (x264, VA-API H.264/HEVC, AOM AV1, SVT-AV1); the four obs-ffmpeg ones fail: the joining output waits for the next scheduled keyframe.request_keyframe(from libobs, obs-x264: Ask a running encoder for a keyframe when an output joins #594) for those encoders.PR today.
obs-ffmpeg: Make a keyframe when an output joins a running encoder
obs-ffmpeg: Make a keyframe when an output joins a running encoder (o…