Encoding VP9 Videos with Intel Quick Sync?

Sonic Angel Knight

Well-Known Member
OP
Member
Joined
May 27, 2016
Messages
14,397
Trophies
1
Location
New York
XP
12,922
Country
United States
Lately, I been messing around with ffmpeg. If you don't know what it is, you can use it to encode or decode video and audio files of many formats. It basic use is through command line (Which I'm not the best at without a cheat sheet to help remember) Anyway, I messed around with encoding videos to the webm format which is technically VP9 that youtube uses. It takes patience to do but the result is a small file with no visual blemishes that I can see. :)

Recently I found out that on some intel hardware pc, you can use hardware acceleration to encode videos that makes it a lot faster. So it doesn't take over 30 minutes to encode a 10 minute video at 3.2 fps. According to what I learned my pc uses a supported intel chip that supports encoding VP9 format. But I don't know how to do it, and it has been bugging me for awhile now. I can do H264 encoding with the so called "Intel quick sync" but not vp9. :(

I was wondering if any of you has managed to encode vp9 with intel quick sync hardware acceleration feature. I made sure to check if my system can do it and it does. I just don't know how. The intel chip I have is called "Kaby Lake" and says "encode 8-bit vp9" :blink:

Code:
Encoder vp9_qsv [VP9 video (Intel Quick Sync Video acceleration)]:
    General capabilities: delay hybrid
    Threading capabilities: none
    Supported hardware devices: qsv qsv qsv
    Supported pixel formats: nv12 p010le qsv
vp9_qsv encoder AVOptions:
  -async_depth       <int>        E..V...... Maximum processing parallelism (from 1 to INT_MAX) (default 4)
  -avbr_accuracy     <int>        E..V...... Accuracy of the AVBR ratecontrol (from 0 to INT_MAX) (default 0)
  -avbr_convergence  <int>        E..V...... Convergence of the AVBR ratecontrol (from 0 to INT_MAX) (default 0)
  -preset            <int>        E..V...... (from 1 to 7) (default medium)
     veryfast        7            E..V......
     faster          6            E..V......
     fast            5            E..V......
     medium          4            E..V......
     slow            3            E..V......
     slower          2            E..V......
     veryslow        1            E..V......
  -rdo               <int>        E..V...... Enable rate distortion optimization (from -1 to 1) (default -1)
  -max_frame_size    <int>        E..V...... Maximum encoded frame size in bytes (from -1 to 65535) (default -1)
  -max_slice_size    <int>        E..V...... Maximum encoded slice size in bytes (from -1 to 65535) (default -1)
  -bitrate_limit     <int>        E..V...... Toggle bitrate limitations (from -1 to 1) (default -1)
  -mbbrc             <int>        E..V...... MB level bitrate control (from -1 to 1) (default -1)
  -extbrc            <int>        E..V...... Extended bitrate control (from -1 to 1) (default -1)
  -adaptive_i        <int>        E..V...... Adaptive I-frame placement (from -1 to 1) (default -1)
  -adaptive_b        <int>        E..V...... Adaptive B-frame placement (from -1 to 1) (default -1)
  -b_strategy        <int>        E..V...... Strategy to choose between I/P/B-frames (from -1 to 1) (default -1)
  -forced_idr        <boolean>    E..V...... Forcing I frames as IDR frames (default false)
  -low_power         <boolean>    E..V...... enable low power mode(experimental: many limitations by mfx version, BRC modes, etc.) (default false)
  -profile           <int>        E..V...... (from 0 to INT_MAX) (default unknown)
     unknown         0            E..V......
     profile0        1            E..V......
     profile1        2            E..V......
     profile2        3            E..V......
     profile3        4            E..V......
 

Tom Bombadildo

Dick, With Balls
Member
Joined
Jul 11, 2009
Messages
14,575
Trophies
2
Age
29
Location
I forgot
Website
POCKET.LIKEITS
XP
19,214
Country
United States
Out of curiosity, if you find FFMPEG a little difficult to use with commandline, why not use a GUI for it?

https://axiomui.github.io/ < ie Axiom, I use it whenever I can't be bothered to install Handbrake, will let you set any option you can use via commandline with nice helpful buttons instead, including whether to use Intel Quick Sync for hardware acceleration
 
  • Like
Reactions: Sonic Angel Knight

Wuigi

Well-Known Member
Member
Joined
Sep 14, 2012
Messages
727
Trophies
1
XP
1,783
Country
United States
I use hevc via libx265 for encoding and h264_qsv as decoder to get the best quality at the smallest size for 900p60 footage which was too much for my 8700k's QSV encoder, but it also takes more time via software.
When I tried to encode vp9 some time ago, it required me to change the extension of the output file to .webm to use the correct container.
Did you try that already?
According to wikipedia profile 1 with 4:2:0, 4:2:2 or 4:4:4 or profile 0 with 4:2:0 are 8-bit encodings, so maybe additionally try -pix_fmt yuv420p to enforce it.
 
Last edited by Wuigi,

Sonic Angel Knight

Well-Known Member
OP
Member
Joined
May 27, 2016
Messages
14,397
Trophies
1
Location
New York
XP
12,922
Country
United States
I use hevc via libx265 for encoding and h264_qsv as decoder to get the best quality at the smallest size for 900p60 footage which was too much for my 8700k's QSV encoder, but it also takes more time via software.
When I tried to encode vp9 some time ago, it required me to change the extension of the output file to .webm to use the correct container.
Did you try that already?
According to wikipedia profile 1 with 4:2:0, 4:2:2 or 4:4:4 or profile 0 with 4:2:0 are 8-bit encodings, so maybe additionally try -pix_fmt yuv420p to enforce it.
The command I use is
Code:
ffmpeg -i input.avi -c:v vp9_qsv output.webm

Then the log says
Code:
[vp9_qsv @ 000001cf9aa40d00] Selected ratecontrol mode is unsupported
[vp9_qsv @ 000001cf9aa40d00] Low power mode is unsupported
[vp9_qsv @ 000001cf9aa40d00] Current frame rate is unsupported
[vp9_qsv @ 000001cf9aa40d00] Current picture structure is unsupported
[vp9_qsv @ 000001cf9aa40d00] Current resolution is unsupported
[vp9_qsv @ 000001cf9aa40d00] Current pixel format is unsupported
[vp9_qsv @ 000001cf9aa40d00] some encoding parameters are not supported by the QSV runtime. Please double check the input parameters.
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!

Of course if i change the encoder to H264_qsv instead of vp9_qsv and mp4 instead of webm, the video encodes

Code:
Output #0, mp4, to 'output.mp4':
  Metadata:
    encoder         : Lavf58.61.100
    Stream #0:0: Video: h264 (h264_qsv) (avc1 / 0x31637661), nv12(progressive), 256x224, q=-1--1, 1000 kb/s, 60 fps, 15360 tbn, 60 tbc
    Metadata:
      encoder         : Lavc58.109.100 h264_qsv
    Side data:
      cpb: bitrate max/min/avg: 0/0/1000000 buffer size: 0 vbv_delay: N/A
    Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc58.109.100 aac
frame=  319 fps=0.0 q=12.0 Lsize=     523kB time=00:00:05.33 bitrate= 802.9kbits/s speed=   7x
video:423kB audio:90kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.950069%
[aac @ 00000238d8673b80] Qavg: 735.079
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
Do check the quality of the hardware accelerated encodings if you do end up finding a means (or another codec that supports if ffmpeg did not include the option yet) hardware acceleration.

I can't say I have particularly messed with VP9 (I live in a part of the world where software patents are not a thing so don't have to worry about using the weird and wonderful codecs unless they are going to do something for me), much less various hardware encoding options for it, but going back to when hardware acceleration for encoding first started to come on the scene they often sacrificed quality for speed (same bitrates and settings) and it has seemingly remained that way ever since -- I don't know of any serious video encoder that will do hardware acceleration for anything other than a rough cut. This is not just for posterity I should type things but actual side by side you can notice and if you know what to look for then truly horrific.
 
  • Like
Reactions: Sonic Angel Knight

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    K3Nv2 @ K3Nv2: My therapy chair is padded