Script to generate a slideshow movie with the Ken Burns effect, using FFmpeg.
Forked from this project based on ideas explained on this blog post from the same author.
The original project did ok using some pictures and a background music track. I had some more requirements.
- Slides from both still images and video clips
- Preserve audio from the video clips
- Music background on still images slides
- Simple subtitle generator
- Full screen text slides
So after a lot of iterations I got it working expanding on the ideas of the original project. Tried with a real example folder with 700 still images, 7 short mp4 video clips and about 12 background music tracks.
My first attempt crashed my computer when the ffmpeg started eating
RAM and my OS reported 57 GB of memory used (between physical and swap).
So back to the editor I had to break down the process into multiple
ffmpeg executions and intermediate files before muxing it all back
together.
The extended implementation is now the main kburns.rb script. The
original upstream script has been removed from this fork.
- Ruby
- FFmpeg and
ffprobe - Ruby gems:
fastimageandthread/pool Inter-ExtraBold.otfin the repository root for generated title slides
The simple way: just run the script with all input parameters and
the output file as the final parameter. You can mix still images,
video clips and audio tracks. Supported video extensions include
.mp4, .mpg, .avi, and .3gp, as long as your FFmpeg build can
decode the file. The two first kinds of inputs would become slides in
the defined order. The audio files would become the background track,
also in the defined order.
./kburns.rb 001.JPG please.mp4 002.JPG 002b.mp4 004.JPG 005.JPG asfalto.mp3 "09 My way.mp3" out.mkv
You can also get some verbose information about the process with
--verbose.
Subtitles can be specified with a simple file where each line is a subtitle associated with a slide.
Like this:
001 Day 1
002 Partying with friends
004 Wait for it!
This will look for a slide which filename starts with 001 and show
the text Day 1 during that slide. It will be converted to a srt
file embedded in the resulting mkv file.
You can also prefix a filename with a T and the text will be put into a full screen black slide just before the image itself. You can add up to two lines of text repeating the same prefix.
Example:
./kburns.rb --verbose --subtitles=subs.txt 001.JPG please.mp4 002.JPG 002b.mp4 004.JPG asfalto.mp3 out.mkv
Temporary temp-kburns* files are reused between runs. Add
--delete-temp-files to remove them when the script exits.