tanersener / ffmpeg-video-slideshow-scripts

Shell scripts to create video slideshows using images and videos

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FFmpeg Video Slideshow Scripts made-with-bash MIT license Build Status

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

Features

                  Blurred Background                                                     Moving Text                                                            

                  Object Animation                                                     Photo Collection                                                            

                          Push Film                                                           Zoom In and Pan                                        

                  Blurred Background                                                     Moving Text                                                            

                    Object Animation                                                     Zoom In and Pan                                                    

                              Bars                                                                   Checkerboard                                  

                              Clock                                                                     Collapse                                            

                              Cover                                                                       Expand                                          

                            Fade In                                                                     Push Box                                        

                              Push                                                                         Rotate                                        

                        Sliding Bars                                                         Spin Blur Rotation                                                              

                              Stack                                                                     Wipe In                                           

                              Bars                                                                   Checkerboard                                  

                              Clock                                                                     Collapse                                            

                              Cover                                                                       Expand                                          

                            Fade In                                                                   Moving Bars                                          

                            Push Box                                                                     Push                                        

                          Rotate #1                                                                   Rotate #2                                                  

                        Sliding Bars                                                         Spin Blur Rotation                                                              

                            Wipe In                                                                                                                  

Requirements

  1. ffmpeg 2.8.x or later for all scripts except those listed in 2.
  2. ffmpeg 3.x or later for the following scripts
    • logo_overlay_and_zoom.sh
    • zoom_in_and_pan_with_fade_in_out_one.sh
    • zoom_in_and_pan_with_fade_in_out_two.sh
    • zoom_out_and_pan_with_fade_in_out_one.sh
    • zoom_out_and_pan_with_fade_in_out_two.sh
    • box_in_horizontal.sh
    • box_in_vertical.sh
    • push_box_horizontal.sh
    • push_box_vertical.sh

Please note that 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 selected files from media folder. Transition scripts implement different transition effects and advanced scripts implement 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 some extra options too.

    • WIDTH: Width of the slideshow, in pixels
    • HEIGHT: Height of the slideshow, in pixels
    • FPS: Frames per second value for the output video
    • IMAGE DURATION: Defines how long each image will be displayed, in seconds
    • TRANSITION DURATION: Defines transition duration, in seconds
    • SCREEN MODE: Defines how images/videos will be fitted. 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.
  • # FILE OPTIONS section defines which files will be included in the slideshow and in which order.

    By default, find ../media/*.jpg command is used to select all .jpg files found in the media folder. Order is not defined in this selection. To include files in a specific order, it is possible to append sort at the end of find as in find ../media/*.jpg | sort -r expression.

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.

Build Status

branch status
main Build Status
v2.x Build Status

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 output video codec 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 the 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 images/videos 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.

Images inside media folder are published in the public domain. These images are:

Videos inside media folder are published in the public domain. These videos 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 and videos

License:MIT License


Languages

Language:Shell 100.0%