FFMPEG | MP4 command line for Youtube. (2017)

Questions involving a Windows version of FFmpeg.
Post Reply
Hero
Posts: 7
Joined: Thu Feb 19, 2015 2:00 pm

FFMPEG | MP4 command line for Youtube. (2017)

Post by Hero » Fri Mar 10, 2017 10:48 am

Found that thread from 2015 viewtopic.php?f=7&t=2318

Same question today. Need an actual command line for Youtube using FFmpeg including all possible options including framerate 30 and keyframes all 15 frames. That correct for stereo?

Code: Select all

ffmpeg -i <input.filename.ext> -codec:v libx264 -crf 21 -bf 2 -flags +cgop -pix_fmt yuv420p -codec:a aac -strict -2 -b:a 384k -r:a 48000 -r 30 -force_key_frames 15 -movflags +faststart <output.filename.>.mp4
What about clips without any audio? How can I adjust bitrate for 720p or 1080p?

llogan
Posts: 331
Joined: Fri Mar 14, 2014 3:29 am

Re: FFMPEG | MP4 command line for Youtube. (2017)

Post by llogan » Fri Mar 10, 2017 7:32 pm

No need for a bunch of specialized options: YouTube isn't very picky about what you give it. Either upload the original file, or if that doesn't work or is too big then re-encode it:

Code: Select all

ffmpeg -i input -c:v libx264 -crf 18 -c:a aac -b:a 192k -ac 2 output.mp4
YouTube will re-encode whatever you give it, so -crf 18 will provide a high quality output.

See https://trac.ffmpeg.org/wiki/Encode/H.264

AlcyonaHaramix
Posts: 3
Joined: Sat Jun 18, 2016 11:44 am

Re: FFMPEG | MP4 command line for Youtube. (2017)

Post by AlcyonaHaramix » Mon Mar 13, 2017 11:34 am

also... try this... (if your CPU supports Intel QSV -> aka [-c:v h264_qsv] that is)

,

Code: Select all


\ffmpeg.exe -i input_file_itself.mp4 -loglevel debug -pix_fmt nv12 -c:v h264_qsv -async_depth 8 -avbr_accuracy 0 -avbr_convergence 0 -preset veryslow -vcm 0 -bitrate_limit 1 -cavlc 0 -idr_interval 0 -pic_timing_sei 1 -max_dec_frame_buffering 0 -look_ahead 1 -look_ahead_depth 100 -look_ahead_downsampling off -trellis:v P -profile:v high -b:v 3834000 -g 74 -bf 2 -slices 1 -refs 3 -b_strategy 1 -flags +cgop -a53cc 0 -minrate 3834000 -bufsize 4474111 -sample_fmt s16p -compression_level 10 -c:a libmp3lame -b:a 160000 -ar 44100 -ac 2 -joint_stereo false -reservoir true -abr false -y output_file_itself.mp4

,

the above ffmpeg command... executes QSV engine (libmfx 1.17) ... with the following options...

,

Code: Select all


[h264_qsv @ 000000000067a9e0] Initialized an internal MFX session using hardware accelerated implementation

[h264_qsv @ 000000000067a9e0] Using the VBR with lookahead (LA) ratecontrol method

[h264_qsv @ 000000000067a9e0] profile: high; level: 30

[h264_qsv @ 000000000067a9e0] GopPicSize: 74; GopRefDist: 3; GopOptFlag: closed; IdrInterval: 0

[h264_qsv @ 000000000067a9e0] TargetUsage: 1; RateControlMethod: LA

[h264_qsv @ 000000000067a9e0] TargetKbps: 3834; LookAheadDepth: 100

[h264_qsv @ 000000000067a9e0] NumSlice: 1; NumRefFrame: 3

[h264_qsv @ 000000000067a9e0] RateDistortionOpt: OFF

[h264_qsv @ 000000000067a9e0] RecoveryPointSEI: OFF; IntRefType: 0; IntRefCycleSize: 0; IntRefQPDelta: 0

[h264_qsv @ 000000000067a9e0] MaxFrameSize: 176640; MaxSliceSize: 0

[h264_qsv @ 000000000067a9e0] BitrateLimit: ON; MBBRC: OFF; ExtBRC: unknown

[h264_qsv @ 000000000067a9e0] Trellis: P

[h264_qsv @ 000000000067a9e0] RepeatPPS: ON; NumMbPerSlice: 0; LookAheadDS: off

[h264_qsv @ 000000000067a9e0] AdaptiveI: unknown; AdaptiveB: unknown; BRefType: pyramid

[h264_qsv @ 000000000067a9e0] MinQPI: 0; MaxQPI: 0; MinQPP: 0; MaxQPP: 0; MinQPB: 0; MaxQPB: 0

[h264_qsv @ 000000000067a9e0] Entropy coding: CABAC; MaxDecFrameBuffering: 3

[h264_qsv @ 000000000067a9e0] NalHrdConformance: OFF; SingleSeiNalUnit: ON; VuiVclHrdParameters: OFF; VuiNalHrdParameters: OFF

,

!! (HTH) !! > (hope this helpes)

,

Post Reply