Page 1 of 3


Posted: Thu Nov 16, 2017 1:57 pm
by DJX
It appears that FFmpeg got NVDEC hardware acceleration on 11/11/17: ... 10777.html

It would be awesome to see this library added to the Windows builds.


Posted: Thu Nov 16, 2017 2:09 pm
by DJX
It was also updated a few times this week and now supports H.264, HEVC, VC1 and VP9: ... 11139.html

So this is even more useful now.


Posted: Fri Nov 17, 2017 2:51 am
by hydra3333
Thanks !
This commit also changes the Libav code to dynamic loading of the cuda/cuvid libraries.
Great !

@DJX would you have an example commandline showing how to use it (assuming one has the latest CUDA installed at runtime, of course) ?

Hmm, I wonder, does it mean that nvidia CUDA toolkit has to be installed at ffmpeg build-time for it to be enabled ?
I use a variation of rdp's cross-compile build script and installing that Windows exe toolkit on linux is currently either non-trivial or impossible, so can't currently build with cuda. I suppose I could start using the windows based however I'd prefer the rdp based ffmpeg build suite.

Also, I wonder if Zeranoe's builds will incorporate this ?


Posted: Fri Nov 17, 2017 3:17 pm
by red5goahead
I've tested hwaccel with nvdec

ffmpeg.exe -y -loglevel info -c:v h264_cuvid -hwaccel nvdec -deint adaptive -resize 1920x1080 -i "[myH264_1080i.ts]" -c:v h264_nvenc -cbr true -b:v 5M -c:a aac -b:a 128k "[myresult.mp4]"

it work but no de-interlace (resize, crop is working ). I've tested also with -hwaccel cudiv

note: -hwaccel dxva2 crash ffmpeg


Posted: Fri Nov 17, 2017 11:11 pm
by hydra3333
thank you very much !

i suppose vf_scale_cuda could be used for gpu resizing if ffmpeg is built with cuda toolkit and it's installed at runtime.

i just tried to install the latest cuda 9 toolkit 9.176 on win10x64 with the latest vs2017 updated and the cuda install fails since nvidia's cuda toolkit installer doesn't recognise the very latest vs2017 (I was aiming to have a go at jb's ffmpeg windows based build toolkit); i guess waiting for nvidia to fix it is the only option. why jb's ? couldn't manage to fund a way to cross-compile with it viewtopic.php?f=5&t=5109


now I'm confused :( and very likely out of date.

Code: Select all

Decoder h264_cuvid [Nvidia CUVID H264 decoder]:
    General capabilities: delay
    Threading capabilities: none
    Supported pixel formats: cuda nv12 p010le p016le
h264_cuvid AVOptions:
  -deint             <int>        .D.V.... Set deinterlacing mode (from 0 to 2) (default weave)
     weave                        .D.V.... Weave deinterlacing (do nothing)
     bob                          .D.V.... Bob deinterlacing
     adaptive                     .D.V.... Adaptive deinterlacing
  -gpu               <string>     .D.V.... GPU to be used for decoding
  -surfaces          <int>        .D.V.... Maximum surfaces to be used for decoding (from 0 to INT_MAX) (default 25)
  -drop_second_field <boolean>    .D.V.... Drop second field when deinterlacing (default false)
  -crop              <string>     .D.V.... Crop (top)x(bottom)x(left)x(right)
  -resize            <string>     .D.V.... Resize (width)x(height)
you did have "-resize" and there used to be a "vf_scale_cuda" which was available only if you built ffmpeg with the cuda toolkit.

I wonder if "-resize" has somehow superseded vf_scale_cuda.


Posted: Fri Nov 17, 2017 11:57 pm
by red5goahead
I'm writing a script/executable

here in github ... er-Encoder

to use with my HDBit encoder. Hw decode and encode both would be a bless. nvidia encoder seems work well although there are no constant rate factor for this encoding method with nvidia (an asus gtx 1050 ti in my case)

the hardware de-interlace is the last step


Posted: Sat Nov 18, 2017 10:50 am
by red5goahead
hydra3333 wrote:
Fri Nov 17, 2017 11:11 pm
i just tried to install the latest cuda 9 toolkit 9.176 on win10x64
I tried to install the Cuda run-time from the network installation cuda_9.0.176_win10_network but it seems that it requires or attempts to replace the last drivers for Windows 10 with a previous one


Posted: Mon Nov 27, 2017 7:05 pm
by DJX
As of today (11/27), NVDEC now supports all of the following:
H.264, HEVC, MPEG-1/2/4, VC1, VP8/9

Source: ... 11379.html


Posted: Tue Nov 28, 2017 2:55 pm
by red5goahead
Can anyone confirm that Nvdec is slower than cuvid? I tried several encoding using nvenc and h. 264 contextual decoding using cuvid and this nvdec, and found cuvid much faster.


Posted: Wed Nov 29, 2017 11:50 am
by red5goahead
the difference among 23 nov and 28 nov release is that a new hwaccels option in bold