1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Ryzen内蔵GPUとArchLinuxで動画をハードウェアエンコードする

Posted at

概要

単にやったらできたよ、というだけ…

現状

VAAPIのffmpegでIntelのQSVを使っています。
同じことをM75q-1のRyzen 5 PRO 3400GEでもやりたい!

調査

ArchWikiのハードウェアビデオアクセラレーションから。
AMD系は、libva-mesa-driverを使えば、VAAPIが使えるっぽい書き振り。
Raven RidgeだとHEVCも使えそう。

インストール

他にも入れたかもですが…

pacman -Syu libva-mesa-driver libva-utils ffmpeg

実行

$ vainfo
error: can't connect to X server!
vainfo: VA-API version: 1.9 (libva 2.9.1)
vainfo: Driver version: Mesa Gallium driver 20.2.0 for AMD RAVEN (DRM 3.39.0, 5.9.1-zen2-1-zen, LLVM 10.0.1)
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointVLD
      VAProfileVC1Simple              :	VAEntrypointVLD
      VAProfileVC1Main                :	VAEntrypointVLD
      VAProfileVC1Advanced            :	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSlice
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointEncSlice
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointEncSlice
      VAProfileHEVCMain               :	VAEntrypointVLD
      VAProfileHEVCMain               :	VAEntrypointEncSlice
      VAProfileHEVCMain10             :	VAEntrypointVLD
      VAProfileJPEGBaseline           :	VAEntrypointVLD
      VAProfileVP9Profile0            :	VAEntrypointVLD
      VAProfileVP9Profile2            :	VAEntrypointVLD
      VAProfileNone                   :	VAEntrypointVideoProc

いいかんじ。動きそう。

このへんを見ながら…

ffmpeg -vaapi_device /dev/dri/renderD128 -i hoge -vf "format=nv12|vaapi,hwupload,deinterlace_vaapi=rate=field:auto=1,scale_vaapi=w=640:h=360" -c:v h264_vaapi -qp 28 -acodec copy hoge.mp4

エンコードが始まった。
qp他、各種パラメーターは適当です。

おまけ

  • こちらopencl-amdと共存する模様
  • deinterlace_vaapi入れると結構遅くなる? (詳細未調査)
  • 全然関係ないけど、ffmpegには-movflags +faststartというのがあるんですね
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?