Skip to content

michaelsrichter/slideshow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

Slideshow Creator

A bash script that creates professional MP4 slideshows from a folder of images using FFmpeg.

Features

  • âś… Supports multiple image formats (PNG, JPG, JPEG, GIF, BMP, TIFF, HEIC, HEIF)
  • âś… Configurable photo duration (default: 5 seconds)
  • âś… Automatic resolution normalization to web-friendly 1920x1080
  • âś… Ken Burns effect with randomized pan/zoom directions for cinematic motion
  • âś… Blurred backgrounds using dominant colors from each image (no more black bars!)
  • âś… Date overlays - Automatically extracts and displays photo dates from EXIF metadata
  • âś… Title slide - Add a custom title screen at the beginning of your slideshow
  • âś… Image sorting - Sort by filename, EXIF date taken, or file creation date
  • âś… Background music - Add one or more MP3 files with auto-calculated photo timing
  • âś… Multiple transition effects: fade, wipe, slide, or random
  • âś… Proper portrait/landscape handling with auto-orientation
  • âś… Parallel image processing for faster performance (4x speedup with GNU Parallel)
  • âś… Temporary file management for optimized processing
  • âś… MP4 output format

Requirements

Required

  • FFmpeg: Core video processing engine
    sudo apt-get install ffmpeg

Optional (Recommended)

  • ImageMagick: Better image preprocessing
    sudo apt-get install imagemagick
  • ExifTool: For date metadata extraction and overlay
    sudo apt-get install libimage-exiftool-perl
  • GNU Parallel: For parallel image processing (4x faster)
    sudo apt-get install parallel

Installation

  1. Clone or download this repository
  2. Make the script executable (already done):
    chmod +x create_slideshow.sh

Usage

Basic Usage

./create_slideshow.sh -s /path/to/photos

Full Syntax

./create_slideshow.sh -s SOURCE_FOLDER [OPTIONS]

Options

Option Description Default
-s, --source Source folder with images (required) -
-d, --duration Duration each photo is shown (seconds) 5
-t, --transition Transition type: fade, wipe, slide, random fade
-k, --ken-burns Enable Ken Burns effect (pan/zoom) disabled
-o, --output Output filename slideshow_TIMESTAMP.mp4
-r, --resolution Output resolution (WxH) 1920x1080
--title Add title slide with specified text none
--sort Sort order: filename, date, created filename
-m, --music Add music file (mp3). Can be used multiple times none
-h, --help Show help message -

Examples

Simple slideshow with default settings

./create_slideshow.sh -s ./vacation_photos

7-second photos with random transitions and Ken Burns effect

./create_slideshow.sh -s ./wedding_photos -d 7 -t random -k

Custom output filename with fade transitions

./create_slideshow.sh -s ./photos -d 3 -t fade -o my_slideshow.mp4

Slideshow with title slide

./create_slideshow.sh -s ./photos --title "Our Family Vacation 2025"

Sort by date taken (EXIF metadata)

./create_slideshow.sh -s ./photos --sort date

Slideshow with background music

./create_slideshow.sh -s ./photos -m song1.mp3 -m song2.mp3 -t random

HD resolution (720p) slideshow

./create_slideshow.sh -s ./photos -r 1280x720

Transition Types

  • fade: Smooth fade between images
  • wipe: Left-to-right wipe transition
  • slide: Sliding transition effect
  • random: Randomly select from fade, wipe, and slide for each transition

Ken Burns Effect

The Ken Burns effect adds cinematic motion to still images by slowly panning and zooming. Each image gets a random direction (left, right, up, or down) with a smooth zoom for varied, professional-looking motion. Enable with the -k flag:

./create_slideshow.sh -s ./photos -k

Features:

  • Random pan direction for each image (left/right/up/down)
  • Smooth zoom from 1.0x to 1.1-1.2x
  • Optimized for performance with simplified algorithm
  • Automatic use of "faster" encoding preset

Blurred Backgrounds

Instead of black letterbox/pillarbox bars, the script creates a blurred, color-matched background from each image:

  • Background is a blurred, zoomed version of the image
  • Uses dominant colors from the photo
  • Sharp image centered on top
  • Professional Instagram/social media style
  • Automatically applied to all portrait and non-16:9 images

Title Slide

Add a custom title slide at the beginning of your slideshow with the --title option. The title appears as white text centered on a black background.

Features:

  • Simple, elegant black background with white text
  • Centered 72-point font
  • Same duration as your photo duration setting
  • Transitions smoothly into your first photo

Example:

./create_slideshow.sh -s ./photos --title "Summer Vacation 2025" -d 5

The title slide will be shown for 5 seconds before transitioning to the first photo.

Background Music

Add background music to your slideshow with automatic timing! The script automatically calculates photo duration to perfectly match your music length.

Features:

  • Multiple files: Add one or more MP3 files using -m flag multiple times
  • Auto-timing: Photo duration is automatically calculated to match total music length
  • Smart concatenation: Multiple songs are joined with 2-second silence between them
  • Perfect sync: Video length matches music length exactly (with -shortest flag)

