Skip to content

bug: media-playback: seeking audio with embedded cover art ends playback (upstream #11195) #312

Closed

Description

@rdoupe

Upstream OBS bug, reported by ccc-rrr in obsproject/obs-studio#11195 (who traced it into media.c; also Sugam-Chand-M, olliesouthie and Colonel-Crapshot, confirmed by prgmitchell; related obsproject/obs-studio#9428 and #11739). Code unchanged in this fork.

Location

  • shared/media-playback/media-playback/media.c: FFmpeg exposes an audio file's cover art as a video stream with a single packet (AV_DISPOSITION_ATTACHED_PIC), and media.c counts it as video. After that one frame, reading ahead for the next video frame reaches the end of the file at once and sets m->eof.
  • seek_to() repositions the demuxer and flushes the decoders but never clears m->eof (only mp_media_reset() does), so after a seek no more packets are read, the decoders drain, playback ends and the source jumps back to the start.

Class

Broken playback control: seeking in an audio file with embedded cover art stops playback instead of continuing from the new position.

How it is reached

A Media Source playing an MP3 (or FLAC, etc.) that has embedded cover art: dragging the media slider, or seeking through the API, ends playback and resets it to 0. Files without cover art seek normally.

Reproduced with the real ffmpeg_source and generated 5 s tones with and without a JPEG cover: with a cover, after seeking to 2.5 s playback ends within ~24-96 ms; without one it continues.

Proposed fix and failing test

Fix: in seek_to(), clear m->eof once a local file has been repositioned (FFmpeg queues the cover packet again after every seek, so the cover keeps showing and the audio continues). Ignoring the cover stream instead (the reporter's workaround) was rejected: it removes the cover art users see.

RED test (cmocka, test_media_cover_art_seek): MP3 and FLAC with cover, a seek after the scene was reactivated, and no-cover guards. 3 of 5 fail today.

Not covered: the Windows-only monitoring symptom from #9428/#11739 has a different cause (wasapi-output.c), to be handled separately.

Activity

  1. rdoupe commented on Oct 12, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: this issue.

    1. RED: test_media_cover_art_seek (3 of 5 failing): generated MP3/FLAC with and without cover art through the real ffmpeg_source, seek to the middle, playback measured.
    2. GREEN: clear end-of-file when seeking a local file.
      PR today.
  2. added 2 commits that reference this issue on Oct 12, 2026
    2c06829
    cc6a2fc
  3. rdoupe commented on Oct 12, 2026

    @rdoupe
    CollaboratorAuthor

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

    Cause, as you traced into media.c: FFmpeg exposes the cover art as a one-frame video stream, so after that frame the player reads ahead to the end of the file and sets its end-of-file flag, and seeking never cleared that flag, so playback ended right after every seek. Now a seek clears it; FFmpeg delivers the cover again after each seek, so the cover keeps showing and the audio continues from the new position. Your workaround of ignoring the cover stream wasn't needed. The test plays generated MP3 and FLAC files with and without a cover and seeks to the middle: before, the covered files stopped within ~0.1 s; now they keep playing like the others.

    Not covered: the Windows-only "monitoring goes silent" symptom from obsproject/obs-studio#9428 / #11739 has a different cause in the Windows audio-monitoring code and still needs a Windows fix.

    Workaround on stock OBS: strip the embedded cover art from the files.

    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 seeking works with your files 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