Created
March 14, 2024 19:04
-
-
Save MartyLake/01c42a805e144f759d9b4c4e4cb3e8c4 to your computer and use it in GitHub Desktop.
convert ffmpeg video to vertical with overlay
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 | |
set -euo pipefail | |
IFS=$'\n\t' | |
set -x | |
FILTERGRAPH="[0:v]pad=iw:2*trunc(iw*16/18):(ow-iw)/2:(oh-ih)/2[padded];[padded]scale=1080:1920[resized];[resized][1:v]overlay" | |
echo "nullscr,$FILTERGRAPH,nullsink" | graph2dot | |
false | |
for f in $(find input -type f); do | |
if [ ! -f "$f" ]; then | |
continue | |
fi | |
converted=output${f#input}.mp4 | |
if [ -f "$converted" ]; then | |
echo "$converted already exist. skipping" | |
continue | |
fi | |
ffmpeg -i "$f" -i Untitled.png -filter_complex "$FILTERGRAPH" -c:v libx264 -crf 18 -map 0:a:0 "$converted" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment