Ticket #1223 (closed defect: fixed)

Opened 13 months ago

Last modified 8 months ago

Problem with .ass subtitles

Reported by: saito1234 Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: ass mkv padding
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

I'm encoding from .mkv files to .mkv, with copying the .ass subtitles (-scodec copy, or -map 0), and in some cases the subtitles are only copied until a certain length, here are 2 examples:
[Tsumiki]_Acchi_Kocchi_-_02_[10bit][1280x720][529E1BBB]_track3_eng_original.ass it's 268,1k (~24 mins), and the encoded file only has the subs until 0:01:41.00 (17,2k)
Also:
[FFFpeeps] Sengoku Collection - 02 [10bit][67CEAC4B]_track3_eng_original.ass (68,5k)
[FFFpeeps] Sengoku Collection - 02 [10bit][67CEAC4B]_track3_eng_encoded.ass (37,3k)
The encoded file only has subs until 0:08:13, instead of 0:23:59 !

Attachments

original_and_encoded_ass_files.zip Download (66.7 KB) - added by saito1234 13 months ago.
The Original and the extracted .ass files from the encoded files.
[FFFpeeps] Sengoku Collection - 02 [10bit][67CEAC4B]_track3_eng_original.ass Download (68.5 KB) - added by saito1234 13 months ago.
Original .ass file
[FFFpeeps] Sengoku Collection - 02 [10bit][67CEAC4B]_track3_eng_original.2.ass Download (68.5 KB) - added by saito1234 13 months ago.
Extracted .ass file from the encoded .mkv
[Tsumiki]_Acchi_Kocchi_-_02_[10bit][1280x720][529E1BBB]_track3_eng_original.ass Download (268.1 KB) - added by saito1234 13 months ago.
Original .ass file
[Tsumiki]_Acchi_Kocchi_-_02_[10bit][1280x720][529E1BBB]_track3_eng_encoded.ass Download (17.2 KB) - added by saito1234 13 months ago.
Extracted .ass file from the encoded .mkv
[FFFpeeps] Sengoku Collection - 02 [10bit][67CEAC4B]_track3_eng_encoded.ass Download (37.3 KB) - added by saito1234 13 months ago.
Extracted .ass file from the encoded .mkv
output.tgz Download (1.3 MB) - added by saito1234 13 months ago.
Console Output
[Tsumiki]_Acchi_Kocchi_-_02_[10bit][1280x720][529E1BBB]_(TEST).mkv Download (821.5 KB) - added by saito1234 13 months ago.
A splitted out file, with the whole (original) .ass in, for testing.

Change History

Changed 13 months ago by saito1234

The Original and the extracted .ass files from the encoded files.

Changed 13 months ago by saito1234

Original .ass file

Changed 13 months ago by saito1234

Extracted .ass file from the encoded .mkv

Changed 13 months ago by saito1234

Original .ass file

Changed 13 months ago by saito1234

Extracted .ass file from the encoded .mkv

Changed 13 months ago by saito1234

Extracted .ass file from the encoded .mkv

comment:1 Changed 13 months ago by saito1234

Sorry, [FFFpeeps] Sengoku Collection - 02 [10bit][67CEAC4B]_track3_eng_original.ass was accidentally added 2 times, I didn't find a way to remove it, also I've uploaded all 4 files into a single .zip file too.

comment:2 Changed 13 months ago by cehoyos

  • Keywords ffmpeg, subtitle, error removed
  • Component changed from FFmpeg to undetermined

Please add a (minimal) ffmpeg command line that allows to reproduce the problem together with complete, uncut console output.

comment:3 Changed 13 months ago by saito1234

Well, I'm testing it like this:
ffmpeg -i "[FFFpeeps] Sengoku Collection - 02 [10bit][67CEAC4B].mkv" -acodec copy -vcodec copy -scodec copy teszt.mkv
(so: ffmpeg -i filename -acodec copy -vcodec copy -scodec copy teszt.mkv )

