NVENC (HW) H264 native encoder profile(s)

(Anders V Williams) #1

First of all a shout out to Will_Tschumy for the work on the H265 NVENC constant quality encoder profile.

I have been toying around with some profiles and wanted to recreate a H264 native ffmpeg encoder profile for the types of shows/events where I want faster trans-coding than the H265 one can offer or if I want to prepare files for devices not yet equipped with a H265 decoder.

It was super easy once I had slept a little and focused, this is a straight copy of the original H265 profile reworked with the syntax for H264 instead, quality set to 27 in my default setup, but can easily be changed to whatever others might prefer depending on what it is needed for. (Was reminded that the quality setting for H264 is different than for H265)

I have done nothing with the fallback to Handbrake for now, as you can see it would fall back to the basic X265 encoder originally set by Will_Tschumy for the original profile.

Next up I will be working on making similar profiles with constant bitrates for other purposes.

[MKV H264 NVENC Constant Quality]
Description=nVidia H264 NVENC Constant quality, varible bitrate
order=ffmpeg, handbrake
AllowH264CopyRemuxing=true
FixedResolution=true
AutoDeinterlace=true
ffmpeg-UsingHardwareEncoding=True
ffmpeg-general=-threads 0 -hwaccel auto
ffmpeg-video=-ss 9 -c:v h264_nvenc -cq 27 -rc vbr -map 0:v
ffmpeg-audio=-acodec libfdk_aac -ab 128k  -map 0:a
ffmpeg-audioac3=-acodec libfdk_aac -ab 320k  -map 0:a
ffmpeg-ext=.mkv
ffmpeg-audiodelay=skip
handbrake-UsingHardwareEncoding=true
handbrake-general=--decomb --denoise="weak" --loose-anamorphic --verbose=2 -T -O
handbrake-video=--start-at duration:3 -e x265 -q 18 
handbrake-audio=-E ffac3 -R auto -B 192 -D 0 -a 1,2,3,4,5
handbrake-audioac3=-E ffac3 -R auto -B 384 -D 0 -a 1,2,3,4,5
handbrake-ext=.mkv
handbrake-audiodelay=skip
PreConversionCommercialRemover=true
(Will Tschumy) #2

What does the log file say when it fails back?

Also, if you run handbrake, you’re able to use the nvenc selections?

And thanks for the shoutout :slight_smile:

(Anders V Williams) #3

Hey man my pleasure, you did the hard work on 265 codec profile, so when fallback’s happen it is just because I can’t do syntax proper :slight_smile:

However I have been playing with HandbrakCli and NVENC the last couple of hours, and the results are quite good, will post some profile options later on when I have gotten the audio options to work the way I want them.

(Anders V Williams) #4

Hey, got some testing done the last two days, this profile works quite well the updated HandbrakeCli

I prefer my audio not being re-encoded in any way and let my Onkyo receiver handle the decoding and if there is any need for transcoding on other devices audio does not cost more than 1-2 % CPU utilization.

[Handbrake Cli 1.2.0 H264 Testing]
Description=nVidia HEVC (H264) Constant Quality
order=handbrake
FixedResolution=true
PreConversionCommercialRemover=false
UniversalCommercialRemover=false
handbrake-general=--loose-anamorphic --comb-detect=fast --decomb=mode=7 --verbose=2 --format av_mkv --subtitle 1,2,3
handbrake-video=--start-at duration:0 --encoder nvenc_h264 --encoder-preset medium --encoder-level 4.1 --quality 25 --vfr
handbrake-audio=--aencoder copy:aac --audio 1,2,3
handbrake-audioac3=--aencoder copy:ac3 --audio 1,2,3
handbrake-ext=.mkv
handbrake-audiodelay=skip

Almost identical profile for H265

[Handbrake Cli 1.2.0 H265 Quality Testing]
Description=nVidia HEVC (H265) Quality Setting
order=handbrake
FixedResolution=true
PreConversionCommercialRemover=false
UniversalCommercialRemover=false
handbrake-general=--loose-anamorphic --comb-detect=fast --decomb=mode=7 --verbose=2 --format av_mkv --subtitle 1,2,3
handbrake-video=--start-at duration:0 --encoder nvenc_h265 --encoder-preset medium --encoder-level 4.1 --quality 28 --vfr
handbrake-audio=--aencoder copy:aac --audio 1,2,3
handbrake-audioac3=--aencoder copy:ac3 --audio 1,2,3
handbrake-ext=.mkv
handbrake-audiodelay=skip
(Goose) #5

Nice! You may want to consider setting flags in your custom profile if you’ve optimized the profile and don’t want MCEBuddy to adjust certain parameters. Check out these flags:

Handbrake-AudioOptimized=true
Handbrake-VideoOptimized=true
Handbrake-UsingHardwareEncoding=true

See this topic for more details on how these flags work.