Convert AVI to MP4 with H.264

basic conversion

// what it does

Transcodes an AVI into a standard MP4 with H.264 video (libx264) at CRF 23 and AAC audio — the most broadly compatible combination for web, phones, and TVs. AVI files often carry dated codecs (DivX, Xvid, MJPEG) that modern players choke on, so this normalizes them. CRF 23 is libx264's default and a solid quality/size balance.

// shell

$ ffmpeg -i input.avi -c:v libx264 -crf 23 -c:a aac output.mp4

// gotcha

libx264 requires even width and height for the standard yuv420p format; AVI sources with odd dimensions throw a 'height/width not divisible by 2' error — fix it with a scale/crop filter, and add -pix_fmt yuv420p if the source isn't already 4:2:0 so browsers can play it.