Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#1223 closed defect (fixed)

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 (8)

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

Change History (21)

by saito1234, 13 years ago

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

by saito1234, 13 years ago

Extracted .ass file from the encoded .mkv

by saito1234, 13 years ago

Extracted .ass file from the encoded .mkv

by saito1234, 13 years ago

Extracted .ass file from the encoded .mkv

comment:1 by saito1234, 13 years ago

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 by Carl Eugen Hoyos, 13 years ago

Component: FFmpegundetermined
Keywords: ffmpeg subtitle error removed

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

comment:3 by saito1234, 13 years ago

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.

by saito1234, 13 years ago

Attachment: output.tgz added

Console Output

comment:4 by Cigaes, 13 years ago

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 by saito1234, 13 years ago

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
probably this is the important part, but I don't understand, because sometimes it doesn't writes this error (while testing with the file), 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 ass test.mkv

Version 3, edited 13 years ago by saito1234 (previous) (next) (diff)

by saito1234, 13 years ago

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

comment:6 by Cigaes, 13 years ago

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 by saito1234, 13 years ago

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 (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)

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

comment:8 by saito1234, 13 years ago

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 years ago by saito1234 (previous) (diff)

comment:9 by Cigaes, 13 years ago

Reproduced by developer: set
Status: newopen

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 by Cigaes, 13 years ago

Analyzed by developer: set
Component: undeterminedavformat
Keywords: matroska padding added

comment:11 by saito1234, 13 years ago

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

comment:12 by Cigaes, 13 years ago

Resolution: fixed
Status: openclosed

comment:13 by Carl Eugen Hoyos, 12 years ago

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