You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
771 B

#!/usr/bin/zsh
video=$1
music=$2
image=$3
stopDur=5
videoLength=$(($(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 $video)))
musicLength=$(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 $music)
length=$(($(($musicLength-$stopDur)) / $videoLength))
ffmpeg -i $video -i $music -map 0:v -map 1:a -filter:v "setpts=$length*PTS,tpad=stop_mode=clone:stop_duration=$stopDur" -af "afade=t=out:st=28:d=3" -vsync 1 -y $video-fst-noimg.mp4
ffmpeg -i $video-fst-noimg.mp4 -i $image -filter_complex "overlay=x=(main_w-overlay_w)-125:y=(main_h-overlay_h)-10" -y $video-fst-img.mp4
ffmpeg -i $video-fst-img.mp4 -ss 00:00:$musicLength -s 682x415 -frames:v 1 $video-thumb.jpeg
#rm $video-fst-noimg.mp4