One way is to create a video from each image, and then combine them all. With mencoder
you could do the following:
This will create a video with 1 frame per second from image.jpg
:
mencoder "mf://image.jpg" -ovc x264 -mf fps=1 -o output.avi
This will take two videos and merge them into one:
mencoder -ovc copy -oac copy video1.avi video2.avi -o completevideos.avi
It might look something like this. Each line of durations.txt
contains a duration (in milliseconds here), and images are named as in your example. This is meant as an example and may not work as presented:
i = 0 while read line; do padded = $(printf "%04d\n" $i) fps = $(echo "scale=3; 1/$i/1000" | bc -q 2>/dev/null) if [ i -eq 0 ]; then mencoder "mf://image$padded.jpg" -ovc x264 -mf fps=$fps -o previous.avi else mencoder "mf://image$padded.jpg" -ovc x264 -mf fps=$fps -o next.avi mencoder -ovc copy -oac copy previous.avi next.avi -o building.avi rm previous.avi mv building.avi previous.avi fi i = $[i + 1]; done < durations.txt
The ffmpeg
tool has similar functions:
ffmpeg -loop 1 -i img.png -c:v libx264 -t 30 -pix_fmt yuv420p out.mp4 ffmpeg -i concat:"intermediate1.mpg|intermediate2.mpg" -c copy intermediate_all.mpg