Opened 5 years ago

Closed 5 years ago

#7721 closed defect (fixed)

Unable to seek ≥ 100 hours

Reported by: Gamnn Owned by:
Priority: normal Component: avutil
Version: git-master Keywords: seek
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by Carl Eugen Hoyos)

When attempting to cut a segment of a long (577+ hour) .oga encapsulated FLAC, I found that you cannot enter greater than 99 hours with -ss.

ffmpeg -v 9 -loglevel 99 -ss 100:00:00.00 -i input.raw.oga -f s16le -c:a pcm_s16le -t 01:00:00.00 out.raw
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1_6 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home/include/darwin' --host-ldflags= --enable-ffplay --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-videotoolbox --disable-libjack --disable-indev=jack --enable-libaom --enable-libsoxr
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  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 '100:00:00.00'.
Reading option '-i' ... matched as input url with argument 'input.raw.oga'.
Reading option '-f' ... matched as option 'f' (force format) with argument 's16le'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'pcm_s16le'.
Reading option '-t' ... matched as option 't' (record or transcode "duration" seconds of audio/video) with argument '01:00:00.00'.
Reading option 'out.raw' ... 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 input.raw.oga.
Applying option ss (set the start time offset) with argument 100:00:00.00.
Invalid duration specification for ss: 100:00:00.00

99 hours or less functions as intended:

ffmpeg -ss 99:00:00.00 -i input.raw.oga -f s16le -c:a pcm_s16le -t 01:00:00.00 out.raw
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1_6 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home/include/darwin' --host-ldflags= --enable-ffplay --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-videotoolbox --disable-libjack --disable-indev=jack --enable-libaom --enable-libsoxr
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Input #0, ogg, from 'input.raw.oga':
  Duration: 577:24:57.06, start: 0.000000, bitrate: 220 kb/s
    Stream #0:0: Audio: flac, 40000 Hz, mono, s16
Stream mapping:
  Stream #0:0 -> #0:0 (flac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, s16le, to 'out.raw':
  Metadata:
    encoder         : Lavf58.20.100
    Stream #0:0: Audio: pcm_s16le, 40000 Hz, mono, s16, 640 kb/s
    Metadata:
      encoder         : Lavc58.35.100 pcm_s16le
size=  281250kB time=01:00:00.00 bitrate= 640.0kbits/s speed= 462x    
video:0kB audio:281250kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%

-t likewise suffers from this limitation.

-t 200:00:00.00 out.raw returns:
Invalid duration specification for t: 200:00:00.00

Change History (6)

comment:1 by Carl Eugen Hoyos, 5 years ago

Version: 4.1unspecified

Please test current FFmpeg git head, nothing else is supported here.

comment:2 by Gamnn, 5 years ago

Okay, built it from git. Same as above with N-93094-g7f8bfbee36.

comment:3 by Gyan, 5 years ago

For duration values, hour field is limited to 2 digits.

comment:4 by Carl Eugen Hoyos, 5 years ago

Component: undeterminedavutil
Description: modified (diff)
Keywords: seek added
Version: unspecifiedgit-master

Please test this patch:

diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c
index 59bec6c..167e822 100644
--- a/libavutil/parseutils.c
+++ b/libavutil/parseutils.c
@@ -504,7 +504,7 @@ char *av_small_strptime(const char *p, const char *fmt, struct tm *dt)
         switch(c) {
         case 'H':
         case 'J':
-            val = date_get_num(&p, 0, c == 'H' ? 23 : INT_MAX, 2);
+            val = date_get_num(&p, 0, c == 'H' ? 23 : INT_MAX, c == 'H' ? 2 : 4);

             if (val == -1)
                 return NULL;

comment:5 by Gamnn, 5 years ago

Applied the patch and it's working with this file now, both for -ss and -t. Thank you.
Tested working up to 9999 hours, which is more than enough for my use case.

comment:6 by Carl Eugen Hoyos, 5 years ago

Resolution: fixed
Status: newclosed

Pushed as 0cac68bcf94ed0914ba97a15d7ccd38e5a2a566d, thank you for the report and the testing!

Note: See TracTickets for help on using tickets.