35
5
I have some images and I'd like to make an animated gif with ffmpeg. The images have names as:
837_1.png
838_1.png
...
I'm trying to unserstand the -i command line option of ffmpeg but I am crashing against some problems.
If I don't specify anything it ask me to replace the files:
ffmpeg -i * -vcodec libx264 out.mp4
ffmpeg version 1.2.1 Copyright (c) 2000-2013 the FFmpeg developers
built on Jul 26 2013 20:18:03 with Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/1.2.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=cc --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
libavutil 52. 18.100 / 52. 18.100
libavcodec 54. 92.100 / 54. 92.100
libavformat 54. 63.104 / 54. 63.104
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 42.103 / 3. 42.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
Input #0, image2, from '358_1.png':
Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, rgb24, 550x550, 25 tbr, 25 tbn, 25 tbc
File '359_1.png' already exists. Overwrite ? [y/N]
And if I try to use one of the most used format (%d) in the internet.. ffmpeg does not find the files:
fmpeg -i '%3d_1.png' -vcodec libx264 out.mp4
ffmpeg version 1.2.1 Copyright (c) 2000-2013 the FFmpeg developers
built on Jul 26 2013 20:18:03 with Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/1.2.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=cc --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
libavutil 52. 18.100 / 52. 18.100
libavcodec 54. 92.100 / 54. 92.100
libavformat 54. 63.104 / 54. 63.104
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 42.103 / 3. 42.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
[image2 @ 0x7f963a006600] Could find no file with with path '%3d_1.png' and index in the range 0-4
%3d_1.png: No such file or directory
So.. here is the question, how to use the -i command line option with ffmpg?
For sake of clarity, I am on Mac OSX 10.8, ffmpeg version 1.2.1, zsh 4.3.11
In fact, it not only checks +0..4 but also 8,16,32,64 etc. This is noticeable when using HTTP url's. However,
image2
fails to recognize that200 OK
is the equivalent of "file found" so it doesn't stop searching. – MSalters – 2017-07-18T15:38:18.7071I'm getting the same thing even after trying to implement your suggestions. My files are named
DSCxxxxx.jpg
wherexxxxx
is a 5-digit number starting with zero (note I have no underscores). Still, after runningffmpeg -r 30 -start_number 04606 -i DSC%d.jpg out.mp4
I get the same error as in the original post above – Anonymous – 2017-11-26T23:31:24.870@jphollowed Did you put the file name pattern in quotes? – slhck – 2017-11-27T10:17:00.387
What got me was that the
-start_number
parameter has to be before the-i
parameter. Also use-vframes
for a stop number. – MDMoore313 – 2018-02-10T17:37:53.690You rock. This also worked for me on Windows 10. The color output detail was what I needed. – motorbaby – 2018-10-02T18:30:56.007
very complete answer! and do you also have some advice on animated gif? – nkint – 2013-10-29T21:16:54.637
For animated GIFs, you want to update to ffmpeg version 2.0 and above, because they greatly improved the visual quality. The download page has some links to static builds for OS X. For older ffmpeg, see: ffmpeg converts .flv video to .gif with awful quality
– slhck – 2013-10-29T21:29:58.973