Can ffmpeg read gif image(s)?

4

I have a lot of similar gif images and I want to make a movie in that way:

ffmpeg -i img%06d.gif -c:v libx264 mymovie.mp4

If all images are JPEG everything works fine. But GIFs are stuck with message:

img%06d.gif: No such file or directory
Conversion failed!

Is it possible to process gifs with ffmpeg?

There is about 30 GB of gifs so conversion to jpeg isn't an option.


Yep. Another case is solved.

ffmpeg treat GIFs as movies, not a single images. Always. Therefore we have to concat videostreams instead of batching the frames. Here is the solution:

ffmpeg -f concat -i filelist.txt -c:v libx264 mymovie.mp4

filelist.txt accordingly to the ffmpeg manual should be the next format:

# some comment
file '/path/img000001.gif'
file '/path/img000002.gif'
file '/path/img000003.gif'
. . . . .

Kondybas

Posted 2014-07-21T15:54:41.263

Reputation: 499

Could that be a bug? If you run ffmpeg -f image2 -i img%06d.gif -c:v libx264 mymovie.mp4, does that work? – slhck – 2014-07-22T20:17:36.883

2[image2 @ 0x80647a420] Could not find codec parameters for stream 0 (Video: none): unspecified size Consider increasing the value for the 'analyzeduration' and 'probesize' options %06d.gif: could not find codec parameters – Kondybas – 2014-07-22T21:16:02.677

Answers

2

ffmpeg treat GIFs as movies, not a single images. Always. Therefore we have to concat videostreams instead of batching the frames. Here is the solution:

ffmpeg -f concat -i filelist.txt -c:v libx264 mymovie.mp4

filelist.txt accordingly to the ffmpeg manual should be the next format:

# some comment
file '/path/img000001.gif'
file '/path/img000002.gif'
file '/path/img000003.gif'
. . . . .

Kondybas

Posted 2014-07-21T15:54:41.263

Reputation: 499

If you have lots of files, with Bash or Zsh you could do: ffmpeg -f concat -i <(for f in /path/*.gif; do echo "file '$f'"; done) -c:v libx264 output.mp4 – slhck – 2014-07-24T04:51:09.247