如何使用硬件设备通过`ffmpeg``snap`进行硬件加速编码?

如何使用硬件设备通过`ffmpeg``snap`进行硬件加速编码?

使用apt 中的 18.04 包,我可以在Kaby Lake 上对ffmpeg视频硬件加速进行编码:HEVC

ffmpeg  -vaapi_device /dev/dri/renderD128  -i input.mkv -vf 'format=nv12,hwupload' -c:v hevc_vaapi -qp 25 output.mkv

我还安装了(Snapcrafters)ffmpegsnap尝试ffmpeg 4

尝试snap ffmpeg

/snap/bin/ffmpeg  -vaapi_device /dev/dri/renderD128  -i input.mkv -vf 'format=nv12,hwupload' -c:v hevc_vaapi -qp 25 output.mkv

我收到此错误:

No VA display found for device: /dev/dri/renderD128.
Device creation failed: -22.
Failed to set value '/dev/dri/renderD128' for option 
'vaapi_device': Invalid argument

更新:

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) Kaby Lake - 2.1.0
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileH264MultiviewHigh      : VAEntrypointVLD
      VAProfileH264MultiviewHigh      : VAEntrypointEncSlice
      VAProfileH264StereoHigh         : VAEntrypointVLD
      VAProfileH264StereoHigh         : VAEntrypointEncSlice
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileVP8Version0_3          : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSlice
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointEncSlice
      VAProfileVP9Profile2            : VAEntrypointVLD

ls -al /dev/dri

total 0
drwxr-xr-x   3 root root       100 mrt 31 21:02 .
drwxr-xr-x  22 root root      4300 apr  9 16:18 ..
drwxr-xr-x   2 root root        80 mrt 31 21:02 by-path
crw-rw----+  1 root video 226,   0 mrt 31 21:02 card0
crw-rw----+  1 root video 226, 128 mrt 31 21:02 renderD128

相关内容