How do I convert anamorphic hdv video to normal h.264 video with ffmpeg? How to ensure square pixels in output? I have the following code to convert HDV video to a web ready mp4:

ffmpeg -i hdv-input.m2t -crf 28 -c:a aac -b:a 80k -ac 1 -strict -2 -movflags +faststart h-264-out.mp4


The problem is that there is nowhere in this command to specify pixel aspect ratio. If you are not aware, HDV video files are 1440x1080, but the pixels are not square. When decoded for display, the pixels are stretched to make a full 1920x1080. This is called anamorphic video, and it is something that should definitely be avoided if producing for end users.

I honestly don't know if the mp4's I'm making with the above command are being produced with square pixels, but I want to make sure they are. What are the correct parameters I need to add to this command to ensure square pixels in my output mp4? Do I also have to set resolution, and how do I do that? It seems like there should be a -c:v command as well, but I don't really know.
You can use a combo of the scale and setsar filters.

ffmpeg -i hdv-input.m2t -vf "scale=iw*sar:ih,setsar=1" -crf 28 -c:a aac -b:a 80k -ac 1 -movflags +faststart h-264-out.mp4


The scaler width to set to current width x sample/pixel aspect. If it's already 1, it amounts to new width = old width. I've added a setsar afterwards to ensure the output SAR is 1.

For MP4 format, default video codec is H.264. If that's what you want, no need to explicitly set c:v.

(For bitrates &lt; 128k, libfdk_aac is better than the native AAC encoder.)

-strict -2 is not needed for using native AAC encoder if your ffmpeg is from after Dec 2015.