Skip to content

Command line program for generating desktop wallpapers from movie frames containing scene changes with FFmpeg and ImageMagick

License

Notifications You must be signed in to change notification settings

indiscipline/movie-thumbnailer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

movie-thumbnailer

License

Command line "glue" for ffmpeg and ImageMagick which generates wallpaper from video files, containing frames with scene changes The program expects ffmpeg and magick to be in your PATH.

Expanded description >> in the blog post <<

Developed using the wonderful Clap and Rayon crates.

Usage

<img alt="movie-thumbnailer example" width="33%" src="example/TheMagicSword-1024x768.png"/>

Provide movie-thumbnailer with the path to the video file of your choice and the list of wallpaper resolutions you'd like it to generate collages for. The program puts temporary files in the current directory. It creates a folder frames where it puts the result of ffmpeg scene extraction and then pauses. This is the most time consuming part of the process. At this point the user should manually scan the extracted frames and remove unwanted/duplicate/false-identified frames. Upon resuming, movie-thumbnailer uses imagemagick for preprocessing the remaining frames (mostly for better sharpness and contrast in reduced size) and puts them in the frames_scaled directory. Then optimal size for the thumbnails and the final layout are calculated for each of the resolutions and the collages are created. Resulting files saved as png with transparent background.

The program tries to be "smart" and calculates the layout so there's some spacing between frames and the composite doesn't cover all the available space, leaving some margins (6% of the screen width and 18% of the height). At the moment, coefficients are hard-coded in calc_thumbnail_size function.

Usage example:

movie-thumbnailer -r 2560x1440,1920x1080,1366x768 TheMagickSword.mp4

Full help available on --help switch.

Example wallpaper is generated from the 1962 Bert I. Gordon movie "The Magick Sword" which is in public domain and available from Archive.org.

How to build

Developed with stable Rust.

To build the code, go to the project directory and run:

$ cargo build --release

The executable will be target/release/movie-thumbnailer.

Contributing

This is a small helper utility which achieves its intended functionality, but if you know how to improve it, file a bug report via Issues.

Possible enhancements:

  • Options for margin coefficients
  • Option for scene detection threshold
  • Ask for removing temporary files on completion
  • Open the file browser with the frames directory at the manual thinnig-out stage
  • Option for generating the final image with any solid background

License

movie-thumbnailer licensed under GNU General Public License version 3 or later;

See LICENSE.md for full details.

About

Command line program for generating desktop wallpapers from movie frames containing scene changes with FFmpeg and ImageMagick

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages