#3491(undetermined:new): MKV muxer corrupts subtitles
#3491: MKV muxer corrupts subtitles -------------------------------------+------------------------------------- Reporter: ValdikSS | Type: defect Status: new | Priority: important Component: | Version: undetermined | unspecified Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | -------------------------------------+------------------------------------- Summary of the bug: Remuxing MKV with embedded subtitles can cause some sort of subtitles corruption in the resulting MKV file. Some lines or karaoke effects could disappear in certain video players. How to reproduce: I've uploaded 2 files into incoming folder on FTP: mkv_subtitles.mkv (http://yadi.sk/d/NM69ZxZQKzNn7) and mkv_subtitles_ffmpeg.mkv (http://yadi.sk/d/qDFmsDPQKzNoQ). The second one was remuxed with the following command: {{{ ffmpeg -i mkv_subtitles.mkv -map 0 -map_metadata 0 -c copy mkv_subtitles_ffmpeg.mkv }}} Subtitles in the first file are played correctly while in ffmpeg-remuxed file some karaoke effects and english translation is missing (tested with cmplayer, vlc, mpv and mplayer. It works correctly only in mplayer). If you extract subtitles with {{{ mkvextract tracks mkv_subtitles.mkv 1:sub_orig.ass mkvextract tracks mkv_subtitles_ffmpeg.mkv 1:sub_ffmpeg.ass }}} you can see the difference between them (with diff). But if you remux MKV with extracted subtitles (extracted either with ffmpeg or mkvextract, either from original or remuxed mkv with broken subtitles), it works fine. {{{ ffmpeg -i mkv_subtitles.mkv -i sub_ffmpeg.ass -map 0 -map -0:s -map 1 -c copy test.mkv }}} -- Ticket URL: <https://trac.ffmpeg.org/ticket/3491> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#3491: MKV muxer corrupts subtitles -------------------------------------+------------------------------------- Reporter: ValdikSS | Owner: Type: defect | Status: new Priority: important | Component: Version: unspecified | undetermined Keywords: | Resolution: Blocking: | Blocked By: Analyzed by developer: 0 | Reproduced by developer: 0 -------------------------------------+------------------------------------- Changes (by gjdfgh): * cc: nfxjfg@… (added) Comment: Can you post the diff? -- Ticket URL: <https://trac.ffmpeg.org/ticket/3491#comment:1> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#3491: MKV muxer corrupts subtitles -------------------------------------+------------------------------------- Reporter: ValdikSS | Owner: Type: defect | Status: new Priority: important | Component: Version: unspecified | undetermined Keywords: | Resolution: Blocking: | Blocked By: Analyzed by developer: 0 | Reproduced by developer: 0 -------------------------------------+------------------------------------- Comment (by cehoyos): Is this a regression? -- Ticket URL: <https://trac.ffmpeg.org/ticket/3491#comment:2> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#3491: MKV muxer corrupts subtitles -------------------------------------+------------------------------------- Reporter: ValdikSS | Owner: Type: defect | Status: new Priority: important | Component: Version: unspecified | undetermined Keywords: | Resolution: Blocking: | Blocked By: Analyzed by developer: 0 | Reproduced by developer: 0 -------------------------------------+------------------------------------- Comment (by ValdikSS): Replying to [comment:2 cehoyos]:
Is this a regression?
I'm not sure. If this a regression, then it was introduced a long time ago, more then 1.5 years. Here is IRC log with the same issue from November 2012 https://gist.github.com/klaxa/197efb68e549d01193b8 -- Ticket URL: <https://trac.ffmpeg.org/ticket/3491#comment:3> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#3491: MKV muxer corrupts subtitles -------------------------------------+------------------------------------- Reporter: ValdikSS | Owner: Type: defect | Status: new Priority: important | Component: Version: unspecified | undetermined Keywords: | Resolution: Blocking: | Blocked By: Analyzed by developer: 0 | Reproduced by developer: 0 -------------------------------------+------------------------------------- Comment (by ValdikSS): Replying to [comment:1 gjdfgh]:
Can you post the diff?
Subtitles extracted from original file with ffmpeg are the same as extracted from remuxed file with ffmpeg. Subtitles extracted from remuxed file with ffmpeg are different from extracted with mkvextract. Here is the diff. -- Ticket URL: <https://trac.ffmpeg.org/ticket/3491#comment:4> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#3491: MKV muxer corrupts subtitles -------------------------------------+------------------------------------- Reporter: ValdikSS | Owner: Type: defect | Status: new Priority: important | Component: Version: unspecified | undetermined Keywords: | Resolution: Blocking: | Blocked By: Analyzed by developer: 0 | Reproduced by developer: 0 -------------------------------------+------------------------------------- Comment (by gjdfgh): Sorry, your diff is pretty useless. Appears it thinks _all_ lines are different, maybe due to line ending issues or so. Anyway, I made my own diff. Looking at this, it seems like ffmpeg reorders some lines when it shouldn't. In general, ffmpeg doesn't respect the order of the lines (ReadOrder field internal to matroska ASS packets), and this is probably the problen. But I'm surprised that this has such a large effect. -- Ticket URL: <https://trac.ffmpeg.org/ticket/3491#comment:5> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#3491: MKV muxer corrupts subtitles -------------------------------------+------------------------------------- Reporter: ValdikSS | Owner: Type: defect | Status: new Priority: important | Component: Version: unspecified | undetermined Keywords: | Resolution: Blocking: | Blocked By: Analyzed by developer: 0 | Reproduced by developer: 0 -------------------------------------+------------------------------------- Comment (by Cigaes): That happens because, by default, the Matroska demuxer uses some legacy format for demuxed ASS packets. You can get it to use the newer format, and thus preserve the read order, by adding {{{-c:s ass}}} as input option. -- Ticket URL: <https://trac.ffmpeg.org/ticket/3491#comment:6> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
That happens because, by default, the Matroska demuxer uses some legacy
#3491: MKV muxer corrupts subtitles -------------------------------------+------------------------------------- Reporter: ValdikSS | Owner: Type: defect | Status: new Priority: important | Component: Version: unspecified | undetermined Keywords: | Resolution: Blocking: | Blocked By: Analyzed by developer: 0 | Reproduced by developer: 0 -------------------------------------+------------------------------------- Comment (by ValdikSS): Replying to [comment:6 Cigaes]: format for demuxed ASS packets.
You can get it to use the newer format, and thus preserve the read order, by adding {{{-c:s ass}}} as input option.
It doesn't work with this subtitles. {{{ [ass @ 0x1156660] ASS encoder supports only one ASS rectangle field. }}} -- Ticket URL: <https://trac.ffmpeg.org/ticket/3491#comment:7> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#3491: MKV muxer corrupts subtitles -------------------------------------+------------------------------------- Reporter: ValdikSS | Owner: Type: defect | Status: new Priority: important | Component: Version: unspecified | undetermined Keywords: | Resolution: Blocking: | Blocked By: Analyzed by developer: 0 | Reproduced by developer: 0 -------------------------------------+------------------------------------- Comment (by gjdfgh): Actually, I was wrong. The matroska file contains bogus packets with duplicate ReadOrder values. The ffmpeg produced mkv files are thus 100% broken. With mpv, it actually works with --demuxer=lavf, because that uses the old way to demux Matroska ASS packets, which "happens" to work (I can explain details). MPlayer works because it uses the libavformat demuxer. What Cigaes said probably applies here. -- Ticket URL: <https://trac.ffmpeg.org/ticket/3491#comment:8> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#3491: MKV muxer corrupts subtitles -------------------------------------+------------------------------------- Reporter: ValdikSS | Owner: Type: defect | Status: new Priority: important | Component: Version: unspecified | undetermined Keywords: | Resolution: Blocking: | Blocked By: Analyzed by developer: 0 | Reproduced by developer: 0 -------------------------------------+------------------------------------- Comment (by ValdikSS): Just updated diff file with correct one. -- Ticket URL: <https://trac.ffmpeg.org/ticket/3491#comment:9> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
That happens because, by default, the Matroska demuxer uses some legacy
You can get it to use the newer format, and thus preserve the read order, by adding {{{-c:s ass}}} as input option. Sorry, it seems like i've added it after -i. Adding before -i solves the
#3491: MKV muxer corrupts subtitles -------------------------------------+------------------------------------- Reporter: ValdikSS | Owner: Type: defect | Status: new Priority: important | Component: Version: unspecified | undetermined Keywords: | Resolution: Blocking: | Blocked By: Analyzed by developer: 0 | Reproduced by developer: 0 -------------------------------------+------------------------------------- Comment (by ValdikSS): Replying to [comment:6 Cigaes]: format for demuxed ASS packets. problem. Should this option be used by default? -- Ticket URL: <https://trac.ffmpeg.org/ticket/3491#comment:10> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#3491: MKV muxer corrupts subtitles -------------------------------------+------------------------------------- Reporter: ValdikSS | Owner: Type: defect | Status: new Priority: important | Component: Version: unspecified | undetermined Keywords: | Resolution: Blocking: | Blocked By: Analyzed by developer: 0 | Reproduced by developer: 0 -------------------------------------+------------------------------------- Comment (by gjdfgh): Depending on the reader, the extracted subtitles won't show the problem, btw. libass uses the ReadOrder field to remove duplicates (so if two events have the same ReadOrder value, one of them is removed, even if they are different). Extract from the file: {{{ 151,2,OP_Romaji_1,,0,0,0,,{\be1\an5\pos(784,56)\fscy230\fscx182\1c&HFFFFFF&\bord0\shad0}no 152,27,OP_Romaji_1,,0,0,0,,{\be1\an5\pos(774,50)\alpha&H79&}no 152,2,OP_Romaji_1,,0,0,0,,{\be1\an5\pos(779,61)\fscy206\fscx226\1c&HFFFFFF&\bord0\shad0}no 153,27,OP_Romaji_1,,0,0,0,,{\be1\an5\pos(774,46)\alpha&H79&}no }}} The 3rd event is never displayed, because it has the same ReadOrder as the 2nd. -- Ticket URL: <https://trac.ffmpeg.org/ticket/3491#comment:11> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#3491: MKV muxer corrupts subtitles -------------------------------------+------------------------------------- Reporter: ValdikSS | Owner: Type: defect | Status: new Priority: normal | Component: Version: unspecified | undetermined Keywords: | Resolution: Blocking: | Blocked By: Analyzed by developer: 0 | Reproduced by developer: 0 -------------------------------------+------------------------------------- Changes (by cehoyos): * priority: important => normal -- Ticket URL: <https://trac.ffmpeg.org/ticket/3491#comment:12> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#3491: MKV muxer corrupts subtitles -------------------------------------+------------------------------------ Reporter: ValdikSS | Owner: ValdikSS Type: defect | Status: open Priority: normal | Component: avformat Version: unspecified | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | -------------------------------------+------------------------------------ Changes (by ValdikSS): * owner: => ValdikSS * status: new => open * component: undetermined => avformat Comment: https://ffmpeg.org/pipermail/ffmpeg-devel/2014-April/157159.html -- Ticket URL: <https://trac.ffmpeg.org/ticket/3491#comment:13> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#3491: MKV muxer corrupts subtitles ------------------------------------+------------------------------------ Reporter: ValdikSS | Owner: ValdikSS Type: defect | Status: closed Priority: normal | Component: avformat Version: git-master | Resolution: fixed Keywords: mkv ass | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | ------------------------------------+------------------------------------ Changes (by cehoyos): * keywords: => mkv ass * status: open => closed * version: unspecified => git-master * resolution: => fixed Comment: Please reopen if this ticket is still reproducible, a larger patch that includes the change you suggested was committed some time ago. -- Ticket URL: <https://trac.ffmpeg.org/ticket/3491#comment:14> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
participants (1)
-
FFmpeg