fix(converter): properly handle cover art for OGG and OPUS output#992
Open
berettavexee wants to merge 1 commit into
Open
fix(converter): properly handle cover art for OGG and OPUS output#992berettavexee wants to merge 1 commit into
berettavexee wants to merge 1 commit into
Conversation
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>
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/.opusoutput.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(defaultTrue) lets subclasses signal that their muxer cannot handle video streams.VorbisandOPUSset it toFalse._gen_command()then:-c:v copyfor these formats-vnto explicitly discard any video stream from the inputPart 2 — embed art post-conversion via mutagen
Cover art is embedded after FFmpeg completes using the
METADATA_BLOCK_PICTUREVorbis 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 whenremove_source=Truecauses 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>—.oggoutput contains no video stream, cover art is embeddedrip -c opus url <url>—.opusoutput contains no video stream, cover art is embeddedrip -c mp3 url <url>— unchanged behaviour (art via-c:v copy)rip -c aac url <url>— unchanged behaviour (art via-c:v copy)🤖 Generated with Claude Code