Skip to content

bug: obs-ffmpeg/libobs: Media Source flashes its previous last frame when restarted on activation (upstream #4667) #249

Closed

Description

@rdoupe

Upstream OBS bug, reported by mercantigo in obsproject/obs-studio#4667 (earlier obsproject/obs-studio#2906). Code unchanged in this fork.

Location

Class

Visual glitch: a stale frame is shown on screen and in recordings and streams.

How it is reached

A Media Source with "Restart playback when source becomes active" on (the default) and "Show nothing when playback ends" off plays to the end and keeps its last frame. The scene is switched away and back. For one or two output frames the source shows the previous playback's last frame, then plays from the start. It is most visible when the first and last frames differ, for example an animated overlay. Upstream confirmations from 26.x to 32.x, on Windows and macOS among others (SimonGZ, CSMBY, parish-of-brentford, codemann8, VirtuallyJesse, DrewSunn, RoyceRemix, contentfree, SpokeLee).

Reproduced with the real ffmpeg_source and a generated clip: after switching back, the output goes nothing, LAST frame, first frame.

Proposed fix and failing test

Fix, two halves, each needed (either alone still shows the old frame for one output frame):

RED test (cmocka, test_media_restart_stale_frame): the Media Source scenario above, plus a scripted async source that clears and then queues or preloads a frame on known ticks. 3 of 5 fail today; the two guards (a clear still clears, a preloaded frame shows on the next tick) pass.

Activity

  1. rdoupe commented on Oct 11, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: this issue.

    1. RED: test_media_restart_stale_frame (3 of 5 failing): the real ffmpeg_source restarting on activation, plus a scripted async source that clears and then queues or preloads a frame.
    2. GREEN: ffmpeg_source_activate() clears the source before queueing the restart, and libobs stops drawing async textures that a clear made stale.
      PR today.
  2. added 2 commits that reference this issue on Oct 11, 2026
    bde26a6
    dfdcbd0
  3. rdoupe commented on Oct 11, 2026

    @rdoupe
    CollaboratorAuthor

    @mercantigo you reported this in obsproject/obs-studio#4667, so a heads-up: it's fixed here in obs-rust by #250, merged today with a regression test.

    Cause: when a Media Source restarted on activation, the restart only ran on the next video tick, and clearing the source left the old picture in its textures, so the first output frames after switching back showed the previous playback's last frame. Now the source is cleared before the restart is queued (the activation half of Poodmund's upstream PR obsproject/obs-studio#11881, credited as co-author), and libobs no longer draws textures that a clear made stale. The test plays a clip through the real Media Source and switches scenes away and back: before, the output went nothing, last frame, first frame; now it goes straight to the first frame.

    Not covered: sources with deinterlacing enabled still use a separate render path that can show the old frame.

    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 the flash is gone would really help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions