Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

There seem to be several ways to convert images to videos, but they all appear to just let you show each video a fixed amount of time. Does anybody know of a way to script the creation of a video from image files that lets you specify the length to show each image?

E.g.

magicSoftware.exe out=video.mp4 | in=file1.png time=100ms | in=file2.png time=400ms
share|improve this question

1 Answer 1

I can't think of any tool that can do this as a simple one-off command; you could, however, convert your images individually to videos (of varying length) and then concatenate those videos together - I would use ffmpeg for this.

ffmpeg -f image2 -loop 1 -i input1.png -t 6 -crf 22 -preset veryfast 01.ts
ffmpeg -f image2 -loop 1 -i input2.png -t 9 -crf 22 -preset veryfast 02.ts
ffmpeg -f image2 -loop 1 -i input3.png -t 4 -crf 22 -preset veryfast 03.ts

-t sets the output duration in seconds. You can also use fractions of seconds, so -t 2.2 will give you a duration of 2.2 seconds. If you wish to specify length in terms of video frames, you can use -vframes of frames:v; by default, this command will give you 25frames per second. Then, concatenate the MPEG TS files together into a single MP4:

ffmpeg -i "concat:01.ts|02.ts|03.ts" -c copy output.mp4

Of course, it would be possible to script this (I know how I'd do it in bash, but I don't have any knowledge of scripting on Windows).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.