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: media-playback: non-looping media (e.g. a GIF) drops its last frames (upstream #10425) #306
Upstream OBS bug, reported by XC3N in obsproject/obs-studio#10425 (reproduced by RytoEX). Code unchanged in this fork.
Location
shared/media-playback/media-playback/media.cmp_media_thread(): after outputting a frame the thread decodes the next one; when there is none and looping is off, mp_media_eof() stops playback at once, without waiting for the last frame's duration (looping waits for it through the offset in mp_media_reset).
The stop calls media_stopped (plugins/obs-ffmpeg/obs-ffmpeg-source.c), which clears the source with obs_source_output_video(NULL), and that drops every frame libobs has queued but not yet shown (free_async_cache). In buffered mode libobs shows a frame up to about one frame interval plus one output frame after it is output, so the last frame, and usually the one before it, is never shown.
Class
Wrong output: the end of non-looping media is cut, most visibly on GIFs (about 90% of frames shown, per the report).
How it is reached
A Media Source with Loop off playing a GIF (or any clip) once, with "Show nothing when playback ends" on (the default): the last frame(s) never appear on program output. Not GIF-specific; at video frame rates it is just hard to see.
Reproduced with the real ffmpeg_source and a generated 10-frame GIF (one solid colour per frame, 100 ms each) at 30 fps output: 8 of 10 frames appear; the same with a 10-frame video clip.
Proposed fix and failing test
Fix: when playback reaches its end with Loop off, the media thread keeps the last frame up for its duration plus the time libobs needs to show it (the interval between the last two frames plus two output frames, capped at 3 s) before it stops. A user stop still clears at once; looping is unchanged.
RED test (cmocka, test_media_gif_last_frame): one-shot GIF, one-shot video, and a looping GIF guard; it checks every frame appears in order. 2 of 3 fail today.
RED: test_media_gif_last_frame (2 of 3 failing): a generated 10-colour GIF and video played once through the real ffmpeg_source, every frame checked on program output.
GREEN: the media thread holds the last frame long enough for libobs to show it before stopping.
PR today.
@XC3N you reported this in obsproject/obs-studio#10425, so a heads-up: it's fixed here in obs-rust by #307, merged today with a regression test.
Cause: with Loop off, the media player stopped the moment it ran out of frames, without waiting for the last frame's duration, and the stop cleared the frames OBS had queued but not yet shown, so the last frame (and usually the one before it) never appeared. It isn't GIF-specific; a GIF just makes it obvious. Now the player keeps the last frame up long enough for OBS to show it before it stops; a manual stop still clears at once and looping is unchanged. The test plays a 10-colour GIF once through a real Media Source and checks every frame on the output: before, 8 of 10 appeared; now all 10 do, in order.
Not covered yet: Stinger transitions with "preload into memory" still lose their last frame (a separate code path).
Workaround on stock OBS: duplicate the last frame of the GIF (or add a short hold at the end).
obs-rust is an AI-assisted fork of OBS; on Arch it's obs-studio-rust-git in the AUR.
If you try it, a short reply here on whether your GIFs now play to the end would really help.
Activity
rdoupe commentedon Oct 12, 2026
Claiming: this issue.
test_media_gif_last_frame(2 of 3 failing): a generated 10-colour GIF and video played once through the realffmpeg_source, every frame checked on program output.PR today.
test: Media Source shows every frame of a one-shot GIF
rdoupe commentedon Oct 12, 2026
@XC3N you reported this in obsproject/obs-studio#10425, so a heads-up: it's fixed here in obs-rust by #307, merged today with a regression test.
Cause: with Loop off, the media player stopped the moment it ran out of frames, without waiting for the last frame's duration, and the stop cleared the frames OBS had queued but not yet shown, so the last frame (and usually the one before it) never appeared. It isn't GIF-specific; a GIF just makes it obvious. Now the player keeps the last frame up long enough for OBS to show it before it stops; a manual stop still clears at once and looping is unchanged. The test plays a 10-colour GIF once through a real Media Source and checks every frame on the output: before, 8 of 10 appeared; now all 10 do, in order.
Not covered yet: Stinger transitions with "preload into memory" still lose their last frame (a separate code path).
Workaround on stock OBS: duplicate the last frame of the GIF (or add a short hold at the end).
obs-rust is an AI-assisted fork of OBS; on Arch it's
obs-studio-rust-gitin the AUR.If you try it, a short reply here on whether your GIFs now play to the end would really help.
shared/media-playback: Show the last frames of non-looping media