Last active
April 25, 2024 17:46
-
-
Save fsalehpour/0cae06d8698c652f3c62d944d8ece9a4 to your computer and use it in GitHub Desktop.
Script to add a scrolling watermark and scaling a video in one go using `ffmpeg`
This file contains 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 | |
dir=$(pwd) | |
(cd $1 | |
mkdir -p output | |
for i in * | |
do | |
output="output/$(echo $i | sed 's/\..*$/\.mp4/')" | |
T=$(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "$i") | |
HEIGHT=$(ffprobe -v error -show_entries stream=height -of default=noprint_wrappers=1:nokey=1 "$i") | |
ffmpeg -i "$dir/logo.png" -y -v quiet -vf scale=-1:$HEIGHT/12 "$dir/scaled.png" | |
ffmpeg -i "$i" -i "$dir/scaled.png" -filter_complex "overlay=((W-w)/$T)*t:100,scale=-1:240" "$output" | |
done | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment