Opened 2 months ago

#6390 new defect

ASS subtitle parser truncates lines at 4095 characters

Reported by: TellowKrinkle Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug: Any line in an ASS subtitle file that is longer than 4095 characters gets truncated to 4095 characters
How to reproduce: Run ffmpeg with an .ass file with a line > 4095 characters as an input with -c copy to an ass output. The line will have been truncated.

% ffmpeg -report -i subtitleLongerThan4095.ass -c copy subtitleTrimmedTo4095.ass
ffmpeg version 3.3 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 8.1.0 (clang-802.0.42)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libass --enable-libmp3lame --enable-libopus --enable-libssh --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-opencl --enable-lzma --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/2.1.2_1/include/openjpeg-2.1 --enable-vda
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libavresample   3.  5.  0 /  3.  5.  0
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
Splitting the commandline.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-i' ... matched as input url with argument 'subtitleLongerThan4095.ass'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option 'subtitleTrimmedTo4095.ass' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url subtitleLongerThan4095.ass.
Successfully parsed a group of options.
Opening an input file: subtitleLongerThan4095.ass.
[file @ 0x7fa300e003c0] Setting default whitelist 'file,crypto'
[ass @ 0x7fa302003c00] Format ass probed with size=2048 and score=100
[ass @ 0x7fa302003c00] Before avformat_find_stream_info() pos: 45831 bytes read:45831 seeks:0 nb_streams:1
[ass @ 0x7fa302003c00] All info found
[ass @ 0x7fa302003c00] After avformat_find_stream_info() pos: 45831 bytes read:45831 seeks:0 frames:0
Input #0, ass, from 'subtitleLongerThan4095.ass':
  Duration: N/A, bitrate: N/A
    Stream #0:0, 0, 1/100: Subtitle: ass
Successfully opened the file.
Parsing a group of options: output url subtitleTrimmedTo4095.ass.
Applying option c (codec name) with argument copy.
Successfully parsed a group of options.
Opening an output file: subtitleTrimmedTo4095.ass.
[file @ 0x7fa300f015c0] Setting default whitelist 'file,crypto'
Successfully opened the file.
Output #0, ass, to 'subtitleTrimmedTo4095.ass':
  Metadata:
    encoder         : Lavf57.71.100
    Stream #0:0, 0, 1/100: Subtitle: ass
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
No more output streams to write to, finishing.
size=       5kB time=00:15:07.05 bitrate=   0.0kbits/s speed=8.25e+06x    
video:0kB audio:0kB subtitle:43kB other streams:0kB global headers:1kB muxing overhead: unknown
Input file #0 (subtitleLongerThan4095.ass):
  Input stream #0:0 (subtitle): 1 packets read (44288 bytes); 
  Total: 1 packets (44288 bytes) demuxed
Output file #0 (subtitleTrimmedTo4095.ass):
  Output stream #0:0 (subtitle): 1 packets muxed (44288 bytes); 
  Total: 1 packets (44288 bytes) muxed
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x7fa300f016a0] Statistics: 0 seeks, 2 writeouts
[AVIOContext @ 0x7fa300e004c0] Statistics: 45831 bytes read, 0 seeks

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Attachments (2)

subtitleLongerThan4095.ass (44.8 KB) - added by TellowKrinkle 2 months ago.
An input file with a line longer than 4094 characters
subtitleTrimmedTo4095.ass (5.5 KB) - added by TellowKrinkle 2 months ago.
The undesired output file which got truncated

Download all attachments as: .zip

Change History (2)

Changed 2 months ago by TellowKrinkle

An input file with a line longer than 4094 characters

Changed 2 months ago by TellowKrinkle

The undesired output file which got truncated

Note: See TracTickets for help on using tickets.