Originally Posted by Ryelzz
I have done some research online and believe this is due to the AVI using rectangular pixels while the mp4 uses square pixels, but I don't understand the implications of this.
It's the other way around, AVI assumes every pixel is square therefore you get a weird aspect ratio (NTSC stretched horizontally and PAL/SECAM stretched vertically), Encoded video is smarter than AVI, it can display a rectangular pixel or a square pixel and the shape of the pixel PAR (pixel aspect ratio) can be assigned via an SAR flag, The SAR flag value (or PAR shape) depends on the initial resolution and the format of the video. If the SAR equals 1 it's a square pixel, if it's a fraction it's a rectangular pixel, Whatever SAR you choose the final goal is to have a perfect 4:3 aspect ratio of the frame.
Here are some SAR values for the 4:3 frame:
720x480 (DV/DVD, Full frame) -> SAR=8/9
704x480 (Analog Capture, SD Crop) -> SAR=10/11
640x480 (Square pixel, SD Resize) -> SAR=1
720x576 (DV/DVD, Full frame) -> SAR=16/15
704x576 (Analog Capture, SD Crop) -> SAR=12/11
768x576 (Square pixel, SD Resize) -> SAR=1
The general formula is: SAR = 4:3 x (V resolution : H resolution)
ffmpeg -i In.avi -vf "scale=w=-1:h=-1:interl=1,format=yuv420p,setsar=SAR=10/11" -flags +ildct+ilme -c:v libx264 -crf 18 -x264opts bff=1:colorprim=smpte170m:transfer=smpte170m:colormatrix=smpte170m:force-cfr -c:a aac -b:a 192k Out.mp4