[FFmpeg-user] Output a sequence of images with known timings

adam smith adamsmith79 at icloud.com
Wed Nov 18 19:45:53 EET 2020


I am trying to extract an image at set intervals from a video source. Later I will select one of images and will use the interval time and image number to determine the time in the video it came from.

If anybody has a better idea how to do this, feel free to stop me and push me in the right direction.

My issue is that the first image time varies depending on the output fps.
Eg fps=1/1 will output the first image from the 1st second of source; and so on.
Fps=1/5 will output the first image from the 3rd second of the source.
Fps=1/11 will output the first image from the 6th second of the source.
It keeps getting further away from the start while remaining approx halfway to the point I expected.

Any ideas how I force the first image to either be the first frame of the source, or the same value as the frequency?

Maybe I would be better off getting it to seek to each spot; but that would get pretty long pretty quick.

Full Command: ffmpeg -y -i /data/temporary/localised_20201118-961-d41yxx/2minclock.m4v  -filter_complex \"[0:0]fifo[vout];[vout]fps=fps=1/11[vout1]\" -map \"[vout1]\" -s 283x159 -frames:v 60 -pix_fmt yuvj420p -c:v mjpeg  /data/temporary/transcode_20201118-961-1qrmsyq/2minclocktest_%03d.jpeg"}

Console output:
/usr/src/app # ffmpeg -y -i /data/temporary/localised_20201118-961-d41yxx/2minclock.m4v  -filter_complex "[0:0]fifo[vout];[vout]fps=fps=1/11[vout1]" -map "[vout1]" -s 283x159 -frames:v 60 -pix_fmt yuvj420p -c:v mjpeg /data/temporary/tra
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.3.0 (Alpine 9.3.0)
  configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libass --enable-fontconfig --enable-libfreetype --enable-libvidstab --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxcb --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-postproc --enable-small --enable-version3 --enable-libbluray --enable-libzmq --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-libopenjpeg --enable-libkvazaar --enable-libaom --extra-libs=-lpthread --enable-libsrt --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/data/temporary/localised_20201118-961-d41yxx/2minclock.m4v':
    major_brand     : M4V 
    minor_version   : 1
    compatible_brands: M4V M4A isommp42
    creation_time   : 2020-11-18T12:36:47.000000Z
    encoder         : Keynote 10.3.5 (7029.5.5)
  Duration: 00:02:01.20, start: 0.000000, bitrate: 1420 kb/s
    Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 1415 kb/s, 50 fps, 50 tbr, 50 tbn, 100 tbc (default)
      creation_time   : 2020-11-18T12:36:47.000000Z
      handler_name    : Core Media Video
Stream mapping:
  Stream #0:0 (h264) -> fifo
  fps -> Stream #0:0 (mjpeg)
Press [q] to stop, [?] for help
[swscaler @ 0x55efa99b2d80] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to '/data/temporary/transcode_20201118-961-1qrmsyq/2minclocktest_%03d.jpeg':
    major_brand     : M4V 
    minor_version   : 1
    compatible_brands: M4V M4A isommp42
    encoder         : Lavf58.45.100
    Stream #0:0: Video: mjpeg, yuvj420p(pc), 283x159 [SAR 848:849 DAR 16:9], q=2-31, 200 kb/s, 0.09 fps, 0.09 tbn, 0.09 tbc (default)
      encoder         : Lavc58.91.100 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
frame=   11 fps=2.1 q=1.6 Lsize=N/A time=00:02:01.00 bitrate=N/A speed=22.9x    
video:80kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Thanks very much for any advice.

More information about the ffmpeg-user mailing list