FFMPEG with h264_nvenc encoder

Questions involving a Windows version of FFmpeg.
Post Reply
Posts: 1
Joined: Fri Feb 22, 2019 8:25 am

FFMPEG with h264_nvenc encoder

Post by deimantaslt » Fri Feb 22, 2019 8:31 am

maybe someone can help me to tweak this command bellow to reach balance between quality and speed using GPU acceleration?

Code: Select all

ffmpeg -y -hwaccel cuvid -i input.mxf \
-filter_complex "[0:v]format=yuv420p, yadif, split=3[s0][s1][s2]; [s0]scale=1920:1080:flags=fast_bilinear[v0]; [s1]scale=1280:720:flags=fast_bilinear[v1]; [s2]scale=1024:576:flags=fast_bilinear[v2]; [0:a]amerge=inputs=2,pan=stereo|c0<c0+c2|c1<c1+c3[a]" \
-map "[v0]" -map "[v1]" -map "[v2]" -map "[a]" \
-c:v h264_nvenc -gpu 0 -preset llhq -framerate 25 -aspect 16:9 -rc vbr_hq -level 4.1 -forced-idr 1 -force_key_frames "expr:gte(t,n_forced*10)" -c:a aac -b:a 192K \
-b:v:0 5M -maxrate:v:0 5.3M -bufsize:v:0 7.5M \
-b:v:1 2.8M -maxrate:v:1 3M -bufsize:v:1 4.2M \
-b:v:2 1.4M -maxrate:v:2 1.5M -bufsize:v:2 2.1M \
-f tee "[select=\'v:0,a\']Output_1080.mp4|[select=\'v:1,a\']Output_720.mp4|[select=\'v:2,a\']Output_576.mp4"
Sincerely Deimantas.

Posts: 252
Joined: Mon Feb 24, 2014 1:46 pm

Re: FFMPEG with h264_nvenc encoder

Post by pandy » Fri Mar 01, 2019 7:59 pm

Have no NVEnc HW but bellow one was confirmed to work.

Code: Select all

@rem video quality settings
@set vq=24
@rem audio bitrate
@set ab=192

@set aproc="pan=stereo|FL < FL+1.414FC+0.5BL+0.5SL+0.25LFE|FR < FR+1.414FC+0.5BR+0.5SR+0.25LFE,dynaudnorm=p=1/sqrt(2):m=100:s=20"
@set vproc="pp=ac,delogo=x=%xx%:y=%yy%:w=%ww%:h=%hh%,scale=iw:ih:sws_flags=spline+accurate_rnd+full_chroma_int+full_chroma_inp:interl=-1:out_range=auto:out_color_matrix=bt709,format=pix_fmts=yuv420p"

@ffmpeg.exe -hide_banner -v 32 -stats -y -i "%filename%" -vf %vproc% -c:v h264_nvenc -level:v 4.0 -preset:v hq -profile:v high -cq %vq% -qmin:v 8 -qmax:v 29 -bufsize:v 10000k -maxrate:v 20000k -g 250 -bf 3 -refs:v 3 -rc:v vbr_hq -rc-lookahead 32 -b_adapt 1 -temporal-aq 1 -spatial-aq 1 -i_qfactor 0.75 -b_qfactor 1.1 -coder:v cabac -bluray-compat 1 -aud 1 -aq-strength 8 -af %aproc% -c:a ac3 -b:a %ab%k "%~n1_delogdaudnv.mkv"
feel free to modify

Posts: 2
Joined: Fri Mar 08, 2019 9:02 am

Re: FFMPEG with h264_nvenc encoder

Post by Sharc » Fri Mar 08, 2019 9:10 am

Can anyone tell me what "-preset bd" actually does? I understand it is a preset for Blu-ray. What other ffmpeg parameters does it set or overwrite? Does it automatically include -bluray-compat 1, or do I have to set this still explicitly?

Post Reply