Last active
March 31, 2020 12:42
-
-
Save Enweave/8ec5c34481caf1aaa25e11d1f96540b7 to your computer and use it in GitHub Desktop.
ffmpeg create looped slideshow over a music track.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # folder wth images | |
| IMAGE_DIRECTORY="test_footage" | |
| # image extension | |
| IMAGE_EXT="jpg" | |
| #SLIDE TIME IN SECONDS | |
| SLIDE_DURATION=2 | |
| #audio track file | |
| AUDIO="test_footage/music.mp3" | |
| #output file | |
| LOOP_FILE="loop.mp4" | |
| OUT="out.mp4" | |
| FR=$(awk "BEGIN {print 1/$SLIDE_DURATION}") | |
| ffmpeg -y -framerate $FR -pattern_type glob -i "$IMAGE_DIRECTORY/*.$IMAGE_EXT" -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" -q:v 2 $LOOP_FILE | |
| ffmpeg -stream_loop -1 -i $LOOP_FILE -c copy -v 0 -f nut - | ffmpeg -y -thread_queue_size 10K -i - -i $AUDIO -c copy -map 0:v -map 1:a -shortest $OUT | |
| rm $LOOP_FILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment