ffmpeg -i input.avi -c:v libx264 output.mp4
ffmpeg -i input.avi -c:v h264_vaapi output.mp4
ffmpeg -i input.avi -c:v h264_amf output.mp4
NOTE: h264_amf is only on Windows.
ffmpeg -i input.avi -c:v h264_nvenc output.mp4