4

i have 1 million gifs in a folder that i would like to convert into a 60 frames per second video file using ffmpeg. Here is my code:

ffmpeg -r 60 -pattern_type glob -i *.gif -c:v libx264 out.mp4

my gifs don't follow a %07d.gif pattern like 0000001.gif 0000002.gif but they are indeed in sequential order. like this: img1.gif, img2.gif ... img10.gif ... img10000.gif ... img1000000.gif.

When i try to execute my code i get this:

-bash: /usr/local/bin/ffmpeg: Argument list too long

please help. thank you.

Ridalgo
  • 651
  • 1
  • 6
  • 10

2 Answers2

3

You need to avoid the pattern being expanded by your command shell, and instead pass it to the program as is. This can be achieved with quotes.

The man page has this example

 ffmpeg -r 10 -f image2 -i 'img-%03d.jpeg' out.avi

So in your case, you could try

 ffmpeg -r 60 -i '%07d.gif' -c:v libx264 out.mp4
Thilo
  • 257,207
  • 101
  • 511
  • 656
0

The shell is performing file name expansion on the given commandline, namely *.gif. Look here on how to prevent it using quotes.

Also, the sequence pattern type looks more useful in your case. Something like the following should work:

ffmpeg -r 60 -pattern_type sequence -i "img%d.gif" -c:v libx264 out.mp4

If I understand correctly, the problem with globbing is that it will sort your file in alphabetical order i.e. img-1.gif, img10.gif, ..., img2.gif, img20.gif...

Community
  • 1
  • 1
Diego
  • 1,789
  • 10
  • 19