M€rging videos with different dimensions, ffmpeg and scaling?
Posted: 17 Jun 2021 18:15
Hello,
i spent hours trying to figure out how to m€rg€ numerous files with different dimensions and asp€ct rati0s.
My result so far is to recode video files 1.mp4 and 2.mp4 like this:
A) method where i scale both files in attempt to match the normalize dimensions of both segments:
cd videosdir;
for i in 1 2; do ffmpeg -i $i.mp4 -vf "scale=576:-2,setdar=4:3,setsar=1" "$i"sdarsar1.mp4; done
Seems to be working to merge files (i am using LosslessCut/Tools/Merge menu item), aspect quite ok on merged files, but downscaled the first segment of the video file too much as you can see on the left side of the following image.
B) or command without scaling filter:
cd videosdir;
for i in 1 2; do ffmpeg -i $i.mp4 -vf "setdar=4:3,setsar=1" "$i"sdarsar1.mp4; done
Resulting merged file (scaling on the left, no scaling on the right):
Some more details about source and resulting files dimensions and aspect is also here.
Do you have idea how to best process the files so the aspect r@tios are same as original and the dimensions as similar or same as possible?
i spent hours trying to figure out how to m€rg€ numerous files with different dimensions and asp€ct rati0s.
My result so far is to recode video files 1.mp4 and 2.mp4 like this:
A) method where i scale both files in attempt to match the normalize dimensions of both segments:
cd videosdir;
for i in 1 2; do ffmpeg -i $i.mp4 -vf "scale=576:-2,setdar=4:3,setsar=1" "$i"sdarsar1.mp4; done
Seems to be working to merge files (i am using LosslessCut/Tools/Merge menu item), aspect quite ok on merged files, but downscaled the first segment of the video file too much as you can see on the left side of the following image.
B) or command without scaling filter:
cd videosdir;
for i in 1 2; do ffmpeg -i $i.mp4 -vf "setdar=4:3,setsar=1" "$i"sdarsar1.mp4; done
Resulting merged file (scaling on the left, no scaling on the right):
Some more details about source and resulting files dimensions and aspect is also here.
Do you have idea how to best process the files so the aspect r@tios are same as original and the dimensions as similar or same as possible?