Skip to content

Nvenc encoder is not supported yet! #259

Closed

Description

@liufeihong

ffmpeg has supported GPU acceleration,including nvenc(Nvidia) and QSV(Intel ), but the current version of HandBrake doesn't support nvenc, and it can't support QSV very well. Please add the function as soon as possible.

Activity

  1. sr55 commented on Jul 12, 2016

    @sr55
    Contributor

    First, we don't use ffmpeg. We use libav and NVEnc hasn't hit a public release of libav yet.
    We have no plans to add NVENC. Patches welcome although we won't work on this ourselves.

    We already have QSV and it works fine. What do you think is wrong with it? Functionality wise, even if we used the libav wrapper, there wouldn't be any functioality changes.

    AMD VCE will possibally be added in the not so distant future. (assuming that the patch every hits libav isn't abandonded. )

  2. added this to the Unscheduled milestone on Jul 12, 2016
  3. liufeihong commented on Jul 15, 2016

    @liufeihong
    Author

    Thanks your reply, but I found that libav has add H.264 & HEVC Encoders For NVIDIA's NVENC, please refer to the offical website: https://wiki.libav.org/Encoding/h264
    Libav configuration
    ./configure --enable-nvenc --enable-cuda --enable-nonfree

  4. sr55 commented on Jul 15, 2016

    @sr55
    Contributor

    It's not in the release that we use. Not that it matters.

    It's also non free so we can't add this implementation as its not GPL compatible

    Edit: Might be free if filters are disabled.
    Either way, anyone producing a patch must be aware that it won't be accepted with --enable-nonfree. It must be without.

  5. marcomsousa commented on Jan 13, 2017

    @marcomsousa

    Libav 12 (released on 2016-10-18)

    • NVIDIA NVENC-accelerated H.264 and HEVC encoding support

    https://libav.org/releases/libav-12.changelog

  6. sr55 commented on Jan 14, 2017

    @sr55
    Contributor

    @marcomsousa It requires --non-free so it's a non starter. We can't publish HandBrake releases with that flag turned on.

    Edit, seems to depend on the version you use. Need to figure out if libav has the free version or not. if it does, patches will be welcomed.

  7. sr55 commented on Jan 14, 2017

    @sr55
    Contributor

    See edit ;).

    I guess we just need someone with a Nvidia card to give It a go now. Build issues aside, our libav wrapper should be reasonably easy to update.

    Edit: apparently I didn't go back to update it again. Fail.

  8. 104 remaining items

  9. sr55 commented on Aug 13, 2018

    @sr55
    Contributor

    huh, that says a 1030 isn't supported. That's a real shame.

  10. plittlefield commented on Aug 13, 2018

    @plittlefield

    Indeed, just found one second hand for 40GBP :-( I'll keep looking...

  11. plittlefield commented on Aug 13, 2018

    @plittlefield

    Yes, the 1030 has support for DECoding (HVDEC) but not ENCoding (HVENC).

    Is that ("half the job") worth having?

  12. sr55 commented on Aug 13, 2018

    @sr55
    Contributor

    Nope. HandBrake won't use Nvidia decode. No point.

  13. plittlefield commented on Sep 21, 2018

    @plittlefield

    OK, so I've bought a GTX 1050 and will be trying it soon.

    I have compiled HandBrakeCLI from the github sources with --enable-nvenc and have installed the latest Nvidia Linux drivers.

    Is there anything else I need to do?

  14. sr55 commented on Sep 21, 2018

    @sr55
    Contributor

    Install Windows ;)

    Joking aside,

    Technically, there is nothing stopping it from working under linux, but we have no developers on Linux that use / have it so it's completely untested. So just beware it's basically considered experimental.

    Would be interested to hear if it works or not and what the performance is like.

    Just specify the nvenc encoder via the -e option and your good to go once compiled.

  15. plittlefield commented on Oct 4, 2018

    @plittlefield

    Hello,

    Well, it works under Linux but the results are both surprising and disappointing at the same time.

    In a nutshell, the 'nvenc_x265' encode is blisteringly fast (about 75fps which is 75 times faster!) but the output file size is much bigger than a regular 'x265' (medium) file using the CPU.

    I am probably doing something wrong :-)

    Here are the examples.

    Command line to take the first chapter (12 minutes) of a Hugo Blu-ray MKV file...

    "/usr/local/bin/HandBrakeCLI" --input "/home/paully/Downloads/Videos/Done/Hugo (2011).mkv" --main-feature --chapters 1 --crop 0:0:0:0 --encoder nvenc_h265 --encoder-preset medium --quality 22 --audio-lang-list eng --first-audio --aencoder ac3 --ab 384 --mixdown 5point1 --output "/home/paully/Hugo (2011) hb nvenc_h265 slow 1080p ac3 cpu50.mp4"

    ...produced a 1.1GB file in 3 minutes flat... yes, 3 minutes.

    So, flipping fast but very big.

    In contrast, the whole of Hugo using the regular 'x265' encoder took 43 hours and ended up being 2.8Gb.

    The result is stunning but the wait is unbearable.

    So, where am I going wrong?

    The gritty details:-

    Ubuntu 16.04.5 LTS
    AMD FX(tm)-4350 Quad-Core Processor
    16 GB RAM
    Nvidia GTX 1050
    HandBrake 20180928205937-77fa0c7-master (compiled with latest x264 and x265 libraries)

    PS: as an aside, my HB log aoutput says...

    x265 [info]: HEVC encoder version 2.8, x265 [info]: build info [Linux][GCC 5.4.0][64 bit][noasm] bit+10bit+12bit, x265 [info]: using cpu capabilities: none!

  16. sr55 commented on Oct 4, 2018

    @sr55
    Contributor

    Note, the x265 quality scale is not the same as nvenc h265 encode, so may require some adjustment to get the same ballpark bitrate for a fair comparison.

    Also note, nvenc medium is not equivalent to x265 medium. It's very different.
    NvEnc only supports a small subset of x264/5 features. So the software encoders can do a much better job.

    For reference, in Nvidias latest release, they were saying the improvements they made to their RTX 20 series NVENC hardware, brings them up around x264 fast. The older 10 series cards are not as good. From looking at it, their 10 series h264 is reasonably mature and can do an OK job. Their h265 encoder is missing a lot of features. For example, there is no B-frame support in the HEVC encoder on the 10 series cards. (not sure about the 20 series)

    Also, the reason x265 is so slow, is because it's not using CPU optimisations. You probably compiled it without having nasm on your system, or a version that's too old. It'll get an awful lot faster with it.
    Not NVENC fast, but usable.

  17. plittlefield commented on Oct 23, 2018

    @plittlefield

    Well, I am afraid to say that I am selling back my GTX1050 to Ebay... it's not doing what I thought it would do... use the GPU to number crunch and work with HB to produce a lovely picture with a small file. The 'nvenc_x265' encoder is fast but produces pointlessly large files that don't look as good as the normal 'x265' encoder that takes days to produce what I want... so, as they say on Dragon's Den... "It's a no from me, I'm out." :-(

  18. sr55 commented on Oct 23, 2018

    @sr55
    Contributor

    I'm assuming you did play with the "encoder preset" on the video tab? Even the "slow" preset is usually faster.

    However even then, the hardware is locked in stone so there isn't much in the way of improvements aside from next-gen hardware.

    On another note, if you compile the app with x265 properly, it'll go a bit faster.

  19. tracker1 commented on Oct 24, 2018

    @tracker1

    @plittlefield the nv encoder was first and formost for live-stream feeds afaik... also, it looks like the RTX series cards have a much better encoder, but I'm not willing to pay the price of entry to find out at this point. Sticking with x265 overnight encodes for now.

  20. plittlefield commented on Oct 25, 2018

    @plittlefield

    @sr55 I've now compiled HB and all codecs (nasm, x264, x265, ffmpeg, etc) from sources with full CPU supported flags and yes, speed of transcodes and quality of picture has improved. I've written it all down in my Wiki if anyone wants it in easy step by step instructions :-)

  21. FrancisChung commented on Apr 13, 2019

    @FrancisChung

    @plittlefield : Would love to get some step by step instructions!

  22. plittlefield commented on Apr 13, 2019

    @plittlefield
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions