Monday, 20 May 2019

bash - ffmpeg an image sequence


I want to encode a sequence of images to an video file, I have done this in the past with something like:


ffmpeg -i %08d.jpg out.mp4


But first I had to rename the files to be in that %08d.jpg format. I want to just encode them and let them be in alphabetical order (or whatever) without having to rename them, is this possible? I tried with using *.jpg and ffmpeg just hung and eventually crashed.



Answer



It is actually possible to let ffmpeg actually handle the glob for you. Use the -pattern_type option from the image2 demuxer and wrap the glob in single quotes to prevent expansion:


ffmpeg -f image2 -pattern_type glob -i '*.jpg' out.mp4

For older versions of FFmpeg, you could use the % character, for example:


ffmpeg -i %*.jpg out.mp4

The above is however considered deprecated.


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...