Skip to content

Instantly share code, notes, and snippets.

@bugre
Forked from mikoim/README.md
Created March 2, 2022 02:11
Show Gist options
  • Select an option

  • Save bugre/06808702c26a1c8672c89bba4474686c to your computer and use it in GitHub Desktop.

Select an option

Save bugre/06808702c26a1c8672c89bba4474686c to your computer and use it in GitHub Desktop.
[Updated! Aug 14 2020] YouTube recommended encoding settings on ffmpeg (+ libx264)
#/bin/sh
ffmpeg -i input -c:v libx264 -preset slow -profile:v high -crf 18 -coder 1 -pix_fmt yuv420p -movflags +faststart -g 30 -bf 2 -c:a copy output

Parameters

I tested on ffmpeg 3.2 Hypatia.

Container: MP4

Parameter YouTube recommends setting
-movflags faststart moov atom at the front of the file (Fast Start)

Video codec: H.264

Parameter YouTube recommends setting
-profile:v high High Profile
-bf 2 2 consecutive B frames
-g 30 Closed GOP. GOP of half the frame rate.
-coder 1 CABAC
-pix_fmt yuv420p Chroma subsampling: 4:2:0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment