Skip to content

fix(#41): keep non-image Matroska attachments when adding cover art - #42

Merged
jamerst merged 1 commit into
jamerst:masterfrom
Stefan-Tri:fix/matroska-cover-attachments
Oct 4, 2026
Merged

jamerst merged 1 commit into
jamerst:masterfrom
Stefan-Tri:fix/matroska-cover-attachments

Conversation

@Stefan-Tri

Copy link
Copy Markdown

This fixes #41.

When adding cover art to a Matroska file, FileWriter now only replaces image attachments and keeps all other attachments (e.g. the fonts used by ASS/SSA subtitles). Other formats are unchanged and still get the cover as their only picture.

Result

With the steps from #41, listing the attachments

ffprobe -v error -show_entries stream=codec_type:stream_tags=filename,mimetype \
  -of compact=p=0 "Movie (2020).mkv"

now results in

codec_type=video
codec_type=video|tag:filename=cover.jpg|tag:mimetype=image/jpeg
codec_type=attachment|tag:filename=Font.ttf|tag:mimetype=application/x-truetype-font

instead of

codec_type=video
codec_type=video|tag:filename=cover.jpg|tag:mimetype=image/jpeg

Testing

  • New unit test Should_KeepNonImageAttachments_WhenAddingCoverArtToMatroska, using a small MKV in AutoTag.Core.Test/TestData (generate.sh recreates it with ffmpeg). It fails without the fix.
  • AutoTag.Core.Test: all tests pass locally. AutoTag.CLI.Test: passes locally with a TMDB API key.
  • Verified with a real file (14 ASS subtitle tracks, 20 font attachments): before the fix all 20 fonts were removed, with the fix all 20 are kept byte-identical and the cover is added.

…r art

TagLib exposes every Matroska attachment as a picture, including the
fonts that ASS/SSA subtitles need. Setting Tag.Pictures to the cover
alone deleted them. For Matroska files only image attachments are now
replaced; other file types still get the cover as their only picture.
@jamerst
jamerst merged commit 67fbe33 into jamerst:master Oct 4, 2026
1 of 4 checks passed
@jamerst

jamerst commented Oct 4, 2026

Copy link
Copy Markdown
Owner

Thanks for the fix! This is released in v4.1.4

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.

Title: Adding cover art to MKV files deletes all other attachments (e.g. subtitle fonts)

2 participants