Skip to content

fix(converter): properly handle cover art for OGG and OPUS output#992

Open
berettavexee wants to merge 1 commit into
nathom:devfrom
berettavexee:fix/converter-ogg-opus-art
Open

fix(converter): properly handle cover art for OGG and OPUS output#992
berettavexee wants to merge 1 commit into
nathom:devfrom
berettavexee:fix/converter-ogg-opus-art

Conversation

@berettavexee

@berettavexee berettavexee commented Jun 14, 2026

Copy link
Copy Markdown

Supersedes #991.

Problem

Converting to OGG (Vorbis) or OPUS fails to handle cover art correctly in two ways:

1. FFmpeg error or Theora stream — when the source file (e.g. a tagged FLAC) contains an embedded cover art video stream, FFmpeg processes all input streams by default. With -c:v copy, the OGG/Opus muxer rejects it and exits with an error. Without it, FFmpeg silently transcodes the cover to Theora, producing an unexpected video stream in the .ogg / .opus output.

2. No cover art at all — the previous workaround (copy_art = False) simply skipped art entirely.

Fix

Two-part approach:

Part 1 — suppress FFmpeg video handling for incompatible muxers

A new class attribute _ffmpeg_supports_art (default True) lets subclasses signal that their muxer cannot handle video streams. Vorbis and OPUS set it to False. _gen_command() then:

  • skips -c:v copy for these formats
  • adds -vn to explicitly discard any video stream from the input

Part 2 — embed art post-conversion via mutagen

Cover art is embedded after FFmpeg completes using the METADATA_BLOCK_PICTURE Vorbis comment tag, which both OGG Vorbis and Opus containers support natively. The art data is read from the source file before conversion starts, so it remains available even when remove_source=True causes the source to be deleted during the process.

No behaviour change for FLAC, MP3, ALAC, or AAC converters.

Test plan

  • rip -c ogg url <url>.ogg output contains no video stream, cover art is embedded
  • rip -c opus url <url>.opus output contains no video stream, cover art is embedded
  • rip -c mp3 url <url> — unchanged behaviour (art via -c:v copy)
  • rip -c aac url <url> — unchanged behaviour (art via -c:v copy)
  • Source with no embedded art — conversion succeeds, no warning

🤖 Generated with Claude Code

The OGG and Opus muxers do not support -c:v copy when the source file
contains an embedded cover art video stream (e.g. a tagged FLAC). This
caused FFmpeg to either fail outright or silently transcode the cover
art to Theora, producing an unexpected video stream in the output.

This commit fixes the issue with a two-part approach:

1. A new class attribute `_ffmpeg_supports_art` (True by default) lets
   subclasses signal that their muxer cannot handle video streams.
   Vorbis and OPUS set it to False. The `_gen_command()` method then:
   - skips `-c:v copy` for these formats
   - adds `-vn` to explicitly discard any video stream from the input

2. Cover art is instead embedded post-conversion via mutagen using the
   METADATA_BLOCK_PICTURE Vorbis comment tag, which both OGG Vorbis and
   Opus containers support natively. The art is read from the source
   file *before* conversion starts so it remains available even when
   `remove_source=True` causes the source to be deleted mid-process.

No behaviour change for FLAC, MP3, ALAC, or AAC converters.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant