3

I just read Recommended upload encoding settings article from official google support. I think this is the best settings for encoding my youtube videos.

Can you help me find out how to encode that settings in ffmpeg for 720p or 1080p videos?

Here's the settings

enter image description here

Thanks in advance.

4

Use

ffmpeg -i in.mp4 -vf yadif,format=yuv420p -force_key_frames expr:gte(t\,n_forced/2) -c:v libx264 -crf 18 -bf 2 -c:a aac -q:a 1 -ac 2 -ar 48000 -use_editlist 0 -movflags +faststart out.mp4

-vf specifies video filters

yadif will deinterlace videos if they're interlaced.

format=yuv420p will produce pixel format with 4:2:0 chroma subsampling.

-force_key_frames expr:gte(t\,n_forced/2) will place keyframes every half-second, so that will be the GOP size.

-c:v libx264 will use the x264 encoder to produce a H264 video stream.

-crf 18 will produce a visually lossless file. Better than setting a bitrate manually.

-bf 2 will limit consecutive B-frames to 2

-c:a aac will use the native encoder to produce an AAC audio stream.

-q:a 1 sets the highest quality for the audio. Better than setting a bitrate manually.

-ac 2 rematrixes audio to stereo.

-ar 48000 resamples audio to 48000 Hz.

-use_editlist 0 avoids writing edit lists.

-movflags +faststart places moov atom/box at front of the output file.

  • I believe you wrote this answer using this Recommended Upload Settings as reference. Here's the command for Content ID Partners: ffmpeg -i in.mp4 -vf yadif,format=yuv422p -force_key_frames expr:gte(t\,n_forced/2) -c:v libx264 -b:v <60M for 1080, 50M for 720, 15M for SD> -bf 2 -c:a flac -ac 2 -ar 44100 -use_editlist 0 -movflags +faststart out.mp4. – MCCCS Aug 5 at 15:16
  • Any idea how I can run this on fish shell where parentheses (t\,n_forced/2) are interpreted as a command? – andrewgazelka Nov 15 at 6:36
  • Enclose expr:gte(t\,n_forced/2) in single or double quotes, I guess – Gyan Nov 15 at 6:55
0

Using expr:gte\(t\,n_forced/2\) worked for me. (Escape the parenthesis as well as the comma).

New contributor
Taylor is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.