NVidia NVENC Support

Archive of historical feature requests.
Please use the GitHub link above to report issues.
Forum rules
*******************************
Please be aware we are now using GitHub for issue tracking and feature requests.
- This section of the forum is now closed to new topics.

*******************************
Post Reply
arrmo
Posts: 28
Joined: Tue Jan 10, 2012 1:59 am

NVidia NVENC Support

Post by arrmo »

Hi,

I see that QuickSync is supported - that's great. Any thoughts about including support for NVENC (not CUDA, the newer NVENC (SDK))? Like in the Maxwell GPUs.

Thanks!
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: NVidia NVENC Support

Post by mduell »

Doubt it, Intel is the leader here and I don't think there's much interest in implementing 3 different hw encoders on 3 different platforms given that we're currently at 1 on 1.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: NVidia NVENC Support

Post by JohnAStebbins »

If/when libav adds nvenc encoding support, would be a good time to re-evaluate this request. At that point, it would be "easy" and could be auto-detected and enabled at run time. TBH, I really wish HandBrake didn't have QSV code either. I would much rather this was in libav. Hopefully we can make this happen eventually.
arrmo
Posts: 28
Joined: Tue Jan 10, 2012 1:59 am

Re: NVidia NVENC Support

Post by arrmo »

Makes sense, very much appreciate the quick response! Is there any way to "encourage" libav to add this?

Thanks!
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: NVidia NVENC Support

Post by mduell »

Start writing code.
arrmo
Posts: 28
Joined: Tue Jan 10, 2012 1:59 am

Re: NVidia NVENC Support

Post by arrmo »

I actually like that answer ... ;). I'm trying to get the NVENC SDK samples working, but having issues. Digging in to it though!
Djfe
Bright Spark User
Posts: 178
Joined: Tue May 13, 2014 8:01 pm

Re: NVidia NVENC Support

Post by Djfe »

The thing is: the quicksync code was committed by Intel and others.
The devs around here don't have much motivation to add further hw encoders because it's time consuming and doesn't make the encode faster/better for most people (Quicksync provides the best encoder so far, according to what i read here)

Nvenc and the amd equivalent have been made for live-streaming and stuff -> their purpose is to encode fast (the quality isn't that important)
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: NVidia NVENC Support

Post by s55 »

Any contributions of this nature are better directed at libav.

That doesn't mean they'll be included in HandBrake, but it makes it easier to do if we did choose to. It also opens things up to other projects based on libav.
arrmo
Posts: 28
Joined: Tue Jan 10, 2012 1:59 am

Re: NVidia NVENC Support

Post by arrmo »

Yep, agreed. FYI, working on ffmpeg code right now, only because they support nvenc now in their master branch. It works, but slower than I get with the NVIDIA samples (from the SDK).

To the comment above - there are several profiles that can be used, trading off speed vs. quality.

Thanks!
Djfe
Bright Spark User
Posts: 178
Joined: Tue May 13, 2014 8:01 pm

Re: NVidia NVENC Support

Post by Djfe »

I know, but according to some comments on here only Quicksync has a profile where it is faster with a comparable Quality (comparable to handbrake itself), all other encoders are faster in general but offer less quality overall
arrmo
Posts: 28
Joined: Tue Jan 10, 2012 1:59 am

Re: NVidia NVENC Support

Post by arrmo »

Hi,

Agree with you - I admit, in my case I'm willing to give up a little bit of quality, to offload the CPU ... if it works of course ... ;-).

Thanks!
JackNF
Enlightened
Posts: 114
Joined: Fri Feb 06, 2009 4:59 pm

Re: NVidia NVENC Support

Post by JackNF »

As an owner of a shiny new GTX 960 I'd be very interested in seeing this added, but realistically I doubt it'll happen any time soon (if ever) for reasons others have already stated above.

I'd really just like to dig up SOMETHING to do my own comparison tests of NVENC vs x264 and x265, but the only software I've been able to find that claims (beta) NVENC support for converting video files instead of realtime desktop recording has some crapware in the installer that I somehow missed unchecking (that's on me for not paying enough attention, but still bloody annoying nonetheless) and has such a nightmare of a GUI that I gave up long before actually figuring out how to run even just one test encode with it.

I mostly just want to check out the h.265 encoder that was added to '2nd-Gen' Maxwell GPUs like my 960. x265 is IMO barely usable on my CPU even at its fastest settings, so if I've got a hardware encoder just sitting here that might offer 'good enough' quality at much faster encoding speeds then that definitely piques my interest. But that's just me, and unless a developer or two wind up in the same boat and get coding like the wind then I'm not holding my breathe on seeing Handbrake be the tool I eventually get to try it out with.
arrmo
Posts: 28
Joined: Tue Jan 10, 2012 1:59 am

Re: NVidia NVENC Support

Post by arrmo »

Hi,

Have you tried to compile the samples inside the NVENC SDK? No crapware in there, and it does show you what the hardware is capable of.

Just a thought.
wolfrick
Posts: 7
Joined: Fri Nov 21, 2014 3:00 am

Re: NVidia NVENC Support

Post by wolfrick »

Hi All,

I also would like to see support for NVENC. I too have the GTX 960 and been using a compile of the Nvidia encoder. The "game" streaming encoding is an feature of this card but my main view is quality x265 encoding.

I have been trying: "NVEncC by rigaya - NVIDIA GPU encoding" I have been able to recode X264 > X265 in about <20 minutes at about 200-300fps vs Software X265 in Handbrake at 0.3fps ;)

What is very new and intriguing about the GTX 960 2nd Generation Maxwell (gm206 chipset), is the Native Hardware Encoder built into the Card. The GTX 970 and 980 (gm204 chipset) do not have this hardware encoder making it "Hybrid"... I believe the QSV is similar...

I've been reading into the SDK and find that many passing arguments are limited at the moment. I really like like to see the presets for "Placebo, VerySlow, Slow, etc..."

In addition, the GTX 960 support both X264 & X265 pure hardware driven encoding. I monitored using "openhardwaremonitor". There is a Hardware encoding engine within the card. When I ran a few samples, this was the only part of the card that pegged 99%... My 4770 cpu hovered about 25-30% as it worked in conjunction with other software to encode the final MKV...

Many are starting to see with this card released in January by Nvidia as a viable option to encode/recode x265 video. I read that the GTX 960 can support encoding 2 video streams at the same time with only a 10% penalty in encode time performance. I haven't tried this but plan to try in the near future.

Reference:
https://developer.nvidia.com/nvidia-video-codec-sdk
http://forum.videohelp.com/threads/3702 ... U-encoding

Doing a feature check of my card resulted: (Assuming "0" not supported at the moment, "1" supported, "##" quantity of supported)

Environment Info
OS : Windows 8.1 (x64)
CPU: Intel Core i7-4770 @ 3.40GHz [TB: 3.70GHz] (4C/8T)
GPU: GeForce GTX 960 (8 EU) @ 1177 MHz (347.52)
RAM: Total 16298 MB / Used 7289 MB

H.264/AVC:
Max Bframes 4
RC Modes 63
Field Encoding 1
MonoChrome 0
FMO 0
Quater-Pel MV 1
B Direct Mode 1
CABAC 1
Adaptive Transform 1
Max Temporal Layers 0
Hierarchial P Frames 0
Hierarchial B Frames 0
Max Level 51
Min Level 1
4:4:4 0
Max Width 4096
Max Height 4096
Dynamic Resolution Change 1
Dynamic Bitrate Change 1
Forced constant QP 0
Dynamic RC Mode Change 0
Subframe Readback 0
Constrained Encoding 0
Intra Refresh 1
Custom VBV Bufsize 1
Dynamic Slice Mode 1
Ref Pic Invalidiation 1
PreProcess 0
Async Encoding 1
Max MBs 65536
MAX MB per sec 983040
Lossless 1

H.265/HEVC:
Max Bframes 0
RC Modes 63
Field Encoding 0
MonoChrome 0
Quater-Pel MV 1
B Direct Mode 0
Max Temporal Layers 0
Hierarchial P Frames 0
Hierarchial B Frames 0
Max Level 62
Min Level 1
4:4:4 0
Max Width 4096
Max Height 4096
Dynamic Resolution Change 1
Dynamic Bitrate Change 1
Forced constant QP 0
Dynamic RC Mode Change 0
Subframe Readback 0
Constrained Encoding 1
Intra Refresh 1
Custom VBV Bufsize 1
Dynamic Slice Mode 1
Ref Pic Invalidiation 1
PreProcess 0
Async Encoding 0
Max MBs 65536
MAX MB per sec 983040
Lossless 0
Deleted User 11865

Re: NVidia NVENC Support

Post by Deleted User 11865 »

wolfrick wrote:Hi All,

I also would like to see support for NVENC. I too have the GTX 960 and been using a compile of the Nvidia encoder. The "game" streaming encoding is an feature of this card but my main view is quality x265 encoding.
x264 and x265 are software encoders, not video formats. The corresponding formats are H.264 (also know as AVC) and H.265 (HEVC), respectively.

If libav gains NVENC (or AMD VCE) support and we have a way to test it, I'll gladly add support to HandBrake. I don't think we want yet another native encoder wrapper, especially if it's encode-only.
wolfrick
Posts: 7
Joined: Fri Nov 21, 2014 3:00 am

Re: NVidia NVENC Support

Post by wolfrick »

I have been able to confirm the GTX 960 can encode 2 video streams at the same time.. I tried to start a 3rd instance and it failed... From my research, the new Tesla / High end Quadro will support more than 2 streams however not on the market now ;)

2 streams at same time run at about 9 minutes each to complete. 3rd stream fails to start...
1 stream alone run at about 8 minutes 45 seconds to complete.

Video source used for comparison is raw 480P using a avs script to pass into the encoder.

Size and quality seem to be a bit better and small file size compared to QSV. Reading under the x265 site, the HEVC/H265 format should yield the equivalent AVC/H264 bitrate at 6 Constant Quality Levels apart: Example: H264 CP 23 >> H265 CP 29... My examples were done at the H264 Placebo settings at 14/17/19 equivalent...




Data:


2 streams encode at the same time:
(1st stream ~ 9 minutes to complete)

Code: Select all

D:\>"D:\staxstax\Applications\NVEncC\NVEncC.exe" -c h265 --profile high --ref 16
 --lossless --mv-precision Q-pel -i "D:\RAW\6_DAYS_7_NIGHTS\VIDEO_TS\VTS_01_1.av
s" -o "D:\6d7n.h265"--y4m
D:\RAW\6_DAYS_7_NIGHTS\VIDEO_TS\VTS_01_1.avs
B?????????0???
NVEnc 1.01 (x86), using NVENC API v5.0
OS ?????           Windows 8.1 (x64)
CPU                     Intel Core i7-4770 @ 3.40GHz [TB: 3.70GHz] (4C/8T)
GPU                     GeForce GTX 960 (8 EU) @ 1177 MHz (347.52)
??????????    CUDA, 16 frames
????????        Avisynth 2.58 (yv12) -> nv12 [AVX2], 704x272, 24000/1001 fps
??????            H.265/HEVC main
                        704x272p 1:1 23.976fps (24000/1001fps)
????????        CQP - ??????
CQP?                   I:20  P:23  B:25
GOP?                   240 frames
??B?????         0 frames
????                16 frames
????????        1/4????

encoded 163266 frames, 302.94 fps, 1451.00 kbps, 1177.87 MB
encode time 0:08:59 / CPU Usage: 12.42%

frame type IDR    681
frame type I      681,  avgQP  20.00,  total size    14.60 MB
frame type P   162585,  avgQP  23.00,  total size  1163.27 MB
(2nd stream ~9 minutes to complete)

Code: Select all

D:\>"D:\staxstax\Applications\NVEncC\NVEncC.exe" -c h265 --profile high --ref 16
 --lossless --mv-precision Q-pel -i "D:\RAW\6_DAYS_7_NIGHTS\VIDEO_TS\VTS_01_1.av
s" -o "D:\6d7n-2.h265"--y4m
D:\RAW\6_DAYS_7_NIGHTS\VIDEO_TS\VTS_01_1.avs
B?????????0???
NVEnc 1.01 (x86), using NVENC API v5.0
OS ?????           Windows 8.1 (x64)
CPU                     Intel Core i7-4770 @ 3.40GHz [TB: 3.80GHz] (4C/8T)
GPU                     GeForce GTX 960 (8 EU) @ 1177 MHz (347.52)
??????????    CUDA, 16 frames
????????        Avisynth 2.58 (yv12) -> nv12 [AVX2], 704x272, 24000/1001 fps
??????            H.265/HEVC main
                        704x272p 1:1 23.976fps (24000/1001fps)
????????        CQP - ??????
CQP?                   I:20  P:23  B:25
GOP?                   240 frames
??B?????         0 frames
????                16 frames
????????        1/4????

encoded 163266 frames, 300.55 fps, 1451.00 kbps, 1177.87 MB
encode time 0:09:03 / CPU Usage: 12.44%

frame type IDR    681
frame type I      681,  avgQP  20.00,  total size    14.60 MB
frame type P   162585,  avgQP  23.00,  total size  1163.27 MB

D:\>
(3rd stream) :(

Code: Select all

D:\>"D:\staxstax\Applications\NVEncC\NVEncC.exe" -c h265 --profile high --ref 16
 --lossless --mv-precision Q-pel -i "D:\RAW\6_DAYS_7_NIGHTS\VIDEO_TS\VTS_01_1.av
s" -o "D:\6d7n-3.h265"--y4m
m_pEncodeAPI->nvEncOpenEncodeSessionEx????????: 10
  NVENC indicates that the API call failed because it was unable to allocate eno
ugh memory to perform the requested operation.
?????????????????????NVEnc?3???????????????????????????????

Solo Encode stream:

Code: Select all

D:\>"D:\staxstax\Applications\NVEncC\NVEncC.exe" -c h265 --profile high --ref 16
 --lossless --mv-precision Q-pel -i "D:\RAW\6_DAYS_7_NIGHTS\VIDEO_TS\VTS_01_1.av
s" -o "D:\6d7n-2.h265"--y4m
D:\RAW\6_DAYS_7_NIGHTS\VIDEO_TS\VTS_01_1.avs
B?????????0???
NVEnc 1.01 (x86), using NVENC API v5.0
OS ?????           Windows 8.1 (x64)
CPU                     Intel Core i7-4770 @ 3.40GHz [TB: 3.70GHz] (4C/8T)
GPU                     GeForce GTX 960 (8 EU) @ 1177 MHz (347.52)
??????????    CUDA, 16 frames
????????        Avisynth 2.58 (yv12) -> nv12 [AVX2], 704x272, 24000/1001 fps
??????            H.265/HEVC main
                        704x272p 1:1 23.976fps (24000/1001fps)
????????        CQP - ??????
CQP?                   I:20  P:23  B:25
GOP?                   240 frames
??B?????         0 frames
????                16 frames
????????        1/4????

encoded 163266 frames, 312.40 fps, 1451.00 kbps, 1177.87 MB
encode time 0:08:43 / CPU Usage: 12.45%

frame type IDR    681
frame type I      681,  avgQP  20.00,  total size    14.60 MB
frame type P   162585,  avgQP  23.00,  total size  1163.27 MB
wolfrick
Posts: 7
Joined: Fri Nov 21, 2014 3:00 am

Re: NVidia NVENC Support

Post by wolfrick »

Rodeo wrote:
wolfrick wrote:Hi All,

I also would like to see support for NVENC. I too have the GTX 960 and been using a compile of the Nvidia encoder. The "game" streaming encoding is an feature of this card but my main view is quality x265 encoding.
x264 and x265 are software encoders, not video formats. The corresponding formats are H.264 (also know as AVC) and H.265 (HEVC), respectively.

If libav gains NVENC (or AMD VCE) support and we have a way to test it, I'll gladly add support to HandBrake. I don't think we want yet another native encoder wrapper, especially if it's encode-only.
Sorry I missed the format... I have been reading a lot lately and trying to understand... the X265 "software version" site has a lot of information regarding the H.265 format... :shock:

I hope the introduction of the GTX 960 starts a wave of new H.265 encoding capabilities... I did a search and it seems to be looked at for libav... But I am not an expert like you guys... I could be mistaken... :?

Thank you...
Djfe
Bright Spark User
Posts: 178
Joined: Tue May 13, 2014 8:01 pm

Re: NVidia NVENC Support

Post by Djfe »

Is this code working already? :
http://ffmpeg.org/doxygen/trunk/nvenc_8c_source.html
Or are they still working on it?
(didn't find anything about the status)
Deleted User 11865

Re: NVidia NVENC Support

Post by Deleted User 11865 »

No idea, as I have to way to test it :)
arrmo
Posts: 28
Joined: Tue Jan 10, 2012 1:59 am

Re: NVidia NVENC Support

Post by arrmo »

Hi,

FYI, I have built the latest version of ffmpeg, with NVENC support - it's functional, but still quite slow. Some work to be done yet it seems.

Thanks!
Djfe
Bright Spark User
Posts: 178
Joined: Tue May 13, 2014 8:01 pm

Re: NVidia NVENC Support

Post by Djfe »

Also just found this, so they are working on it:
https://ffmpeg.org/pipermail/ffmpeg-dev ... 66745.html
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: NVidia NVENC Support

Post by s55 »

There are some licensing issues around NVENC.
I believe what is currently in ffmpeg is non-free, so it can't be included in HandBrake.

Time will tell if this changes, of if it's due to the underlying lib's it's calling.

Not sure what Libav is doing on this.
wolfrick
Posts: 7
Joined: Fri Nov 21, 2014 3:00 am

Re: NVidia NVENC Support

Post by wolfrick »

FFMPEG has release version 2.6 with NVENC support built in. Is it possible to see if find a way into Handbrake? :wink:

http://git.videolan.org/?p=ffmpeg.git;a ... elease/2.6

I am hoping to try out my GTX 960 with Handbrake full hardware encoding... I've been trying with Staxrip with 50/50 results...

Thank you...
Deleted User 11865

Re: NVidia NVENC Support

Post by Deleted User 11865 »

wolfrick wrote:FFMPEG has release version 2.6 with NVENC support built in. Is it possible to see if find a way into Handbrake? :wink:

http://git.videolan.org/?p=ffmpeg.git;a ... elease/2.6
No. The NVENC implementation in FFmpeg 2.6 is NOT GPL-compatible, which means:

- it's not built by default;

- builds of libavcodec with this NVENC module enabled are not GPL-compatible;

- builds of libavcodec with this NVENC module enabled cannot be used in HandBrake;

- builds of libavcodec with this NVENC module enabled cannot be legally distributed at all…
wolfrick
Posts: 7
Joined: Fri Nov 21, 2014 3:00 am

Re: NVidia NVENC Support

Post by wolfrick »

Thanks Rodeo... kind of sucks then... The encoder engine itself is quite efficient and fast... the front-end to tune the encode is really lacking at the moment... Newer video encodes very well but older stuff with defects, dust, grain, etc... doesn't seem to encode very well giving random artifacts sometimes during transitions... I am unable to determine the cause yet without finding other front end software...

Thank you...
Post Reply