

This can result in a distorted video if input and output aspect ratios are different.įfmpeg -i input.mov -vf scale=320:240 output.mp4 The most basic scaling command below will simply resize the video to the required size in pixels.

The scale command works for images and videos. This covers the scaling command very clearly with examples. Reference: - please review this for anything not covered here. I didn't manage to make video scaling work correctly from previous answers, so having looked into this myself, I wanted to add a current and more detailed answer to these. Option 2: Scale the video, keep aspect ratio so that height is adjusted to fit ffmpeg -y -i "%%i" -vf scale=480:-2,setsar=1:1 -c:v libx264 -c:a copy "%%~ni_shrink.mp4" Option 3, I'll give a partially tested solution. Option 2 would be the preferred solution, otherwise you are (probably unnecessarily) increasing the output file size. Crop the input before scaling so that it "fills" the 480x320 resolution.Scale the video, keep aspect ratio and pad with black bars so that the video size is exactly 480x320.Scale the video, keep aspect ratio so that the scaled height (or width) is adjusted to fit.As you have your command, the aspect ratio is potentially going to get messed up. (I'm not too sure about the output file expansion in the Linux script, worth validating that.) If you're certain it's exactly 4:3, of course, just use 104:135.I guess that really there are two questions here.įfmpeg -y -i "$i" > "$_shrink.mp4" It could be 4:5, I suppose (very close to 104:135), but I don't know of anything that produces that pixel aspect ratio maybe try that first, and then try 3:4 if it still looks a little too stretched horizontally. It's 720 wide, which suggests a DVD source it's a 25 fps video, suggesting PAL, but the PAR works out to less than 1, suggesting NTSC. If the source represents true SD NTSC pixels (in which case only the central 704×480 pixels are supposed to map to a 4×3 screen, with 8 pixels overscan on either side), the correct command would be: mp4box source.mp4 -out target.mp4 -par 1=10:11īecause (4/3) / (704/480) = 10/11 – exactly the reference pixel aspect ratio for standard definition NTSC video.įor the case given in the question, if it's really 4:3, that gives a very odd pixel aspect ratio: (4/3)/(720/416) = 104/135. For this case, you need: mp4box source.mp4 -out target.mp4 -par 1=8:9 (Equivalently, you're describing the aspect ratio of a source pixel.) For example, suppose you have a DVD source that's 720×480, and the correct display aspect ratio is 4:3.

When you use -par stream-number=width:height, you define the pixel aspect ratio – that is, the result of dividing the device aspect ratio by the storage aspect ratio. With an -out parameter (so as not to disturb your original file): mp4box source.mp4 -out target.mp4 -par stream-number=width:height Delgado's answer is correct that MP4Box can do this, but the -par option doesn't work quite as described.
