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%
I'm not sure why the players won't work with 1 fps, but you can use -framerate
for your input, and -r
for your output to set different frame rates:
ffmpeg -framerate 1 -i %02d.png -r 25 -pix_fmt yuv420p video.mp4
Image inputs use -framerate
to set frame rate, while video output uses -r
.
-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.
-pix_fmt yuv420p
will output a widely compatible chroma subsampled output.
Just out of curiosity it might be interesting to find out the lowest output -framerate
value that works in all of your players.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments