Napproche / ffmpeg-video-slideshow-scripts

Shell scripts to create video slideshows using images.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FFmpeg Video Slideshow Scripts made-with-bash MIT license

Configurable shell scripts to create video slideshows from images using FFmpeg.

Features

Requirements

  • ffmpeg 2.8.x or later, except ffmpeg 4.1 which has some bugs and crashes for some of the scripts

Advanced Moving Text script needs FFmpeg to be build with freetype. If you compile FFmpeg from source you need to provide --enable-libfreetype flag on ./configure.

Description

Each script creates a video slideshow using files inside photos folder. Transition scripts implements different transition effects and advanced scripts implements more complex animation like transitions/transformations.

Output of all scripts is an h264 encoded MPEG-4 video.

Customization

  • There is a # SCRIPT OPTIONS section at the top of each script. That section lists all editable parameters for that individual file.

    Below you can see the list of commonly used options. Please note that editable options are not limited to the list below and some scripts define their own options.

    • WIDTH: Width of the slideshow, in pixels
    • HEIGHT: Height of the slideshow, in pixels
    • FPS: Frames per second value for the output video
    • PHOTO DURATION: Defines how long each photo will be displayed, excluding transition, in seconds
    • TRANSITION DURATION: Defines transition duration, in seconds
    • PHOTO_MODE: Defines how photos will be fitted to screen. Supported modes are center, crop, scale and blur
    • DIRECTION: Controls transition direction in supported scripts, e.g., left to right, right to left, top to bottom, bottom to top
    • BACKGROUND COLOR: Defines background color. You can use short names like black, white; hex values in 0xYYYYYY format like 0x265074, 0xc4cdd4 or transparent color with #00000000. Refer to color-syntax documentation for the details.
  • # PHOTO OPTIONS section defines a command to select which photos will be included in the slideshow and in which order. Default value is find ../photos/*, which selects all files found in the photos directory. Order is not defined in default selection. To provide ordering it is possible to append sort at the end of find as in find ../photos/* | sort. Please refer to man pages of find and sort for additional information.

If you want to learn more about how a specific script works refer to v1.x branch of this repository. Scripts in v1.x branch are not customizable but easier to understand.

Tips

Speed

  • Scripts may take a long time to complete depending on your computer hardware. You can decrease the values of resolution, fps and duration parameters as much as possible to increase the speed.

  • At the end of each script there exists a # XX. END section which defines the video codec used with additional tuning variables. Currently all scripts use H264 encoding using Main profile and level 4.2. This information is given in -profile:v main -level 42 -c:v libx264 part of that section. You can edit this part according to H.264 Video Encoding Guide to increase the speed of scripts. There are many different tuning parameters defined in that guide and some of them may work for script you used.

    # 11. END
    FULL_SCRIPT+=" -map [video] -vsync 2 -async 1 -rc-lookahead 0 -g 0 -profile:v main -level 42 -c:v libx264 -r ${FPS} ../transition_push_vertical.mp4"
    

Memory

  • Unfortunately some scripts consume too much memory. If you experience memory issues, you may try to split your photos into two or more smaller sets, create partial videos for each set and concatenate them with the following command. Although this technique works perfect for some scripts and it won't be possible to guess that video is concatenated, some others will not include a transition between the partial videos and it will be noticeable that final video is concatenated. If you decide to apply this method, please pay attention to that.

    ffmpeg -i part1.mp4 -i part2.mp4 -filter_complex "[0:v][1:v]concat=n=2:v=1:a=0[slideshow]" -map "[slideshow]" full_slidshow.mp4

Versions

  • v1.x branch: Main focus of this branch is to show how ffmpeg filters work and how they can be used to implement a transition or animation. So scripts in this branch are mostly static and hard to customize.

  • v2.x branch: Scripts are optimized/rearranged in order to be customized. They are hard to understand but easy to customize.

Updates

Refer to Changelog for updates.

Known Issues

You may notice the following warnings when executing the scripts. Below you can find their reasons and possible fixes.

1.

[swscaler @ 0x............] deprecated pixel format used, make sure you did set range correctly

This warning is printed because input image streams are decoded with yuvj444p pixel format, which is deprecated. You can safely ignore it, ffmpeg users are not effected from this warning.

2.

[out_0_0 @ 0x............] 100 buffers queued in out_0_0, something may be wrong.s dup=. drop=. speed=...

[Parsed_overlay_80 @ 0x............] [framesync @ 0x............] Buffer queue overflow, dropping.

Statements inside filter_complex are ordered into logical groups to give a better understanding of how they work. In this ordering scheme too many streams/statements wait in the buffer queue, which generates these two warnings. If you want to resolve them change the order of statements inside filter_complex and use new streams immediately after they are created.

3.

Past duration 0.xyz too large

Currently push_box and box_in transitions print this warning. setpts=0.5*PTS statements used inside the scripts cause this. If you know how to remove it safely please submit an issue.

Useful Links

How to prevent shake effect for zoompan filter

Contributing

Feel free to submit issues or pull requests.

License

This project is licensed under the MIT License with the following exceptions.

Photos inside photos folder are published in the public domain. These photos are:

Snow flake and heart images inside objects folder are downloaded from pngimg.com and pngimg.com, both licensed under the Creative Commons 4.0 BY-NC.

Film strip images inside objects folder are modified from Film Strip by Nevit Dilmen and licensed under Creative Commons Attribution-Share Alike 3.0 Unported.

Falling Sky font inside fonts folder is licensed under the SIL Open Font License (OFL).

See Also

About

Shell scripts to create video slideshows using images.

License:MIT License


Languages

Language:Shell 100.0%