Opened 3 years ago

Last modified 3 years ago

#5143 new defect

subtitle seek and end time doesn't handle subtitles active at boundaries

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

Description

Summary of the bug: When you ask ffmpeg to cut a subtitle file, any subtitle already active at the start time is ignored and any subtitle active at the end time is allowed to linger for longer than the requested length.

How to reproduce:

$ cat test.srt; echo; echo; ffmpeg -i test.srt -c:s srt -ss 1 -t 9  -y out.srt; echo; echo; cat out.srt 
1
00:00:00,000 --> 00:00:03,000
subtitle 1

2
00:00:03,000 --> 00:00:09,000
subtitle 2

3
00:00:09,000 --> 00:59:59,000
subtitle 3


ffmpeg version 2.8.4 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 5.3.1 (Debian 5.3.1-4) 20151219
  configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --enable-libvidstab --enable-libzvbi --enable-avresample --disable-htmlpages --disable-podpages --enable-libutvideo --enable-libfdk-aac --enable-libx265 --enable-libbs2b --enable-libilbc --enable-libopenh264 --enable-libiec61883 --enable-vaapi --enable-libkvazaar --enable-opencl --enable-libdc1394 --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, srt, from 'test.srt':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Subtitle: subrip
Output #0, srt, to 'out.srt':
  Metadata:
    encoder         : Lavf56.40.101
    Stream #0:0: Subtitle: subrip (srt)
    Metadata:
      encoder         : Lavc56.60.100 srt
Stream mapping:
  Stream #0:0 -> #0:0 (subrip (srt) -> subrip (srt))
Press [q] to stop, [?] for help
size=       0kB time=00:00:08.00 bitrate=   0.1kbits/s    
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 340.000000%


1
00:00:02,000 --> 00:00:08,000
subtitle 2

2
00:00:08,000 --> 00:59:58,000
subtitle 3

I expected instead to get:

1
00:00:01,000 --> 00:00:02,000
subtitle 1

2
00:00:02,000 --> 00:00:08,000
subtitle 2

3
00:00:08,000 --> 00:00:09,000
subtitle 3

Change History (1)

comment:1 in reply to: ↑ description Changed 3 years ago by derobert

Replying to derobert:

I expected instead to get:

1
00:00:01,000 --> 00:00:02,000

... sorry, that should be "00:00:00,000 --> 00:00:02,000" there, of course.

Note: See TracTickets for help on using tickets.