<p>I'd like to ask for your advice. Recently I got refurbished Dell Latitude E6540 with two GPUs: integrated Intel HD Graphics 4600 and external AMD Radeon HD 8790M:</p>

<pre><code>00:02.0 VGA compatible controller: Intel Corporation 4th Gen Core Processor Integrated Graphics Controller (rev 06)
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Mars XTX [Radeon HD 8790M]
</code></pre>

<p>Basically, what I'd like to achive is use AMD power to ffmpeg (I use it mainly to convert images sequences to movies - thousands of images in 2K-4K resolution), possibly also Digikam, GIMP, Avidemux and similar software.</p>

<p>I use Kubuntu 18.04.2 LTS as my distro of choice with Oibaf's graphic drivers PPA. I know how to turn on AMD on it - just use <code>DRI_PRIME=1</code> prefix with app name. So if I run <code>DRI_PRIME=1 glxinfo</code> I get (only OpenGL excerpt):</p>

<pre><code>OpenGL vendor string: X.Org
OpenGL renderer string: AMD OLAND (DRM 2.50.0, 4.18.0-17-generic, LLVM 8.0.0)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 19.1.0-devel (git-3c5a9ab 2019-04-17 bionic-oibaf-ppa)
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL version string: 4.5 (Compatibility Profile) Mesa 19.1.0-devel (git-3c5a9ab 2019-04-17 bionic-oibaf-ppa)
OpenGL shading language version string: 4.50
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 19.1.0-devel (git-3c5a9ab 2019-04-17 bionic-oibaf-ppa)
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
</code></pre>

<p>But if I test my notebook with <code>radeon-profile</code> app (<a href="https://github.com/marazmista/radeon-profile" rel="nofollow noreferrer">https://github.com/marazmista/radeon-profile</a>), I get:</p>

<pre><code>VGA: Intel Corporation 4th Gen Core Processor Integrated Graphics Controller (rev 06)
VGA: Advanced Micro Devices, Inc. [AMD/ATI] Mars XTX [Radeon HD 8790M]
OpenGL driver: not direct rendering capable.
Kernel driver: radeon
name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Intel Open Source Technology Center (0x8086)
    Device: Mesa DRI Intel(R) Haswell Mobile  (0x416)
    Version: 19.1.0
    Accelerated: yes
    Video memory: 1536MB
    Unified memory: yes
    Preferred profile: core (0x1)
    Max core profile version: 4.5
    Max compat profile version: 3.0
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.1
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile 
OpenGL core profile version string: 4.5 (Core Profile) Mesa 19.1.0-devel (git-3c5a9ab 2019-04-17 bionic-oibaf-ppa)
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL version string: 3.0 Mesa 19.1.0-devel (git-3c5a9ab 2019-04-17 bionic-oibaf-ppa)
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 19.1.0-devel (git-3c5a9ab 2019-04-17 bionic-oibaf-ppa)
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
</code></pre>

<p>So why it is? If I call AMD by <code>DRI_PRIME=1 radeon-profile</code> and see kernel driver <code>radeon</code>, next massages are about Intel GPU? And why one of the messages says <em>OpenGL driver: not direct rendering capable</em>?</p>

<p>Next test: <code>mpv</code>. My personal <code>mpv.conf</code> is:</p>

<pre><code>gpu-context=auto
hwdec=auto
vo=gpu
profile=gpu-hq
fullscreen=yes
scale=ewa_lanczossharp
cscale=ewa_lanczossharp
</code></pre>

<p>I call mpv with: <code>DRI_PRIME=1 mpv --msg-level=vo/opengl=debug --log-file=mpv-debug.log big_buck_bunny_1080p_stereo.avi</code> and I see that AMD is used:</p>

<pre><code>[   0.049][v][vo/gpu] Probing for best GPU context.
[   0.049][v][vo/gpu/opengl] Initializing GPU context 'x11probe'
[   0.049][v][vo/gpu/x11] X11 opening display: :0
[   0.051][v][vo/gpu/x11] X11 running at 1920x1080 (":0" =&gt; local display)
[   0.052][v][vo/gpu/x11] Detected wm supports NetWM.
[   0.052][v][vo/gpu/x11] Detected wm supports FULLSCREEN state.
[   0.052][v][vo/gpu/x11] Detected wm supports ABOVE state.
[   0.052][v][vo/gpu/x11] Detected wm supports BELOW state.
[   0.052][v][vo/gpu/x11] Detected wm supports STAYS_ON_TOP state.
[   0.052][v][vo/gpu/x11] Display 0 (eDP-1): [0, 0, 1920, 1080] @ 60.005696 FPS
[   0.052][v][vo/gpu/x11] Current display FPS: 60.005696
[   0.120][v][vo/gpu/opengl] GLX chose FB config with ID 0xe7
[   0.120][v][vo/gpu/opengl] GLX chose visual with ID 0x13e
[   0.123][v][vo/gpu/opengl] Creating OpenGL 4.4 context...
[   0.130][v][vo/gpu] GL_VERSION='4.5 (Core Profile) Mesa 19.1.0-devel (git-3c5a9ab 2019-04-17 bionic-oibaf-ppa)'
[   0.130][v][vo/gpu] Detected desktop OpenGL 4.5.
[   0.130][v][vo/gpu] GL_VENDOR='X.Org'
[   0.130][v][vo/gpu] GL_RENDERER='AMD OLAND (DRM 2.50.0, 4.18.0-17-generic, LLVM 8.0.0)'
[   0.130][v][vo/gpu] GL_SHADING_LANGUAGE_VERSION='4.50'
</code></pre>

<p>When I call it without DRI_PRIME=1, relevant message says:</p>

<pre><code>[   0.074][v][vo/gpu] GL_VERSION='4.5 (Core Profile) Mesa 19.1.0-devel (git-3c5a9ab 2019-04-17 bionic-oibaf-ppa)'
[   0.074][v][vo/gpu] Detected desktop OpenGL 4.5.
[   0.074][v][vo/gpu] GL_VENDOR='Intel Open Source Technology Center'
[   0.074][v][vo/gpu] GL_RENDERER='Mesa DRI Intel(R) Haswell Mobile '
[   0.074][v][vo/gpu] GL_SHADING_LANGUAGE_VERSION='4.50'
</code></pre>

<p>I also installed <code>radeontop</code> and <code>intel-gpu-tools</code> to monitor utilization of both GPUs and if I run mpv with DRI_PRIME=1, <code>radeontop</code> is working (values different than 0%), if without - <code>intel_gpu_top</code> is showing meaningful values and radeontop is empty.</p>

<p>Now come to the ffmpeg. I googled many sites and tried many commands to force ffmpeg to work as expected. As far, no luck, so I'm asking here. But what I found until now?</p>

<p>I've downloaded several clips from here: <a href="https://standaloneinstaller.com/blog/big-list-of-sample-videos-for-testers-124.html" rel="nofollow noreferrer">https://standaloneinstaller.com/blog/big-list-of-sample-videos-for-testers-124.html</a> for testing, especially MP4 1920x1080 Panasonic_HDC_TM_700_P_50i movie. I reviewed instructions from the first hand: <a href="https://trac.ffmpeg.org/wiki/Hardware/VAAPI" rel="nofollow noreferrer">https://trac.ffmpeg.org/wiki/Hardware/VAAPI</a></p>

<p>First I tried to capture the screen: <code>ffmpeg -vaapi_device /dev/dri/renderD128 -f x11grab -video_size 1920x1080 -i :0 -vf 'hwupload,scale_vaapi=format=nv12' -c:v h264_vaapi -qp 24 output.mp4</code> but ended with <em>[h264_vaapi @ 0x558a43ee63c0] No usable encoding entrypoint found for profile VAProfileH264High (7).
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!</em></p>

<p>Then the same with different combinations of <code>DRI_PRIME=1 LIBVA_DRIVER_NAME=radeonsi</code> prefix - same result, same error message. So I googled for <em>No usable encoding entrypoint found for profile VAProfileH264High message</em> but didn't found nothing which clarify it, only more confusion. So I tried different approach - <code>vainfo</code>.</p>

<p>Clear <code>vainfo</code> gives:</p>

<pre><code>libva info: VA-API version 1.1.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_1_1
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.1 (libva 2.1.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Haswell Mobile - 2.1.0
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264MultiviewHigh      : VAEntrypointVLD
      VAProfileH264MultiviewHigh      : VAEntrypointEncSlice
      VAProfileH264StereoHigh         : VAEntrypointVLD
      VAProfileH264StereoHigh         : VAEntrypointEncSlice
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileJPEGBaseline           : VAEntrypointVLD
</code></pre>

<p><code>vainfo</code> with <code>DRI_PRIME=1</code> gives:</p>

<pre><code>libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'radeonsi'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_1
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.1 (libva 2.1.0)
vainfo: Driver version: Mesa Gallium driver 19.1.0-devel for AMD OLAND (DRM 2.50.0, 4.18.0-17-generic, LLVM 8.0.0)
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc
</code></pre>

<p>On ArchWiki I found something interesting (<a href="https://wiki.archlinux.org/index.php/Hardware_video_acceleration#Verification" rel="nofollow noreferrer">https://wiki.archlinux.org/index.php/Hardware_video_acceleration#Verification</a>): <em>VAEntrypointVLD means that your card is capable to decode this format, VAEntrypointEncSlice means that you can encode to this format.</em> So does it mean AMD is unable to convert (encode) to H264?</p>

<p>Next test - <code>vdpauinfo</code>. For Intel it gives error and doesn't run as expected but with <code>DRI_PRIME=1 vdpauinfo</code>:</p>

<pre><code>display: :0   screen: 0
API version: 1
Information string: G3DVL VDPAU Driver Shared Library version 1.0

Video surface:

name   width height types
-------------------------------------------
420    16384 16384  NV12 YV12 
422    16384 16384  UYVY YUYV 
444    16384 16384  Y8U8V8A8 V8U8Y8A8 

Decoder capabilities:

name                        level macbs width height
----------------------------------------------------
MPEG1                          --- not supported ---
MPEG2_SIMPLE                    3  9216  2048  1152
MPEG2_MAIN                      3  9216  2048  1152
H264_BASELINE                  41  9216  2048  1152
H264_MAIN                      41  9216  2048  1152
H264_HIGH                      41  9216  2048  1152
VC1_SIMPLE                      1  9216  2048  1152
VC1_MAIN                        2  9216  2048  1152
VC1_ADVANCED                    4  9216  2048  1152
MPEG4_PART2_SP                  3  9216  2048  1152
MPEG4_PART2_ASP                 5  9216  2048  1152
DIVX4_QMOBILE                  --- not supported ---
DIVX4_MOBILE                   --- not supported ---
DIVX4_HOME_THEATER             --- not supported ---
DIVX4_HD_1080P                 --- not supported ---
DIVX5_QMOBILE                  --- not supported ---
DIVX5_MOBILE                   --- not supported ---
DIVX5_HOME_THEATER             --- not supported ---
DIVX5_HD_1080P                 --- not supported ---
H264_CONSTRAINED_BASELINE       0  9216  2048  1152
H264_EXTENDED                  --- not supported ---
H264_PROGRESSIVE_HIGH          --- not supported ---
H264_CONSTRAINED_HIGH          --- not supported ---
H264_HIGH_444_PREDICTIVE       --- not supported ---
HEVC_MAIN                      --- not supported ---
HEVC_MAIN_10                   --- not supported ---
HEVC_MAIN_STILL                --- not supported ---
HEVC_MAIN_12                   --- not supported ---
HEVC_MAIN_444                  --- not supported ---
</code></pre>

<p>So most of H264 profiles aren't supported? I tried to add <code>-profile:v baseline</code> switch to <code>ffmpeg</code> command but ended with: </p>

<pre><code>[h264_vaapi @ 0x55929d9c8300] [Eval @ 0x7ffdb7f59060] Undefined constant or missing '(' in 'baseline'
[h264_vaapi @ 0x55929d9c8300] Unable to parse option value "baseline"
[h264_vaapi @ 0x55929d9c8300] Error setting option profile to value baseline.
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!
</code></pre>

<p>And I digged again, founding this: <a href="https://bugs.launchpad.net/ubuntu/+source/ffmpeg/+bug/1805712/comments/2" rel="nofollow noreferrer">https://bugs.launchpad.net/ubuntu/+source/ffmpeg/+bug/1805712/comments/2</a> </p>

<p>And my hopes died here. If I understand it properly, I can't use AMD GPU to encode because this chip doesn't have this capability built-in. So how can I use the power of this GPU in Linux? Currently I use open-source drivers (radeon/radeonsi) and I've read that open-source driver for AMD is good so I didn't have reason for change. I tried to avoid external solution, but maybe the time has come...? Does it change anything?</p>

<p>EDIT: I reply to my own last question. No, it doesn't change anything, so I came back to system drivers (from Oibaf's repo).</p>

CC BY-SA 4.0
2019-04-19T09:44:14.123Z
Since you're generating a movie from images or screen cap, **de**coding capabilities are irrelevant. **En**coding is the relevant operation, And it appears your device does not support video encoding.
Gyan
CC BY-SA 4.0
2019-04-19T10:10:31.637Z
Thank you for reply. My awkward trials are probably caused by lack of knowledge how whole encoding stack works (communication between CPU and GPU, implemented features from codecs etc.).
stalker
<ffmpeg><h.264>
AMD support for ffmpeg? Can't get my dedicated GPU to work
stalker
# AMD support for ffmpeg? Can't get my dedicated GPU to work

(Asked by: username_0 on 2019-04-17)

I'd like to ask for your advice. Recently I got refurbished Dell Latitude E6540 with two GPUs: integrated Intel HD Graphics 4600 and external AMD Radeon HD 8790M:
00:02.0 VGA compatible controller: Intel Corporation 4th Gen Core Processor Integrated Graphics Controller (rev 06)
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Mars XTX [Radeon HD 8790M]

Basically, what I'd like to achive is use AMD power to ffmpeg (I use it mainly to convert images sequences to movies - thousands of images in 2K-4K resolution), possibly also Digikam, GIMP, Avidemux and similar software.
I use Kubuntu 18.04.2 LTS as my distro of choice with Oibaf's graphic drivers PPA. I know how to turn on AMD on it - just use DRI_PRIME=1 prefix with app name. So if I run DRI_PRIME=1 glxinfo I get (only OpenGL excerpt):
OpenGL vendor string: X.Org
OpenGL renderer string: AMD OLAND (DRM 2.50.0, 4.18.0-17-generic, LLVM 8.0.0)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 19.1.0-devel (git-3c5a9ab 2019-04-17 bionic-oibaf-ppa)
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL version string: 4.5 (Compatibility Profile) Mesa 19.1.0-devel (git-3c5a9ab 2019-04-17 bionic-oibaf-ppa)
OpenGL shading language version string: 4.50
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 19.1.0-devel (git-3c5a9ab 2019-04-17 bionic-oibaf-ppa)
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

But if I test my notebook with radeon-profile app (https://github.com/marazmista/radeon-profile), I get:
VGA: Intel Corporation 4th Gen Core Processor Integrated Graphics Controller (rev 06)
VGA: Advanced Micro Devices, Inc. [AMD/ATI] Mars XTX [Radeon HD 8790M]
OpenGL driver: not direct rendering capable.
Kernel driver: radeon
name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Intel Open Source Technology Center (0x8086)
    Device: Mesa DRI Intel(R) Haswell Mobile  (0x416)
    Version: 19.1.0
    Accelerated: yes
    Video memory: 1536MB
    Unified memory: yes
    Preferred profile: core (0x1)
    Max core profile version: 4.5
    Max compat profile version: 3.0
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.1
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile 
OpenGL core profile version string: 4.5 (Core Profile) Mesa 19.1.0-devel (git-3c5a9ab 2019-04-17 bionic-oibaf-ppa)
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL version string: 3.0 Mesa 19.1.0-devel (git-3c5a9ab 2019-04-17 bionic-oibaf-ppa)
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 19.1.0-devel (git-3c5a9ab 2019-04-17 bionic-oibaf-ppa)
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10

So why it is? If I call AMD by DRI_PRIME=1 radeon-profile and see kernel driver radeon, next massages are about Intel GPU? And why one of the messages says OpenGL driver: not direct rendering capable?
Next test: mpv. My personal mpv.conf is:
gpu-context=auto
hwdec=auto
vo=gpu
profile=gpu-hq
fullscreen=yes
scale=ewa_lanczossharp
cscale=ewa_lanczossharp

I call mpv with: DRI_PRIME=1 mpv --msg-level=vo/opengl=debug --log-file=mpv-debug.log big_buck_bunny_1080p_stereo.avi and I see that AMD is used:
[   0.049][v][vo/gpu] Probing for best GPU context.
[   0.049][v][vo/gpu/opengl] Initializing GPU context 'x11probe'
[   0.049][v][vo/gpu/x11] X11 opening display: :0
[   0.051][v][vo/gpu/x11] X11 running at 1920x1080 (":0" => local display)
[   0.052][v][vo/gpu/x11] Detected wm supports NetWM.
[   0.052][v][vo/gpu/x11] Detected wm supports FULLSCREEN state.
[   0.052][v][vo/gpu/x11] Detected wm supports ABOVE state.
[   0.052][v][vo/gpu/x11] Detected wm supports BELOW state.
[   0.052][v][vo/gpu/x11] Detected wm supports STAYS_ON_TOP state.
[   0.052][v][vo/gpu/x11] Display 0 (eDP-1): [0, 0, 1920, 1080] @ 60.005696 FPS
[   0.052][v][vo/gpu/x11] Current display FPS: 60.005696
[   0.120][v][vo/gpu/opengl] GLX chose FB config with ID 0xe7
[   0.120][v][vo/gpu/opengl] GLX chose visual with ID 0x13e
[   0.123][v][vo/gpu/opengl] Creating OpenGL 4.4 context...
[   0.130][v][vo/gpu] GL_VERSION='4.5 (Core Profile) Mesa 19.1.0-devel (git-3c5a9ab 2019-04-17 bionic-oibaf-ppa)'
[   0.130][v][vo/gpu] Detected desktop OpenGL 4.5.
[   0.130][v][vo/gpu] GL_VENDOR='X.Org'
[   0.130][v][vo/gpu] GL_RENDERER='AMD OLAND (DRM 2.50.0, 4.18.0-17-generic, LLVM 8.0.0)'
[   0.130][v][vo/gpu] GL_SHADING_LANGUAGE_VERSION='4.50'

When I call it without DRI_PRIME=1, relevant message says:
[   0.074][v][vo/gpu] GL_VERSION='4.5 (Core Profile) Mesa 19.1.0-devel (git-3c5a9ab 2019-04-17 bionic-oibaf-ppa)'
[   0.074][v][vo/gpu] Detected desktop OpenGL 4.5.
[   0.074][v][vo/gpu] GL_VENDOR='Intel Open Source Technology Center'
[   0.074][v][vo/gpu] GL_RENDERER='Mesa DRI Intel(R) Haswell Mobile '
[   0.074][v][vo/gpu] GL_SHADING_LANGUAGE_VERSION='4.50'

I also installed radeontop and intel-gpu-tools to monitor utilization of both GPUs and if I run mpv with DRI_PRIME=1, radeontop is working (values different than 0%), if without - intel_gpu_top is showing meaningful values and radeontop is empty.
Now come to the ffmpeg. I googled many sites and tried many commands to force ffmpeg to work as expected. As far, no luck, so I'm asking here. But what I found until now?
I've downloaded several clips from here: https://standaloneinstaller.com/blog/big-list-of-sample-videos-for-testers-124.html for testing, especially MP4 1920x1080 Panasonic_HDC_TM_700_P_50i movie. I reviewed instructions from the first hand: https://trac.ffmpeg.org/wiki/Hardware/VAAPI
First I tried to capture the screen: ffmpeg -vaapi_device /dev/dri/renderD128 -f x11grab -video_size 1920x1080 -i :0 -vf 'hwupload,scale_vaapi=format=nv12' -c:v h264_vaapi -qp 24 output.mp4 but ended with [h264_vaapi @ 0x558a43ee63c0] No usable encoding entrypoint found for profile VAProfileH264High (7).
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!
Then the same with different combinations of DRI_PRIME=1 LIBVA_DRIVER_NAME=radeonsi prefix - same result, same error message. So I googled for No usable encoding entrypoint found for profile VAProfileH264High message but didn't found nothing which clarify it, only more confusion. So I tried different approach - vainfo.
Clear vainfo gives:
libva info: VA-API version 1.1.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_1_1
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.1 (libva 2.1.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Haswell Mobile - 2.1.0
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264MultiviewHigh      : VAEntrypointVLD
      VAProfileH264MultiviewHigh      : VAEntrypointEncSlice
      VAProfileH264StereoHigh         : VAEntrypointVLD
      VAProfileH264StereoHigh         : VAEntrypointEncSlice
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileJPEGBaseline           : VAEntrypointVLD

vainfo with DRI_PRIME=1 gives:
libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'radeonsi'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_1
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.1 (libva 2.1.0)
vainfo: Driver version: Mesa Gallium driver 19.1.0-devel for AMD OLAND (DRM 2.50.0, 4.18.0-17-generic, LLVM 8.0.0)
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc

On ArchWiki I found something interesting (https://wiki.archlinux.org/index.php/Hardware_video_acceleration#Verification): VAEntrypointVLD means that your card is capable to decode this format, VAEntrypointEncSlice means that you can encode to this format. So does it mean AMD is unable to convert (encode) to H264?
Next test - vdpauinfo. For Intel it gives error and doesn't run as expected but with DRI_PRIME=1 vdpauinfo:
display: :0   screen: 0
API version: 1
Information string: G3DVL VDPAU Driver Shared Library version 1.0

Video surface:

name   width height types
-------------------------------------------
420    16384 16384  NV12 YV12 
422    16384 16384  UYVY YUYV 
444    16384 16384  Y8U8V8A8 V8U8Y8A8 

Decoder capabilities:

name                        level macbs width height
----------------------------------------------------
MPEG1                          --- not supported ---
MPEG2_SIMPLE                    3  9216  2048  1152
MPEG2_MAIN                      3  9216  2048  1152
H264_BASELINE                  41  9216  2048  1152
H264_MAIN                      41  9216  2048  1152
H264_HIGH                      41  9216  2048  1152
VC1_SIMPLE                      1  9216  2048  1152
VC1_MAIN                        2  9216  2048  1152
VC1_ADVANCED                    4  9216  2048  1152
MPEG4_PART2_SP                  3  9216  2048  1152
MPEG4_PART2_ASP                 5  9216  2048  1152
DIVX4_QMOBILE                  --- not supported ---
DIVX4_MOBILE                   --- not supported ---
DIVX4_HOME_THEATER             --- not supported ---
DIVX4_HD_1080P                 --- not supported ---
DIVX5_QMOBILE                  --- not supported ---
DIVX5_MOBILE                   --- not supported ---
DIVX5_HOME_THEATER             --- not supported ---
DIVX5_HD_1080P                 --- not supported ---
H264_CONSTRAINED_BASELINE       0  9216  2048  1152
H264_EXTENDED                  --- not supported ---
H264_PROGRESSIVE_HIGH          --- not supported ---
H264_CONSTRAINED_HIGH          --- not supported ---
H264_HIGH_444_PREDICTIVE       --- not supported ---
HEVC_MAIN                      --- not supported ---
HEVC_MAIN_10                   --- not supported ---
HEVC_MAIN_STILL                --- not supported ---
HEVC_MAIN_12                   --- not supported ---
HEVC_MAIN_444                  --- not supported ---

So most of H264 profiles aren't supported? I tried to add -profile:v baseline switch to ffmpeg command but ended with: 
[h264_vaapi @ 0x55929d9c8300] [Eval @ 0x7ffdb7f59060] Undefined constant or missing '(' in 'baseline'
[h264_vaapi @ 0x55929d9c8300] Unable to parse option value "baseline"
[h264_vaapi @ 0x55929d9c8300] Error setting option profile to value baseline.
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!

And I digged again, founding this: https://bugs.launchpad.net/ubuntu/+source/ffmpeg/+bug/1805712/comments/2 
And my hopes died here. If I understand it properly, I can't use AMD GPU to encode because this chip doesn't have this capability built-in. So how can I use the power of this GPU in Linux? Currently I use open-source drivers (radeon/radeonsi) and I've read that open-source driver for AMD is good so I didn't have reason for change. I tried to avoid external solution, but maybe the time has come...? Does it change anything?
EDIT: I reply to my own last question. No, it doesn't change anything, so I came back to system drivers (from Oibaf's repo).

**Tags:** ffmpeg, h.264

> **Comments:**
> **username_1**: Since you're generating a movie from images or screen cap, **de**coding capabilities are irrelevant. **En**coding is the relevant operation, And it appears your device does not support video encoding.  
> **username_0**: Thank you for reply. My awkward trials are probably caused by lack of knowledge how whole encoding stack works (communication between CPU and GPU, implemented features from codecs etc.).  

---

## 0 answers

