Using Mencoder to Convert Sequence of Images Sorted Numerically to Video

607 Views Asked by At

I want to use mencoder to convert a sequence of PNG files to video. The PNG files are named like {file1.png, file2.png, ... file1000.png}. However, if I run this:

mencoder mf://*.png -mf fps=25 -ovc copy -oac copy output.avi

The resulting video will not stitch together the frames in the correct order (correct: 1,2,3,.... incorrect: 1, 10, 100, ...). Answers to a similar question suggest that I can manually input the range of frames to have mencoder use the correct numerical order:

mencoder mf://file{1..1000}.png -mf fps=25 -ovc copy -oac copy output.avi

or to manually sort the files with something like ls -v and then save the results to a list (say, list.txt), and then pass that into mencoder:

mencoder mf://@list.txt -mf fps=25 -ovc copy -oac copy output.avi

However, my question is: Is there a way to do this in a single command without specifying the last frame?

Ideally, I would want an equivalent to mf://file*.png that uses a numerical sorting as opposed to the default sorting. For example, ffmpeg has the option to specify input files like file%d.png, which would order the files numerically.

Thanks!

0

There are 0 best solutions below