Created
February 17, 2022 20:50
-
-
Save DorianRudolph/cf41ddcdbb25b6a41ebf54f7a30ada81 to your computer and use it in GitHub Desktop.
Merge videos with different resolutions using FFMPEG
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
W=1920 | |
H=1080 | |
fps=fps=24000/1001 | |
out='../out.mp4' | |
vids=$(ls *.mp4) | |
n=$(echo "$vids" | wc -l) | |
inputs=$( for v in $vids; do echo -i; echo $v; done ) | |
filters0=$( for i in $(seq 0 $(($n-1))); do printf "[$i:v]scale=$W:$H:force_original_aspect_ratio=decrease,pad=$W:$H:(ow-iw)/2:(oh-ih)/2,setsar=1/1,setpts=PTS-STARTPTS,fps=$fps[v$i]; "; done ) | |
filters1=$( for i in $(seq 0 $(($n-1))); do printf "[v$i][$i:a]"; done ) | |
ffmpeg -y $inputs -filter_complex "$filters0$filters1 concat=n=$n:v=1:a=1[v][a]" -map "[v]" -map "[a]" "$out" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment