Announcement

Collapse
No announcement yet.

VA-API encoding

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • VA-API encoding

    I recently updated my laptop (Haswell i7 w/ i4600) to 14.04 and I was happy to get VA-API decoding working for 1080 h264. When playing back such files, CPU usage has reduced from ~10% (or 37% under 12.04!) to ~1%.

    The logical next step is to hopefully get VA-API accelerated h/x264 encoding working. A bit of searching says I should be able to use libav and/or Transmageddon (in combo with libgstreamer-vaapi) to achieve VA-API accelerated x264 encoding. Are those the only options? Is there any difference in the (perceived) picture quality or encoding speed between them?

    The Transmageddon in the 14.04 repos is rather out-of-date so I suspect I'd need to update to a newer version to get VA-API working? Would I also need to create a custom profile to enable VA-API?

    Has anyone got a working libav command to encode x264 w/ VA-API?

    What support do KDEnlive and Lightworks offer for VA-API?

    How does VA-API encoding compare to Quick Sync these days? Last I heard it was running at a fraction (less than 1/5th) of the speed.

    Finally, what is the max res. / bitrate of h264 I could encode in hardware with my i4600 GPU?

    Thank you, Intel encoding overlords!
    Last edited by danboid; 08-08-2014, 11:49 AM.

  • #2
    can't run transmageddon 1.3 under Trusty

    It seems versions 1.2 and 1.3 of Transmageddon introduced various fixes for VAAPI so it looks like I really need to be running 1.3 if I want VAAPI to work.

    I installed gstreamer1.0, gstreamer1.0-vaapi plus all the build deps listed in transmageddon INSTALL and README files but I can't get 1.3 to run under 14.04 - 0.25 ran just fine, albeit without VAAPI accel.

    I tried installing the package from here:

    https://launchpad.net/~whoopie79/+ar...+build/6191602

    With no luck and when I build it from source I get this error when I run it:

    Code:
    Traceback (most recent call last):
      File "transmageddon.py", line 141, in do_activate
        self.win = TransmageddonUI(self, source=self.source)
      File "transmageddon.py", line 320, in __init__
        self.setup_source()
      File "transmageddon.py", line 1337, in setup_source
        fileopen=theme.load_icon(Gtk.STOCK_OPEN, size, 0)
    gi._glib.GError: Icon 'gtk-open' not present in theme
    It seems Transmageddon 1.3 is already in Utopic but I'd rather not upgrade to 14.10 just yet.

    Comment


    • #3
      libavcodec - vaapi decode only

      I've just been asking about vaapi support in the libav IRC channel. Apparently avconv has no support for vaapi yet. libavcodec, however, has support for vaapi decoding but no encoding yet.

      So, it seems gstreamer / transmageddon are the only currently available options for vaapi encoding and that KDEnlive must currently only support vaapi decoding.

      Has anyone got a working gstreamer command that uses vaapi to encode h264?

      Comment


      • #4
        example VAAPI GST command

        I've not had any response from the Transmageddon dev yet re running 1.3 under Trusty but I have found an example gstreamer VAAPI command which I'll try tonight. The problem is that it is for GST 0.10 so it may not work under GST 1.0.


        Code:
        gst-launch-0.10 videotestsrc num-buffers=200 ! video/x-raw-yuv,format='(fourcc)'NV12,width=1280,height=720,framerate=30/1 ! vaapiconvert ! vah264encode ! qtmux faststart=true ! filesink location=h264.mp4
        https://gitorious.org/vaapi/gstreame...rge_requests/5

        Comment


        • #5
          I don't have clue about va-api encoding, but Transmageddon looks a bit like handbrake, which should support intel quicksync for video encoding(should be in universe repo):
          http://handbrake.fr/

          Comment


          • #6
            Intel GST 1.0 encoding examples

            I've found some more contemporary (GST-1.0) examples here:

            http://www.intel.co.uk/content/dam/w...amer-paper.pdf

            Code:
            gst-launch-1.0 filesrc blocksize=10000000 location=infile.yuv ! videoparse format=i420 height=1080 width=1920 framerate=30/1 ! vaapipostproc ! queue ! vaapiencode_h264 ! qtmux ! filesink location=test2.mp4
            tuke81:

            I don't see gsteamer1.0-vaapi listed as a (recommended) dep. for Handbrake (in Trusty or sid) so its prob safe to presume it doesn't support it yet.

            Comment


            • #7
              My tests
              Transmageddon benchmark (omx, vaapi, x264enc, mpeg4)
              http://www.gearsongallium.com/?p=1372

              Almost all videos from my youtube channel recorded with gsteamer vaapi\omx hardware encoding
              https://www.youtube.com/playlist?lis...vUQ1kZPUsVZAiE

              I made simple script and maintained some patches ( optimization of RGB > YUV conversion)
              https://github.com/pontostroy/gstreamer-screenrecording

              Comment


              • #8
                No suitable encoding plugins in Ubuntu repos

                Code:
                $ gst-launch-1.0 filesrc blocksize=10000000 location=bts.mp4 ! videoparse format=i420 height=1080 width=1920 framerate=30/1 ! vaapipostproc ! queue ! vaapiencode_h264 ! qtmux ! filesink location=test2.mp4
                libva info: VA-API version 0.35.0
                libva info: va_getDriverName() returns 0
                libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
                libva info: Found init function __vaDriverInit_0_35
                libva info: va_openDriver() returns 0
                WARNING: erroneous pipeline: no element "vaapiencode_h264"
                Code:
                $ gst-inspect-1.0 | grep vaapi
                vaapi:  vaapisink: VA-API sink
                vaapi:  vaapipostproc: VA-API video postprocessing
                vaapi:  vaapidecode: VA-API decoder
                Looks like I might need to build gst myself if I want vaapi encoding plugins?

                Comment


                • #9
                  pontostroy:

                  Your Transmageddon vaapi screenshot shows you transcoding into an Ogg Theora .mkv file and vaapi doesn't accelerate encoding Theora -that's why you can see 90+% of your CPU being used. vaapi can only encode H264 and MPEG2 in hardware.

                  Also, what does

                  Transmageddon 3.0 – 1.2

                  mean?

                  Comment


                  • #10
                    Originally posted by danboid View Post
                    pontostroy:

                    Your Transmageddon vaapi screenshot shows you transcoding into an Ogg Theora .mkv file and vaapi doesn't accelerate encoding Theora -that's why you can see 90+% of your CPU being used. vaapi can only encode H264 and MPEG2 in hardware.


                    mean?
                    1 It shows settings to transcoding into an Ogg Theora .ogg file
                    2 This is default setting and after transcoding Transmageddon always changed all settings to ogg
                    3 See konsole output, and look at words vaapi\omx

                    Comment


                    • #11
                      Just because Transmageddon / gstreamer has loaded your va-api driver doesn't mean its being used and in your case it won't be getting used because you have transcoded to ogg.

                      To encode in a format that should use vaapi, choose AVI for the output format then it should choose h264 as the default codec.

                      However, there is no point in trying unless you have the required gstreamer encoding plugins. What distro are you running and what output do you get when you run:

                      Code:
                      gst-inspect-1.0 | grep vaapi
                      Also, make sure you are running at least Transmageddon 1.3. It seems your previous test used 1.2 and 1.3 fixed a bug that disabled vaapi.
                      Last edited by danboid; 08-12-2014, 03:24 AM.

                      Comment


                      • #12
                        Originally posted by danboid View Post
                        Just because Transmageddon / gstreamer has loaded your va-api driver doesn't mean its being used and in your case it won't be getting used because you have transcoded to ogg.

                        To encode in a format that should use vaapi, choose AVI for the output format then it should choose h264 as the default codec.

                        However, there is no point in trying unless you have the required gstreamer encoding plugins. What distro are you running and what output do you get when you run:

                        Code:
                        gst-inspect-1.0 | grep vaapi
                        Also, make sure you are running at least Transmageddon 1.3. It seems your previous test used 1.2 and 1.3 fixed a bug that disabled vaapi.
                        I use matroska + h264 and vaapi and omx works fine.
                        How do you explain the difference in time and CPU load on screenshots?
                        Special video for you, look carefully at what happens after 0.49s-0.50s


                        Any questions?

                        Comment


                        • #13
                          Hi there, I'm a newbie 'nix user that is very keen to abandon Windows, the one issue being Intel Quicksync support. I encode a lot for a website I run so having the speed and quality offered by my Haswell is a god send. The issue is, I really don't want to be tied to Windows.

                          I have tried various settings and installs with regards to Transmaggedon. One thing that I quickly learnt was not to mess with Gstreamer, because as soon as I do I break all format support and hardware decoding as a result. This has resulted in numerous re-installs.

                          I have managed to get Transmaggedon to use the hardware, but with incredibly poor quality; nothing like what has been shown off in this thread. Can anyone help out a Linux Newbie using Ubuntu 14.04 on an Intel® Pentium(R) CPU G3258 @ 3.20GHz × 2 I am willingly to donate to anyone who can spend the time explaining this to me. Thank you!

                          Comment


                          • #14
                            vague update

                            Hi Dexterp91

                            I've been meaning to update this thread for months, just never got round to it. I did get HW encoding working under Transmageddon in the end but under Arch instead of Ubuntu. I just had to install the Intel GPU driver from AUR then Transmageddon VAAPI encoding (using the version in the official Arch repos) 'just worked'. I've not used it in a while but IIRC it was something like 4/5x faster than encoding in software so I was quite happy with that.

                            I've never tried Quicksync but I've heard its both faster and better quality than VAAPI. Unfortnately I expect there is little you can do to improve the encoding quality other than wait for the Intel devs to improve VAAPI encoding. However, if there is anyone outside Intel who does know how to improve the situation there is a very good chance they read these forums so you asked in the right place.

                            Comment


                            • #15
                              Mistake in my first post

                              I don't think I have ever had HW acceleration working in Ubuntu, I just mistook the option h26n ITU as it. It was stupidly quick but gave nothing great for quality. I can't find much to explain what that option what/is either.

                              Thank you for the reply. I'll try in Manjaro (I'm scared of pure Arch as they don't seem to care about posting system breaking updates)

                              Comment

                              Working...
                              X