FFmpeg settings for YouTube and Facebook video uploads

ffmpegyoutube-api

Can any FFmpeg experts share their preferred settings for video conversion to both YouTube and Facebook?

For Youtube I am following these guidelines and my video size is 480P @ 24 fps

  • Audio Codec: AAC-LC
  • Channels: Stereo or Stereo + 5.1
  • Sample rate 96khz or 48 khz
  • Video Codec: H.264
  • Progressive scan (no interlacing)
  • High Profile
  • 2 consecutive B frames
  • Closed GOP. GOP of half the frame rate.
  • CABAC
  • Variable bitrate. No bitrate limit required
  • Color Space: 4.2.0

Advanced encoding specifications – YouTube Help

Best Answer

Don't consider the guidelines as strict requirements. General recommendation is to provide the highest quality that is practical for you to upload. It's that simple; whatever you upload is going to be re-encoded anyway and YouTube will almost always accept whatever you give them. That means you either upload the original content, or if the original is too big you can re-encode it using a high quality. Example using ffmpeg:

ffmpeg -i input -c:v libx264 -crf 18 -preset slow -c:a copy output.mkv

See FFmpeg Wiki: H.264 for more details–specifically the -crf and -preset options. Notice that I simply copied the audio, but you may choose to re-encode it if the source contains uncompressed audio.

Your player may not be able to play the output for various reasons, but YouTube certainly will.

Related Question