Opened 3 years ago

Last modified 3 years ago

#9646 new defect

ffconcat issue slicing subtitle file

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

Description (last modified by phyzical)

Summary of the bug:
(this issue may contain a better summary than i can write up)
(https://github.com/yt-dlp/yt-dlp/issues/2753)

% ffmpeg -v 9 -loglevel 99 -f concat -safe 0 -i "20220109.Cody's Algae Panel.en.temp.srt.concat" -c copy temp.srt
ffmpeg version 5.0 Copyright (c) 2000-2022 the FFmpeg developers
  built with Apple clang version 13.0.0 (clang-1300.0.29.30)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.0 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon
  libavutil      57. 17.100 / 57. 17.100
  libavcodec     59. 18.100 / 59. 18.100
  libavformat    59. 16.100 / 59. 16.100
  libavdevice    59.  4.100 / 59.  4.100
  libavfilter     8. 24.100 /  8. 24.100
  libswscale      6.  4.100 /  6.  4.100
  libswresample   4.  3.100 /  4.  3.100
  libpostproc    56.  3.100 / 56.  3.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'concat'.
Reading option '-safe' ... matched as AVOption 'safe' with argument '0'.
Reading option '-i' ... matched as input url with argument '20220109.Cody's Algae Panel.en.temp.srt.concat'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option 'temp.srt' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input url 20220109.Cody's Algae Panel.en.temp.srt.concat.
Applying option f (force format) with argument concat.
Successfully parsed a group of options.
Opening an input file: 20220109.Cody's Algae Panel.en.temp.srt.concat.
[concat @ 0x1490045f0] Opening '20220109.Cody's Algae Panel.en.temp.srt.concat' for reading
[file @ 0x141804080] Setting default whitelist 'file,crypto,data'
[NULL @ 0x141804450] Opening 'file:20220109.Cody's Algae Panel.en.srt' for reading
Probing srt score:100 size:2048
[srt @ 0x141804450] Format srt probed with size=2048 and score=100
[srt @ 0x141804450] Before avformat_find_stream_info() pos: 77321 bytes read:77321 seeks:0 nb_streams:1
[srt @ 0x141804450] All info found
[srt @ 0x141804450] stream 0: start_time: NOPTS duration: NOPTS
[srt @ 0x141804450] format: start_time: NOPTS duration: NOPTS (estimate from bit rate) bitrate=0 kb/s
[srt @ 0x141804450] After avformat_find_stream_info() pos: 77321 bytes read:77321 seeks:0 frames:0
[AVIOContext @ 0x1419041c0] Statistics: 77321 bytes read, 0 seeks
[AVIOContext @ 0x1418041c0] Statistics: 90 bytes read, 0 seeks
20220109.Cody's Algae Panel.en.temp.srt.concat: Result too large

"I am trying to concat subititles to remove sections to line up with media that has also been sliced"

i did my best to summarise but the linked issue may do a better job of explaining the issue.

"It cuts everything before ~14 seconds, but there is nothing in SRT before 16 seconds, so FFmpeg throws an error. If I manually change 14 -> 17 in concat spec, FFmpeg succeeds.

Expected behaviour in this case is to simply subtract 14.251 from all timestamps in SRT file."

Note: all types of subtitle files have the same issue

if we run the -ss command we see a warning about the same issue

ffmpeg -v 9 -loglevel 99 -ss 14.251 -i "20220109.Cody's Algae Panel.en.srt" -c copy temp.srt
ffmpeg version 5.0 Copyright (c) 2000-2022 the FFmpeg developers
  built with Apple clang version 13.0.0 (clang-1300.0.29.30)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.0 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon
  libavutil      57. 17.100 / 57. 17.100
  libavcodec     59. 18.100 / 59. 18.100
  libavformat    59. 16.100 / 59. 16.100
  libavdevice    59.  4.100 / 59.  4.100
  libavfilter     8. 24.100 /  8. 24.100
  libswscale      6.  4.100 /  6.  4.100
  libswresample   4.  3.100 /  4.  3.100
  libpostproc    56.  3.100 / 56.  3.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-ss' ... matched as option 'ss' (set the start time offset) with argument '14.251'.
Reading option '-i' ... matched as input url with argument '20220109.Cody's Algae Panel.en.srt'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option 'temp.srt' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input url 20220109.Cody's Algae Panel.en.srt.
Applying option ss (set the start time offset) with argument 14.251.
Successfully parsed a group of options.
Opening an input file: 20220109.Cody's Algae Panel.en.srt.
[NULL @ 0x133004680] Opening '20220109.Cody's Algae Panel.en.srt' for reading
[file @ 0x133404080] Setting default whitelist 'file,crypto,data'
Probing srt score:100 size:2048
[srt @ 0x133004680] Format srt probed with size=2048 and score=100
[srt @ 0x133004680] Before avformat_find_stream_info() pos: 77321 bytes read:77321 seeks:0 nb_streams:1
[srt @ 0x133004680] All info found
[srt @ 0x133004680] stream 0: start_time: NOPTS duration: NOPTS
[srt @ 0x133004680] format: start_time: NOPTS duration: NOPTS (estimate from bit rate) bitrate=0 kb/s
[srt @ 0x133004680] After avformat_find_stream_info() pos: 77321 bytes read:77321 seeks:0 frames:0
20220109.Cody's Algae Panel.en.srt: could not seek to position 14.251
Input #0, srt, from '20220109.Cody's Algae Panel.en.srt':
  Duration: N/A, bitrate: N/A
  Stream #0:0, 0, 1/1000: Subtitle: subrip
Successfully opened the file.
Parsing a group of options: output url temp.srt.
Applying option c (codec name) with argument copy.
Successfully parsed a group of options.
Opening an output file: temp.srt.
[file @ 0x133504090] Setting default whitelist 'file,crypto,data'
Successfully opened the file.
Output #0, srt, to 'temp.srt':
  Metadata:
    encoder         : Lavf59.16.100
  Stream #0:0, 0, 1/1000: Subtitle: subrip
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
No more output streams to write to, finishing.2kbits/s speed=N/A    
size=      74kB time=00:20:46.86 bitrate=   0.5kbits/s speed=9.56e+05x    
video:0kB audio:0kB subtitle:40kB other streams:0kB global headers:0kB muxing overhead: 86.441551%
Input file #0 (20220109.Cody's Algae Panel.en.srt):
  Input stream #0:0 (subtitle): 985 packets read (40897 bytes); 
  Total: 985 packets (40897 bytes) demuxed
Output file #0 (temp.srt):
  Output stream #0:0 (subtitle): 985 packets muxed (40897 bytes); 
  Total: 985 packets (40897 bytes) muxed
[AVIOContext @ 0x133504130] Statistics: 76249 bytes written, 0 seeks, 1 writeouts
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x133004480] Statistics: 77321 bytes read, 0 seeks

(files attached)

Attachments (2)

20220109.Cody's Algae Panel.en.temp.srt.concat (88 bytes ) - added by phyzical 3 years ago.
20220109.Cody's Algae Panel.en.srt (75.5 KB ) - added by phyzical 3 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 by phyzical, 3 years ago

Description: modified (diff)

comment:2 by phyzical, 3 years ago

Description: modified (diff)

comment:3 by phyzical, 3 years ago

Description: modified (diff)

comment:4 by phyzical, 3 years ago

Description: modified (diff)

comment:5 by phyzical, 3 years ago

Description: modified (diff)

comment:6 by phyzical, 3 years ago

Description: modified (diff)

by phyzical, 3 years ago

comment:7 by phyzical, 3 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.