How it works:

Total duration = Music1 + 2sec + Music2 + 2sec + Music3...
Photo duration = Total duration / Number of images

Examples:

# Single music file
./create_slideshow.sh -s ./photos -m background_music.mp3

# Multiple music files (automatically concatenated)
./create_slideshow.sh -s ./wedding_photos -m ceremony.mp3 -m reception.mp3 -m dance.mp3

# Music with title slide and sorting
./create_slideshow.sh -s ./photos --title "Our Journey" --sort date -m soundtrack.mp3 -t random

Note: When music is provided, the -d duration parameter is ignored as timing is auto-calculated.

Image Sorting

Control the order of images in your slideshow with the --sort option:

Sort Options:

  • filename (default): Alphabetical order by filename
  • date: Chronological order by EXIF date taken (DateTimeOriginal or CreateDate)
  • created: Chronological order by file creation/modification time

Features:

  • date mode: Extracts EXIF metadata (requires exiftool), falls back to file time if no EXIF data
  • created mode: Uses file system creation/modification timestamp
  • All modes sort in ascending order (oldest to newest, A to Z)

Examples:

# Sort by date taken from EXIF metadata
./create_slideshow.sh -s ./photos --sort date

# Sort by file creation time
./create_slideshow.sh -s ./photos --sort created

# Default alphabetical sorting (no --sort needed)
./create_slideshow.sh -s ./photos

Perfect for chronological vacation slideshows or organizing photos by their actual capture date!

Date Overlays

Photos with EXIF metadata automatically get a date overlay in the lower right corner:

  • Extracts date from DateTimeOriginal or CreateDate EXIF tags
  • Formatted as: "Monday, January 1, 2020"
  • Displayed on a semi-transparent dark gradient background
  • White text for excellent readability
  • Only shown when date metadata is available
  • Requires exiftool (install: sudo apt-get install libimage-exiftool-perl)

Technical Details

  • Output Format: MP4 (H.264 codec)
  • Default Resolution: 1920x1080 (Full HD)
  • Frame Rate: 25 fps
  • Transition Duration: 1 second (hardcoded)
  • Image Processing:
    • Auto-orientation applied to fix rotated images
    • Portrait/landscape detection with blurred color-matched backgrounds
    • Parallel processing with GNU Parallel (4 concurrent jobs)
    • Images preprocessed to PNG for consistent processing
  • Ken Burns: Uses zoompan filter with trim for precise duration control
  • Encoding:
    • Default preset: "medium" for quality
    • Ken Burns preset: "faster" for performance
    • CRF 23 for balanced quality/size
  • Temporary Files: Automatically cleaned up after processing

Troubleshooting

"No image files found"

  • Ensure your source folder contains supported image formats
  • Check that the path is correct

FFmpeg errors

  • Make sure FFmpeg is installed: ffmpeg -version
  • Update FFmpeg to the latest version if you encounter filter issues

ImageMagick warnings

  • The script will work without ImageMagick but with slightly reduced image quality
  • Install ImageMagick for best results

Out of memory errors

  • Reduce the resolution with -r 1280x720
  • Process fewer images at a time

Performance Tips

  1. Use lower resolution for faster processing: -r 1280x720
  2. Disable Ken Burns effect if not needed (it's more CPU intensive)
  3. Install GNU Parallel for faster image processing: sudo apt-get install parallel
  4. Preprocess images to similar sizes before running the script
  5. The script automatically converts high-res images to web resolution for efficiency
  6. Ken Burns effect uses a simplified algorithm and faster encoding preset for better performance

Parallel Processing

If GNU Parallel is installed, the script will automatically process images concurrently (4 at a time), significantly speeding up the preprocessing phase:

sudo apt-get install parallel

Example Workflow

# Create a test folder with some images
mkdir test_photos
cp ~/Pictures/*.jpg test_photos/

# Create a basic slideshow (no Ken Burns, fade transitions)
./create_slideshow.sh -s test_photos

# Create a professional slideshow with all features
./create_slideshow.sh -s test_photos \
  -d 6 \
  -t random \
  -k \
  -o my_awesome_slideshow.mp4

What you get:

  • 6 seconds per photo
  • Random transitions (fade/wipe/slide)
  • Ken Burns effect with varied pan directions
  • Blurred backgrounds for portrait images
  • Professional, polished output

What's New

Latest Updates:

  • v1.7 - Background music support with auto-calculated photo timing
  • v1.6 - Image sorting by filename, EXIF date taken, or file creation date
  • v1.5 - Title slide feature with custom text on black background
  • v1.4 - Automatic date overlays from EXIF metadata with gradient backgrounds
  • v1.3 - Blurred color-matched backgrounds instead of black bars
  • v1.2 - Randomized Ken Burns pan directions (left/right/up/down)
  • v1.1 - Performance optimizations with GNU Parallel support
  • v1.0 - Initial release with transitions and Ken Burns effect

License

Free to use and modify.

Contributing

Feel free to submit issues and enhancement requests!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages