FFmpeg setting to upload YouTube video

If needing to re-encode video anyway, for example if coming from an a scientific camera capture with uncompressed video, the suggested settings for YouTube upload using FFmpeg are:

ffmpeg -i in.avi -c:v libx264 -preset slow -crf 18 -c:a aac -b:a 192k -pix_fmt yuv420p -movflags +faststart out.mp4

If the video has no audio, use:

ffmpeg -i in.avi -c:v libx264 -preset slow -crf 18 -pix_fmt yuv420p -movflags +faststart out.mp4

Notes

FFmpeg for YouTube