[FFmpeg-trac] #4591(avformat:new): attachments mjpeg are discovered wrongly as video stream and therefore h264 encoding is broken
FFmpeg
trac at avcodec.org
Fri Jan 3 21:21:15 EET 2025
#4591: attachments mjpeg are discovered wrongly as video stream and therefore h264
encoding is broken
-------------------------------------+-------------------------------------
Reporter: TheoMeister | Owner: (none)
Type: defect | Status: new
Priority: important | Component: avformat
Version: git-master | Resolution:
Keywords: mkv | Blocked By:
regression |
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Comment (by winterlint_):
Still an issue. Reproduce:
{{{
# Fetch
yt-dlp --embed-info-json --embed-thumbnail --merge-output-format mkv
--output 'in.%(ext)s' https://youtu.be/C0DPdy98e4c
# Mux
ffmpeg -i in.mkv -map 0 -c copy out.mkv
}}}
{{{
--- $ mediainfo in.mkv
+++ $ mediainfo out.mkv
General
Complete name : in.mkv
Format : Matroska
-Attachments : info.json / cover.jpg
+Attachments : info.json
-Video
+Video #1
ID : 1
Format : AV1
+Video #2
+ID : 3
+Format : V_MJPEG
+Matrix coefficients : BT.470 System B/G
+FILENAME : cover.jpg
+MIMETYPE : image/jpeg
Audio
ID : 2
Format : Opus
}}}
This breaks MKV as an archival format. Issue is caused by ffmpeg
inappropriately treating an attachment with mimetype `image/jpeg` as a
video track.
{{{
$ ffmpeg -hide_banner -i in.mkv
Input #0, matroska,webm, from 'in.mkv':
Metadata:
MAJOR_BRAND : dash
MINOR_VERSION : 0
COMPATIBLE_BRANDS: iso6av01mp41
ENCODER : Lavf60.16.100
Duration: 00:00:17.59, start: 0.000000, bitrate: 167 kb/s
Stream #0:0: Video: av1 (Main), yuv420p(tv, bt709), 640x480, 25 fps, 25
tbr, 1k tbn (default)
Metadata:
HANDLER_NAME : ISO Media file produced by Google Inc.
VENDOR_ID : [0][0][0][0]
DURATION : 00:00:16.600000000
Stream #0:1(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
Metadata:
DURATION : 00:00:17.588000000
Stream #0:2: Attachment: none
Metadata:
filename : info.json
mimetype : application/json
Stream #0:3: Video: mjpeg (Baseline), yuvj420p(pc,
bt470bg/unknown/unknown), 480x360 [SAR 1:1 DAR 4:3], 90k tbr, 90k tbn
(attached pic)
Metadata:
filename : cover.jpg
mimetype : image/jpeg
}}}
Suggestion, ffmpeg should never convert attachments into tracks without
explicit user action, no matter the mimetype.
External page with a person with same issue:
[https://superuser.com/questions/1858881/ffmpeg-copy-attached-cover-image-
cover-jpg-of-video-file-during-encode]
No solution exists.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/4591#comment:12>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list