FFMPEG create image sequence of equal length to original video

1

I am trying to convert a video to an image sequence for importing into my video editor. First I check the frame rate with:

ffprobe -v 0 -of compact=p=0 -select_streams 0 -show_entries stream=r_frame_rate Forest.mp4

which returns

r_frame_rate=30/1

The original video is 1 minute 12 seconds...

when I run

ffmpeg -i Forest.mp4 -r 30 forest/image-%03d.dpx 

it gives back this:

ffmpeg version 2.7.2 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.8.3 (GCC) 20140911 (Red Hat 4.8.3-9)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --enable-runtime-cpudetect --enable-gpl --enable-version3 --enable-postproc --enable-avfilter --enable-pthreads --enable-x11grab --enable-vdpau --disable-avisynth --enable-frei0r --enable-libopencv --enable-libdc1394 --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-gnutls --enable-libass --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --disable-stripping
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 41.100 / 56. 41.100
  libavformat    56. 36.100 / 56. 36.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 16.101 /  5. 16.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Forest.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.36.100
  Duration: 00:01:00.12, start: 0.000000, bitrate: 1277 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1144 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Output #0, image2, to 'forest/image-%03d.dpx':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.36.100
    Stream #0:0(und): Video: dpx, rgb24, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc56.41.100 dpx
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> dpx (native))

and creates only about one second of video.

I'd like it to match the source, so that when I pull the audio and import it into my editing software I'm trying to learn they will match up.

Jeremy

Posted 2017-02-17T19:41:00.993

Reputation: 13

Just realized you crossposted this to Stack Overflow and it got answered there as well. Crossposting is discouraged: it wastes time, so two of us spent time providing similar answers to the same question. Also, it was offtopic at SO because that's for programming questions only.

– llogan – 2017-02-18T19:09:51.153

Answers

1

Because you're outputting individual images there is no need to use -r. Individual frames have no duration, so duration is meaningless.

All you have to run is:

ffmpeg -i Forest.mp4 forest/image-%03d.dpx 

llogan

Posted 2017-02-17T19:41:00.993

Reputation: 31 929