2

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.

3

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.

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.