Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm struggling to achieve stable ffmpeg outputs that work across players and platforms for a video produced from a series of images that need to roll at about 1 fps.

ffmpeg -f image2 -r 1 -i %02d.png video.avi takes files named '01.png, 02.png' etc and outputs at 1 fps. But the result won't play on VLC or Quicktime - only WMP seems to handle it.

ffmpeg -f image2 -r 25 -i %02d.png video.mp4 does produce more stable output, but only at speeds around 25 fps - much too fast for my data viz.

Very grateful for assistance. It seems pointless to create duplicate images to resolve this.


The console output:

ffmpeg version N-53284-gd0a34ae Copyright (c) 2000-2013 the FFmpeg developers
  built on May 20 2013 01:07:40 with gcc 4.7.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzli
b --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libblu
ray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libr
tmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwola
me --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264
 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 33.100 / 52. 33.100
  libavcodec     55. 10.101 / 55. 10.101
  libavformat    55.  7.100 / 55.  7.100
  libavdevice    55.  1.100 / 55.  1.100
  libavfilter     3. 68.101 /  3. 68.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[image2 @ 00000000025977e0] max_analyze_duration 5000000 reached at 5000000 microseconds
Input #0, image2, from '%02d.png':
  Duration: 00:00:40.00, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: png, pal8, 1300x1100, 1 fps, 1 tbr, 1 tbn, 1 tbc
Output #0, avi, to 'video.avi':
  Metadata:
    ISFT            : Lavf55.7.100
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1300x1100, q=2-31, 200 kb/s, 1 tbn, 1 tb
c
Stream mapping:
  Stream #0:0 -> #0:0 (png -> mpeg4)
Press [q] to stop, [?] for help
frame=   40 fps=6.6 q=31.0 Lsize=    3754kB time=00:00:40.00 bitrate= 768.9kbits/s
video:3748kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.173624%
share|improve this question
    
Please include the complete ffmpeg console output from your first ffmpeg command. –  LordNeckbeard May 30 '13 at 17:24
    
Thanks @LordNeckbeard that works for me :) Give it as an answer and I'll tick it. –  geotheory May 30 '13 at 22:14
add comment

1 Answer 1

up vote 5 down vote accepted

I'm not sure why the players won't work with 1 fps, but you can use a separate -r for both your input and output:

ffmpeg -r 1 -i %02d.png -r 25 video.mp4

Notes:

  • -f image2 is usually not required since the demuxer will recognize your inputs as images.

  • In this example ffmpeg will duplicate frames to reach the higher output frame rate, but it will still show the same "image" for each second.

  • Some encoders and containers may be limited in the frame rates that they support, but they will often let you know in the ffmpeg console output.

  • By default ffmpeg will use libx264 (H.264 video) as the encoder for MP4 container output. If it is unavailable then mpeg4 (MPEG-4 Part 2 video) will be used.

Just out of curiosity it might be interesting to find out the lowest output -r value that works in all of your players.

Also see:
How do I encode single pictures into movies?
FFmpeg and x264 encoding Guide

share|improve this answer
    
From superuser.com/questions/632455/…, where I was struggling with a similar issue and ended up using your work-around (though it's a shame multiple copies of the same frame are required!): A -r value of 3 (but not 1, which is the next lower value I tried) solves an issue where Windows Media Player will spend too much time on the first frame of the low-FPS video and not enough time on the rest. A -r value of 10 (but not 5, the next lower value tested) solves an issue where VLC refuses to play the low-FPS video at all! –  A.M. Aug 15 '13 at 22:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.