By the way, both .ass files have a lot of formatting characters in them, before they're cutted off, I think that is, where the problem will be, I've encoded 20-30 files so far, and only these two .ass files had the problem, the others (where usually there isn't so much formatting characters) are perfectly encoded.

Changed 13 months ago by saito1234

Console Output

comment:4 Changed 13 months ago by Cigaes

We do not have the complete Matroska file, and by the name I guess it is rather big.

I was not able to reproduce the problem with the file you attached, neither directly nor by creating Matroska file holding just the subtitles.

Can you reproduce the problem with another file? Trying to remux the file with mkvmerge into a theoretically identical file would be a good start.

comment:5 Changed 13 months ago by saito1234

Well, you're right, I can't upload the source file here because it's too big, I've muxed this subtitle to a 800 kb split from the same file (so the circumstances are the same), and tried to reencode it, the problem still occurs, so I think this will be good too, for reproducing!
(As the test mkv file isn't long enough, after encoding you'll need to extract the .ass file, and view it with a text editor, to see the differences)

Also, I got the following message too:

"Stream mapping:

Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Stream #0:2 -> #0:2 (ass -> ass)

Press [q] to stop, ? for help
[matroska @ 0x2d6f400] Encoder did not produce proper pts, making some up.
Error while decoding stream #0:2

Last message repeated 800 times

frame= 90 fps=0.0 q=-1.0 Lsize= 690kB time=00:00:03.62 bitrate=1558.2kbits/s
video:518kB audio:59kB global headers:3kB muxing overhead 19.006394%"

Error while decoding stream #0:2

Last message repeated 800 times

-> probably this is the important part, but I don't understand, because sometimes it doesn't writes this error (while testing with the file, maybe just the first time?), and the encoded output is still incorrect! (so I think the Error message isn't always displayed)

Also, I've used the following command to encode:
ffmpeg -i "[Tsumiki]_Acchi_Kocchi_-_02_[10bit][1280x720][529E1BBB]_(TEST).mkv" -acodec copy -vcodec copy -scodec copy test.mkv

Last edited 13 months ago by saito1234 (previous) (diff)

Changed 13 months ago by saito1234

A splitted out file, with the whole (original) .ass in, for testing.

comment:6 Changed 13 months ago by Cigaes

Thanks for the test file. The same command line you posted using the test file works for me, either with a fresh build or a six months old: mkvextract dumps the same ASS file, except for the order of the lines.

comment:7 Changed 13 months ago by saito1234

So, that means that after reencoding this (TEST) file, you got the same .ass back?

That's interesting, I've tested it multiple times, and after encoding with the same command line, dumping the .ass from test.mkv, I got a 124k file, (instead of 242k), and these are the last lines in it:

Dialogue: 0,0:03:49.12,0:03:49.16,TS,,0000,0000,0000,,{\bord5\blur0.5\b1\fs80\fnCoolvetica Rg\pos(256,81)\1a&HFF&\3c&H2D179B&}Rage
Dialogue: 1,0:03:49.12,0:03:49.16,TS,,0000,0000,0000,,{\1a&H55&\blur0.5\b1\fs80\fnCoolvetica Rg\pos(256,81)\c&HE9E9EE&}Rage

I have the following version installed:

ffmpeg -version
ffmpeg version git-2012-04-09-6bfb304
built on Apr 10 2012 10:15:51 with gcc 4.4.3
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3 --enable-x11grab
libavutil 51. 46.100 / 51. 46.100
libavcodec 54. 14.101 / 54. 14.101
libavformat 54. 3.100 / 54. 3.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 67.101 / 2. 67.101
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 10.100 / 0. 10.100
libpostproc 52. 0.100 / 52. 0.100

(Ubuntu 10.04)
Also, as I've said, I think the .ass files are only cutted off before they're finished (with Error while decoding stream #0:2), when there's a lot of text formatting characters in the .ass file, could the problem be in something other than ffmpeg? (Sorry, but I'm relatively a beginner at Linux)

Version 0, edited 13 months ago by saito1234 (next)

comment:8 Changed 13 months ago by saito1234

Hmm, after further testing I think "-scodec ass" causes the errors, instead of "-scodec copy", but I'm not sure, because first time I've used "-map 0" (no -scodec, because I wanted to copy the fonts too, from the mkv file, and this seemed to work), I don't know if this caused the problems or not, but I've reencoded the file and now it is ok!

Last edited 13 months ago by saito1234 (previous) (diff)

comment:9 Changed 13 months ago by Cigaes

  • Status changed from new to open
  • Reproduced by developer set

Ok, I could reproduce it. The core of the problem seems to be that the packet data sent to the ASS decoder is, for some reason, not padded with 0 bytes. That leads the ASS decoder to parse junk after the end the packet.

I'll try to find out where that comes from.

comment:10 Changed 13 months ago by Cigaes

  • Analyzed by developer set
  • Keywords matroska padding added
  • Component changed from undetermined to avformat

comment:11 Changed 13 months ago by saito1234

Thanks, I've tested it, and now it seems like there are no problems!

comment:12 Changed 13 months ago by Cigaes

  • Status changed from open to closed
  • Resolution set to fixed

comment:13 Changed 8 months ago by cehoyos

  • Keywords mkv added; matroska removed
Note: See TracTickets for help on using tickets.