A simple CLI tool to generate a slideshow video from a directory of images using FFmpeg.
This tool requires ffmpeg to be installed and available in your PATH.
go build -o slideshowRun the tool by pointing it to a directory containing images:
./slideshow -directory ./my-photos -entry-duration 3
| Option | Default | Description |
|---|---|---|
-directory |
. |
The directory to scan for image files. |
-width |
1920 |
Width of the output video in pixels. |
-height |
1080 |
Height of the output video in pixels. |
-codec |
libx264 |
Codec to use to generate the slideshow (and intermediate files). |
-entry-duration |
5 |
Duration (in seconds) each image is displayed. |
-randomize |
false |
Randomize the order of images in the slideshow. |
-recursive |
false |
Recursively scan subdirectories for image files. |
-fps |
30 |
Frames per second of the output video. |
-crf |
23 |
CRF value for the codec |
-preset |
medium |
Preset for the codec |
-concurrency |
CPU_COUNT/2 |
Number of concurrent image processing goroutines. |
- Scan: The tool scans the specified directory for image files (based on MIME types). By default, only the top-level directory is scanned; pass
-recursiveto include subdirectories. - Process: For each image found, it uses FFmpeg to create a short video clip with the specified duration and resolution.
- Images are scaled to fit the target resolution while maintaining an aspect ratio, with black padding added if necessary.
- A silent audio track is added to each clip to ensure smooth concatenation.
- Assemble: All intermediate video clips are stored in a temporary
.tmp/directory. - Concatenate: The tool uses FFmpeg's
concatdemuxer to join all clips into a single MP4 file. - Cleanup: The temporary directory is removed after the final video is generated.
The output file is named based on the input directory and a timestamp, e.g., my-photos-2025-12-26_05-05-00.mkv.