[FFmpeg-user] seeking not working as expected

Mike Brown mike at skew.org
Mon Aug 31 00:44:15 EEST 2020


On Sun, Aug 30, 2020 at 09:36:42PM +0200, Carl Eugen Hoyos wrote:
> Am So., 30. Aug. 2020 um 21:32 Uhr schrieb Mike Brown <mike at skew.org>:
> >
> > I'm using a Zeranoe 64-bit Windows build, ffmpeg version git-2020-06-28-4cfcfb3 on Win7.
> >
> > I am trying to split DV-AVI files, using https://trac.ffmpeg.org/wiki/Seeking as my guide.
> > For example, I want to extract a segment from 4h54m24s to 4h57m08s into its own file.
> >
> > The following syntax works great, but is, as promised by the wiki, painfully slow:
> >
> >     ffmpeg -i splitme.avi -ss 4:54:24 -t 2:44 -c copy -y out.avi
> >
> > The wiki suggests that the following should work too, but much faster:
> >
> >     ffmpeg -ss 4:54:24 -i splitme.avi -t 2:44 -c copy -y out.avi
> >
> > It definitely starts fast, but unexpectedly, it produces a segment from
> > 0:08:21 to, well, I don't know because my disk filled up, so it was many hours
> > long!
> >
> > Am I doing something wrong?
> 
> Complete, uncut console output missing.
> (Feel free to press q before your disk is full.)

OK, I pressed q after 11900 frames (requested duration 2:44 should only yield 
~4915 frames). I've also tried this same command line with more verbose time 
specs (04:54:24.0 and 00:02:44.0), but it made no difference.

I:\video workspace\captures>ffmpeg -loglevel debug -ss 4:54:24 -i splitme.avi -t 2:44 -c copy -y 34.avi
ffmpeg version git-2020-06-28-4cfcfb3 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.3.1 (GCC) 20200621
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-
amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml
2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libgsm --disable-w32threads --enable
-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 55.100 / 56. 55.100
  libavcodec     58. 93.100 / 58. 93.100
  libavformat    58. 47.100 / 58. 47.100
  libavdevice    58. 11.100 / 58. 11.100
  libavfilter     7. 86.100 /  7. 86.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-ss' ... matched as option 'ss' (set the start time offset) with argument '4:54:24'.
Reading option '-i' ... matched as input url with argument 'splitme.avi'.
Reading option '-t' ... matched as option 't' (record or transcode "duration" seconds of audio/video) with argument '2:44'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '34.avi' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url splitme.avi.
Applying option ss (set the start time offset) with argument 4:54:24.
Successfully parsed a group of options.
Opening an input file: splitme.avi.
[NULL @ 0000000000448580] Opening 'splitme.avi' for reading
[file @ 0000000000449e80] Setting default whitelist 'file,crypto,data'
[avi @ 0000000000448580] Format avi probed with size=2048 and score=100
[avi @ 000000000044a080] use odml:1
[avi @ 0000000000448580] ODML index invalid
st:1 removing common factor 4 from timebase
[avi @ 0000000000448580] ODML index invalid
[avi @ 0000000000448580] Before avformat_find_stream_info() pos: 34816 bytes read:688128 seeks:6 nb_streams:2
[avi @ 0000000000448580] parser not found for codec dvvideo, packets or times may be invalid.
[avi @ 0000000000448580] parser not found for codec pcm_s16le, packets or times may be invalid.
[avi @ 0000000000448580] parser not found for codec dvvideo, packets or times may be invalid.
[avi @ 0000000000448580] parser not found for codec pcm_s16le, packets or times may be invalid.
[avi @ 0000000000448580] All info found
[avi @ 0000000000448580] After avformat_find_stream_info() pos: 158928 bytes read:840904 seeks:6 frames:2
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, avi, from 'splitme.avi':
  Duration: 06:33:11.37, start: 0.000000, bitrate: 30315 kb/s
    Stream #0:0, 1, 1001/30000: Video: dvvideo, 1 reference frame (dvsd / 0x64737664), yuv411p(topleft), 720x480 [SAR 8:9 DAR 4:3], 0/1, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc
    Stream #0:1, 1, 1/48000: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
Successfully opened the file.
Parsing a group of options: output url 34.avi.
Applying option t (record or transcode "duration" seconds of audio/video) with argument 2:44.
Applying option c (codec name) with argument copy.
Successfully parsed a group of options.
Opening an output file: 34.avi.
[file @ 0000000000451740] Setting default whitelist 'file,crypto,data'
Successfully opened the file.
[avi @ 00000000004b6800] reserve_index_space:0 master_index_max_size:256
[avi @ 00000000004b6800] duration_est:164.000, filesize_est:0.0GiB, master_index_max_size:256
Output #0, avi, to '34.avi':
  Metadata:
    ISFT            : Lavf58.47.100
    Stream #0:0, 0, 1001/30000: Video: dvvideo, 1 reference frame (dvsd / 0x64737664), yuv411p(topleft), 720x480 (0x0) [SAR 8:9 DAR 4:3], 0/1, q=2-31, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc
    Stream #0:1, 0, 1/48000: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (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)
cur_dts is invalid st:1 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
frame=11962 fps=262 q=-1.0 Lsize= 1477592kB time=-04:39:24.41 bitrate=N/A speed=N/A
video:1401797kB audio:74827kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.065605%
Input file #0 (splitme.avi):
  Input stream #0:0 (video): 11962 packets read (1435440000 bytes);
  Input stream #0:1 (audio): 23922 packets read (76622432 bytes);
  Total: 35884 packets (1512062432 bytes) demuxed
Output file #0 (34.avi):
  Output stream #0:0 (video): 11962 packets muxed (1435440000 bytes);
  Output stream #0:1 (audio): 23922 packets muxed (76622432 bytes);
  Total: 35884 packets (1512062432 bytes) muxed
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0000000000451880] Statistics: 38 seeks, 5801 writeouts
[AVIOContext @ 0000000000452100] Statistics: 1513187688 bytes read, 10 seeks


More information about the ffmpeg-user mailing list