

You can downmix surround audio to stereo with: -ac 2 or -ac 5.1. If your video has surround sound you might consider converting the audio to stereo, since most YouTube watchers are not going to have surround speakers. But since the FFMpeg AAC codec limits the bit rate to 128kbps by default, you should probably set this.

128kbps is rather low quality so we should set the bit rate to a minimum of -b:a 320k This is really not required from Youtube, and it doesn’t make sense to limit the audio bitrate, since storage is not an issue here. The AAC codec for FFMpeg will by default set the audio bitrate to 128kbps unless else is specified. Videos are almost always in 48kHz unless you got some high-quality-super-duper-lossless audio going on. Just use 48 kHz, it won’t reduce the audio quality. Trust me when I say that there is absolutely no reason to use 96kHz. You will also need to use either -ar 48000 which sets the sampling frequency/ sample rate to 48kHz, or -ar 96000 kHz which sets the sample rate to 96khz. This offers better quality than MP3 but is still a lossy format though. Youtube recommends using AAC-LC so we can write -c:a aac to convert the audio stream to the “ Advanced Audio Coding” codec. Youtube recommends using MP4 as the video container type. Here is an example for a 1080p SDR video at 60 frames per second: ffmpeg -i input.ext -c:v libx264 -preset slow -crf 18 -c:a aac -ar 48000 -ac 2 -b:a 320k -profile:v high -level 4.0 -bf 2 -coder 1 -pix_fmt yuv420p -b:v 10M -threads 4 -cpu-used 0 -r 60 output.mp4 We can use the handy command-line-based tool FFMpeg to follow these recommendations.

YouTube has an official encoding guide, which if you follow correctly, will result in the video not having to be converted by YouTube once you upload it. This way you might save some time waiting for the video to get ready and you will have more control over the visual quality of the video. If you have the hardware for it, you can convert the video yourself before uploading it. This can take some time, and you really have no control over how YouTube converts your video. When you upload a video to YouTube, YouTube will convert that video to an appropriate video format for streaming.
