Skip to content

Instantly share code, notes, and snippets.

@gabrielgilini
Created January 28, 2015 18:45
Show Gist options
  • Save gabrielgilini/4f73ea2cd92c6a6a1820 to your computer and use it in GitHub Desktop.
Save gabrielgilini/4f73ea2cd92c6a6a1820 to your computer and use it in GitHub Desktop.
#!/bin/zsh
# VARIABLES
file1=image1.jpg
file2=image2.jpg
file3=image3.jpg
video1="output/video1.mov"
video2="output/video2.mov"
video3="output/video3.mov"
part1=part1.mov
part2=part2.mov
part3=part3.mov
finalvideo="output/complete.mp4"
rm -rf output
mkdir -p output
# GENERATE VIDEOS
ffmpeg -framerate 1/5 -i "$file1" -r 25 -c:v qtrle -filter_complex "setsar=4/3" -threads 0 "$video1"
ffmpeg -framerate 1/5 -i "$file2" -r 25 -c:v qtrle -filter_complex "setsar=4/3" -threads 0 "$video2"
ffmpeg -framerate 1/5 -i "$file3" -r 25 -c:v qtrle -filter_complex "setsar=4/3" -threads 0 "$video3"
ffmpeg -y -i $video1 -i $part1 -i $video2 -i $part2 -i $video3 -i $part3 -f lavfi -i color=black -filter_complex \
"[0:v]format=pix_fmts=yuva420p,setpts=PTS-STARTPTS[va0];\
[1:v]format=pix_fmts=yuva420p,fade=t=in:st=0:d=0.5:alpha=1,setpts=PTS-STARTPTS+3/TB[va1];\
[2:v]format=pix_fmts=yuva420p,fade=t=in:st=0:d=0.5:alpha=1,setpts=PTS-STARTPTS+14/TB[va2];\
[3:v]format=pix_fmts=yuva420p,fade=t=in:st=0:d=0.5:alpha=1,setpts=PTS-STARTPTS+17/TB[va3];\
[4:v]format=pix_fmts=yuva420p,fade=t=in:st=0:d=0.5:alpha=1,setpts=PTS-STARTPTS+22/TB[va4];\
[5:v]format=pix_fmts=yuva420p,fade=t=in:st=0:d=0.5:alpha=1,setpts=PTS-STARTPTS+24/TB[va5];\
[6:v]scale=640:480,trim=duration=28[black];\
[black][va0]overlay=eof_action=pass[over0];\
[over0][va1]overlay=eof_action=pass[over1];\
[over1][va2]overlay=eof_action=pass[over2];\
[over2][va3]overlay=eof_action=pass[over3];\
[over3][va4]overlay=eof_action=pass[over4];\
[over4][va5]overlay=format=yuv420[outv]" \
-vcodec libx264 -map "[outv]" -threads 0 $finalvideo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment