[FFmpeg-trac] #9646(undetermined:new): ffconcat issue slicing subtitle file
FFmpeg
trac at avcodec.org
Wed Feb 16 10:57:46 EET 2022
#9646: ffconcat issue slicing subtitle file
-------------------------------------+-------------------------------------
Reporter: phyzical | Owner: (none)
Type: defect | Status: new
Priority: normal | Component:
| undetermined
Version: unspecified | Resolution:
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Description changed by phyzical:
Old description:
> 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)
>
> {{{
> ffconcat version 1.0
> file 'file:processing/20220109.Cody'\''s Algae Panel.en.srt'
> inpoint 14.251000
> 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
>
> }}}
>
> "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."
>
> 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
> }}}
>
> then we can manually do it by running
>
> {{{
> ffmpeg -i "20220109.Cody's Algae Panel.mp4" -i temp.srt -c copy
> "20220109.Cody's Algae Panel.temp.mp4"
> 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
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '20220109.Cody's Algae
> Panel.mp4':
> Metadata:
> major_brand : isom
> minor_version : 512
> compatible_brands: isomiso2avc1mp41
> encoder : Lavf58.76.100
> Duration: 00:21:01.40, start: 0.000000, bitrate: 3881 kb/s
> Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661),
> yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 3745 kb/s,
> 30 fps, 30 tbr, 15360 tbn (default)
> Metadata:
> handler_name : ISO Media file produced by Google Inc.
> vendor_id : [0][0][0][0]
> Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
> stereo, fltp, 127 kb/s (default)
> Metadata:
> handler_name : ISO Media file produced by Google Inc.
> vendor_id : [0][0][0][0]
> Input #1, srt, from 'temp.srt':
> Duration: N/A, bitrate: N/A
> Stream #1:0: Subtitle: subrip
> File '20220109.Cody's Algae Panel.temp.mp4' already exists. Overwrite?
> [y/N] y
> Output #0, mp4, to '20220109.Cody's Algae Panel.temp.mp4':
> Metadata:
> major_brand : isom
> minor_version : 512
> compatible_brands: isomiso2avc1mp41
> encoder : Lavf59.16.100
> Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv,
> bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 3745 kb/s, 30
> fps, 30 tbr, 15360 tbn (default)
> Metadata:
> handler_name : ISO Media file produced by Google Inc.
> vendor_id : [0][0][0][0]
> Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
> stereo, fltp, 127 kb/s (default)
> Metadata:
> handler_name : ISO Media file produced by Google Inc.
> vendor_id : [0][0][0][0]
> Stream mapping:
> Stream #0:0 -> #0:0 (copy)
> Stream #0:1 -> #0:1 (copy)
> Press [q] to stop, [?] for help
> frame= 1 fps=0.0 q=-1.0 size= 0kB time=00:00:00.00
> bitrateframe=29625 fps=0.0 q=-1.0 size= 473600kB time=00:16:27.45
> bitrateframe=37840 fps=0.0 q=-1.0 Lsize= 597734kB time=00:21:01.40
> bitrate=3881.9kbits/s speed=2.06e+03x
> video:576733kB audio:19709kB subtitle:0kB other streams:0kB global
> headers:0kB muxing overhead: 0.216554%
> }}}
>
> https://github.com/yt-dlp/yt-dlp/issues/2753
New description:
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)
"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."
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
}}}
then we can manually do it by running
{{{
ffmpeg -i "20220109.Cody's Algae Panel.mp4" -i temp.srt -c copy
"20220109.Cody's Algae Panel.temp.mp4"
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
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '20220109.Cody's Algae Panel.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.76.100
Duration: 00:21:01.40, start: 0.000000, bitrate: 3881 kb/s
Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661),
yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 3745 kb/s,
30 fps, 30 tbr, 15360 tbn (default)
Metadata:
handler_name : ISO Media file produced by Google Inc.
vendor_id : [0][0][0][0]
Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 127 kb/s (default)
Metadata:
handler_name : ISO Media file produced by Google Inc.
vendor_id : [0][0][0][0]
Input #1, srt, from 'temp.srt':
Duration: N/A, bitrate: N/A
Stream #1:0: Subtitle: subrip
File '20220109.Cody's Algae Panel.temp.mp4' already exists. Overwrite?
[y/N] y
Output #0, mp4, to '20220109.Cody's Algae Panel.temp.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf59.16.100
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv,
bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 3745 kb/s, 30
fps, 30 tbr, 15360 tbn (default)
Metadata:
handler_name : ISO Media file produced by Google Inc.
vendor_id : [0][0][0][0]
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo,
fltp, 127 kb/s (default)
Metadata:
handler_name : ISO Media file produced by Google Inc.
vendor_id : [0][0][0][0]
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 1 fps=0.0 q=-1.0 size= 0kB time=00:00:00.00
bitrateframe=29625 fps=0.0 q=-1.0 size= 473600kB time=00:16:27.45
bitrateframe=37840 fps=0.0 q=-1.0 Lsize= 597734kB time=00:21:01.40
bitrate=3881.9kbits/s speed=2.06e+03x
video:576733kB audio:19709kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.216554%
}}}
https://github.com/yt-dlp/yt-dlp/issues/2753
--
--
Ticket URL: <https://trac.ffmpeg.org/ticket/9646#comment:2>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list