Opened 6 weeks ago

Last modified 6 weeks ago

#10949 new defect

Cutting videos with ass streams (duration and timestamps)

Reported by: x-yuri Owned by:
Priority: normal Component: undetermined
Version: 6.1.1 Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by x-yuri)

// the video is 20 seconds long
$ ffprobe -i cut-ass-duration-timestamps.mkv |& grep -E 'Duration:| DURATION |Stream' | grep -v STATISTICS
  Duration: 00:00:20.01, start: 0.000000, bitrate: 207 kb/s
  Stream #0:0(spa): Audio: vorbis, 48000 Hz, 5.1, fltp
      DURATION        : 00:00:20.012000000
  Stream #0:1(eng): Subtitle: ass
      DURATION        : 00:00:18.523000000

$ ffmpeg -i cut-ass-duration-timestamps.mkv cut-ass-duration-timestamps.ass

// cut -ss 10 -to 20
$ ffmpeg -i cut-ass-duration-timestamps.mkv -ss 10 b.mkv

// the overall and ass stream duration is 20 seconds
$ ffprobe -i b.mkv |& grep -E 'Duration:| DURATION |Stream' | grep -v STATISTICS
  Duration: 00:00:18.53, start: 0.000000, bitrate: 135 kb/s
  Stream #0:0(spa): Audio: vorbis, 48000 Hz, 5.1, fltp
      DURATION        : 00:00:10.016000000
  Stream #0:1(eng): Subtitle: ass
      DURATION        : 00:00:18.526000000

$ ffmpeg -i b.mkv b.ass

// it removed the dialogues, but didn't change the timestamps
// actually the timestamps changed a bit, but not enough and in the wrong direction
$ diff -u cut-ass-duration-timestamps.ass b.ass
--- cut-ass-duration-timestamps.ass	2024-04-06 03:43:44.611727478 +0300
+++ b.ass	2024-04-06 03:44:24.698540468 +0300
@@ -12,9 +12,7 @@
 
 [Events]
 Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
-Dialogue: 0,0:00:06.04,0:00:08.36,Default,,0,0,0,,{\c&HFFFFFF&}Where's the surgical instrument kit?{\c}
-Dialogue: 0,0:00:08.44,0:00:10.64,Default,,0,0,0,,{\c&HFFFFFF&}-There's a scalpel in it.{\c}\N{\c&HFFFFFF&}-Berlin has it.{\c}
-Dialogue: 0,0:00:11.40,0:00:14.40,Default,,0,0,0,,{\c&HFFFFFF&}The surgeons!{\c}\N{\c&HFFFFFF&}Go steal tools from them. Hurry!{\c}
-Dialogue: 0,0:00:14.48,0:00:15.36,Default,,0,0,0,,{\c&HFFFFFF&}Okay.{\c}
-Dialogue: 0,0:00:15.44,0:00:16.52,Default,,0,0,0,,{\c&HFFFFFF&}Wait!{\c}
-Dialogue: 0,0:00:17.12,0:00:18.52,Default,,0,0,0,,{\c&HFFFFFF&}Give him this note, please.{\c}
+Dialogue: 0,0:00:11.41,0:00:14.41,Default,,0,0,0,,{\c&HFFFFFF&}The surgeons!{\c}\N{\c&HFFFFFF&}Go steal tools from them. Hurry!{\c}
+Dialogue: 0,0:00:14.49,0:00:15.37,Default,,0,0,0,,{\c&HFFFFFF&}Okay.{\c}
+Dialogue: 0,0:00:15.45,0:00:16.53,Default,,0,0,0,,{\c&HFFFFFF&}Wait!{\c}
+Dialogue: 0,0:00:17.13,0:00:18.53,Default,,0,0,0,,{\c&HFFFFFF&}Give him this note, please.{\c}

$ ffmpeg -version
ffmpeg version n6.1.1 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 13.2.1 (GCC) 20230801
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-frei0r --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libharfbuzz --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librav1e --enable-librsvg --enable-librubberband --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-vapoursynth --enable-version3 --enable-vulkan
libavutil      58. 29.100 / 58. 29.100
libavcodec     60. 31.102 / 60. 31.102
libavformat    60. 16.100 / 60. 16.100
libavdevice    60.  3.100 / 60.  3.100
libavfilter     9. 12.100 /  9. 12.100
libswscale      7.  5.100 /  7.  5.100
libswresample   4. 12.100 /  4. 12.100
libpostproc    57.  3.100 / 57.  3.100

Attachments (1)

cut-ass-duration-timestamps.mkv (506.0 KB ) - added by x-yuri 6 weeks ago.

Download all attachments as: .zip

Change History (2)

by x-yuri, 6 weeks ago

comment:1 by x-yuri, 6 weeks ago

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