21
14

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 1 year has passed since last update.

結局ハードウェアエンコードってどうなの?(H265篇)

Last updated at Posted at 2021-12-02

さくらインターネット Advent Calendar 2021 2日目の記事です。

前置き

どうも、さくらインターネットクラウド事業本部のやまけんです。

2018年のアドベントカレンダーにNVIDIAのGPUに搭載されているNVEncを使う話を書きましたがその続きになります。

おかげさまで上記記事については一定数のニーズがあるようで、CUDAのバージョンが上がったりNVIDIA VIDEO CODECのバージョンが上がったり、UbuntuのLTS版のバージョンが上がったりするたびにメンテナンスをしておりまして、未だ参考にしていただいてることに感謝いたします。

はてさて、この記事執筆から3年経ちまして、ハードウェアエンコードってどうなのっていうところで、比較検証などを記事にしたいと思います。

検証環境

  • Fujitsu TX1310M3
  • CPU Celeron G3930
  • Mem 16GB
  • GPU1 Intel HD 630
  • GPU2 NVIDIA T400
  • OS Ubuntu 20.04.3 LTS

GPU NVIDIA T400について

NVIDIAから販売しているNVIDIA T400について紹介します。
いわゆるワークステーション向けQuadroラインナップですが、今年からデータセンター向けTeslaやワークステーション向けQuadroからそれぞれのブランド名が消えて NVIDIA なんちゃらという命名規則になりました。

本製品はQuadro P400の後継となり、Turing世代になりました。今のRTX30はAmpere世代ですから1世代古いものになります。
コンシューマ向けでいうところのGTX1650と同じTU117チップを利用していますが、CUDAコアが384個と半分以下に減らされていますので、実質GT1030の後継ぐらいの立ち位置ですかね。
お値段も安く、私がぷらっとオンラインで購入した際は14,390円でした。

現在販売終了してしまったのですが、近々メモリが倍の4GBとなって再販するので暫し待つと良いかと(値段も上がるとはいえ、それほど変わらない感じという噂)

サイズも1UでLowProfile 消費電力30Wと、1Uサーバにも搭載できるサイズです(Fujitsu RX2530M4にて検証済み)
動画のエンコードだけをさせるにはちょうど良いGPUです。
Turing世代ではありますが、TU117はNVEncにおいてはPascalやVolta世代同等6th Genのため残念ながらH.265のBフレーム対応はしていません。

参考 Video Encode and Decode GPU Support Matrix
https://developer.nvidia.com/video-encode-and-decode-gpu-support-matrix-new

GPUカードのため、使用しているサーバによってはBMCチップのVGA機能と衝突してしまい、リモートKVMが使えなくなったりします。(Fujitsu RX2530M4 で確認)
デスクトップでもオンボードGPUとも排他利用となっている場合は、同様ですので、注意が必要です。

検証環境構築

今回はCPUに搭載されてるGPUであるIntel HD 630を使ったIntelQSVと、GPUカードのNVIDIA T400をつかったNVENC、X264によるソフトウェアエンコードの3つの環境で生成したファイルを動画品質評価に使うVMAFスコアを用いて判定します。

環境構築には下記の記事を参考に構築していきます。

Intel media stack componentsとiHDドライバのインストール

Ubuntu19.04以降は公式aptに用意されてるので非常に楽です。

# Intel media stack componentsのインストール
sudo apt-get install libva-dev libmfx-dev intel-media-va-driver-non-free vainfo
export LIBVA_DRIVER_NAME=iHD

インストール完了後、vainfoを実行し、ドライバが見えるか確認しましょう。

test@test:~$ sudo vainfo
error: XDG_RUNTIME_DIR not set in the environment.
error: can't connect to X server!
libva info: VA-API version 1.7.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_7
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.7 (libva 2.6.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 20.1.1 ()
vainfo: Supported profile and entrypoints
      VAProfileNone                   :	VAEntrypointVideoProc
      VAProfileNone                   :	VAEntrypointStats
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Simple            :	VAEntrypointEncSlice
      VAProfileMPEG2Main              :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointEncSlice
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointEncSlice
      VAProfileH264Main               :	VAEntrypointFEI
      VAProfileH264Main               :	VAEntrypointEncSliceLP
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointEncSlice
      VAProfileH264High               :	VAEntrypointFEI
      VAProfileH264High               :	VAEntrypointEncSliceLP
      VAProfileVC1Simple              :	VAEntrypointVLD
      VAProfileVC1Main                :	VAEntrypointVLD
      VAProfileVC1Advanced            :	VAEntrypointVLD
      VAProfileJPEGBaseline           :	VAEntrypointVLD
      VAProfileJPEGBaseline           :	VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline:	VAEntrypointFEI
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSliceLP
      VAProfileVP8Version0_3          :	VAEntrypointVLD
      VAProfileVP8Version0_3          :	VAEntrypointEncSlice
      VAProfileHEVCMain               :	VAEntrypointVLD
      VAProfileHEVCMain               :	VAEntrypointEncSlice
      VAProfileHEVCMain               :	VAEntrypointFEI
      VAProfileHEVCMain10             :	VAEntrypointVLD
      VAProfileHEVCMain10             :	VAEntrypointEncSlice
      VAProfileVP9Profile0            :	VAEntrypointVLD
      VAProfileVP9Profile2            :	VAEntrypointVLD

Driver version: Intel iHD driver for Intel(R) Gen Graphics - 20.1.1
とのことで、問題なくiHDが使えます。

しかし、このままでは、エンコードに使う /dev/dri/renderD128 のパーミッションの問題で、一般ユーザーでffmpegを使う場合、HWエンコードができなくなります。

test@test:~$ ls -l /dev/dri/render*
crw-rw---- 1 root render 226, 128 Aug 15 13:53 /dev/dri/renderD128
test@test:~$ 

そこで、一般ユーザーでもアクセス可能にするための設定ファイルを作成します。

sudo vi /etc/udev/rules.d/99-render.rules
99-render.rules
KERNEL=="render*" GROUP="render", MODE="0666"

OS再起動後、デバイスのパーミッションを確認します。

test@test:~$ ls -l /dev/dri/render*
crw-rw-rw- 1 root render 226, 128 Aug 15 13:53 /dev/dri/renderD128
test@test:~$ 

vainfoも一般ユーザーで実行できるようになるはずです。

test@test:~$ vainfo
error: XDG_RUNTIME_DIR not set in the environment.
error: can't connect to X server!
libva info: VA-API version 1.7.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_7
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.7 (libva 2.6.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 20.1.1 ()
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileNone                   : VAEntrypointStats
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointFEI
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointFEI
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointFEI
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileVP8Version0_3          : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointFEI
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSlice
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD

CUDAのインストール

NVIDIA CUDA Installation Guide for Linux に従って入れます
https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html

今回はパッケージで入れたいと思いますので、
2. Pre-installation Actions
3. Package Manager Installation
7. Post-installation Actions
こちらを進めれば良いです。

# Kernel Headerを入れる
sudo apt-get install software-properties-common linux-headers-$(uname -r)

# aptプライオリティpinファイルをDL
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin

# aptプライオリティpinファイルをaptのフォルダに移動
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600

# GPGキーをインポート
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub

リポジトリを登録
sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /"

# リポジトリ更新
sudo apt-get update

# CUDAインストール
sudo apt-get -y install cuda

# パスを通す
echo 'export PATH=/usr/local/cuda-11.8/bin${PATH:+:${PATH}}' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' >> ~/.bashrc

source ~/.bashrc

サーバなどで、GUIを使っておらず、CLI利用の場合、ドライバ類のインストールと共にX関連も入れるので、必要に応じてCLI起動するように設定しましょう。(必須ではありません。Tesla使ってたらそもそも不要)

# 現在の設定を確認
test@test:~$ systemctl get-default
graphical.target

graphical.targetと帰ってくると、GUI起動になってるので、CLI(sysvinitでいうrunlevel3)に設定変更

# multi-user.target へ変更
test@test:~$sudo systemctl set-default multi-user.target
Created symlink /etc/systemd/system/default.target → /lib/systemd/system/multi-user.target.

これで再起動後よりCLIになります。

インストールが完了したら再起動し、 nvidia-smi にてドライバインストールも含め完了しているか確認しましょう。

test@test:~$ nvidia-smi
Wed Nov 17 15:13:37 2021       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 495.29.05    Driver Version: 495.29.05    CUDA Version: 11.5     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA T400         On   | 00000000:01:00.0 Off |                  N/A |
| 38%   47C    P8    N/A /  31W |      1MiB /  1876MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+
test@test:~$ 

FFmpegのインストール

Compile FFmpeg for Ubuntu, Debian, or Mint
https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
こちらをベースにffmpegとnv-codec-headersとlibvmaf以外はパッケージで入れます。

またインストールされるCUDAのバージョン次第で
--extra-cflags="-I/usr/local/cuda-11.5/include"
--extra-ldflags="-L/usr/local/cuda-11.5/lib64"
を正しいCUDAライブラリのパスに直す必要があります。

# FFmpegコンパイルに必要なものを導入
sudo apt-get update -qq && sudo apt-get -y install \
  autoconf \
  automake \
  build-essential \
  cmake \
  git-core \
  libass-dev \
  libfreetype6-dev \
  libgnutls28-dev \
  libunistring-dev \
  libmp3lame-dev \
  libtool \
  libvorbis-dev \
  meson \
  ninja-build \
  pkg-config \
  texinfo \
  wget \
  yasm \
  zlib1g-dev

# 作業ディレクトリ作成
mkdir -p ~/ffmpeg_sources ~/bin

# NASM インストール
sudo apt-get -y install nasm

# libx264 インストール
sudo apt-get -y install libx264-dev

# libx265 インストール
sudo apt-get -y install libx265-dev libnuma-dev

# libvpx インストール
sudo apt-get -y install libvpx-dev

# libfdk-aac インストール
sudo apt-get -y install libfdk-aac-dev

# libopus インストール
sudo apt-get -y install libopus-dev

# libaom インストール
sudo apt-get -y install libaom-dev

# libvmaf インストール
cd ~/ffmpeg_sources && \
wget https://github.com/Netflix/vmaf/archive/v2.1.1.tar.gz && \
tar xvf v2.1.1.tar.gz && mkdir -p vmaf-2.1.1/libvmaf/build && \
cd vmaf-2.1.1/libvmaf/build && \
meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=static .. --prefix "$HOME/ffmpeg_build" --bindir="$HOME/ffmpeg_build/bin" --libdir="$HOME/ffmpeg_build/lib" && \
ninja && \
ninja install

# NVIDIA codec API インストール
cd ~/ffmpeg_sources && \
git -C nv-codec-headers pull 2> /dev/null || git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers && \
cd nv-codec-headers && \
make && \
make install PREFIX="$HOME/ffmpeg_build"

# FFmpeg インストール

cd ~/ffmpeg_sources && \
wget -O ffmpeg-snapshot.tar.bz2 https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && \
tar xjvf ffmpeg-snapshot.tar.bz2 && \
cd ffmpeg && \
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
  --prefix="$HOME/ffmpeg_build" \
  --pkg-config-flags="--static" \
  --extra-cflags="-I$HOME/ffmpeg_build/include" \
  --extra-ldflags="-L$HOME/ffmpeg_build/lib" \
  --enable-cuda-nvcc \
  --nvccflags="-gencode arch=compute_75,code=sm_75 -O2" \
  --enable-cuvid \
  --enable-nvenc \
  --enable-libnpp \
  --extra-cflags="-I/usr/local/cuda-11.8/include" \
  --extra-ldflags="-L/usr/local/cuda-11.8/lib64" \
  --extra-libs="-lpthread -lm" \
  --ld="g++" \
  --bindir="$HOME/bin" \
  --enable-gpl \
  --enable-gnutls \
  --enable-libaom \
  --enable-libass \
  --enable-libfdk-aac \
  --enable-libfreetype \
  --enable-libmp3lame \
  --enable-libopus \
  --enable-libvorbis \
  --enable-libvpx \
  --enable-libx264 \
  --enable-libx265 \
  --enable-libvmaf \
  --enable-vaapi \
  --enable-libmfx \
  --enable-nonfree && \
PATH="$HOME/bin:$PATH" make && \
make install && \
hash -r

パスを通したり
source ~/.profile
echo "MANPATH_MAP $HOME/bin $HOME/ffmpeg_build/share/man" >> ~/.manpath

動作確認

実際にインストールが成功したか、下記のコマンドでQSVエンコード関連オプションが使えるか確認します。

for i in buildconf hwaccels decoders filters encoders; do echo $i:; ffmpeg -hide_banner -${i} | egrep -i "qsv|vaapi|libmfx"; done

結果はこのようになると思います。

test@test:~$ for i in buildconf hwaccels decoders filters encoders; do echo $i:; ffmpeg -hide_banner -${i} | egrep -i "qsv|vaapi|libmfx"; done
buildconf:
    --enable-vaapi
    --enable-libmfx
hwaccels:
vaapi
qsv
decoders:
 V....D av1_qsv              AV1 video (Intel Quick Sync Video acceleration) (codec av1)
 V....D h264_qsv             H264 video (Intel Quick Sync Video acceleration) (codec h264)
 V....D hevc_qsv             HEVC video (Intel Quick Sync Video acceleration) (codec hevc)
 V....D mjpeg_qsv            MJPEG video (Intel Quick Sync Video acceleration) (codec mjpeg)
 V....D mpeg2_qsv            MPEG2VIDEO video (Intel Quick Sync Video acceleration) (codec mpeg2video)
 V....D vc1_qsv              VC1 video (Intel Quick Sync Video acceleration) (codec vc1)
 V....D vp8_qsv              VP8 video (Intel Quick Sync Video acceleration) (codec vp8)
 V....D vp9_qsv              VP9 video (Intel Quick Sync Video acceleration) (codec vp9)
filters:
 ... deinterlace_qsv   V->V       QuickSync video deinterlacing
 ... deinterlace_vaapi V->V       Deinterlacing of VAAPI surfaces
 ... denoise_vaapi     V->V       VAAPI VPP for de-noise
 ... overlay_qsv       VV->V      Quick Sync Video overlay.
 ... procamp_vaapi     V->V       ProcAmp (color balance) adjustments for hue, saturation, brightness, contrast
 ... scale_qsv         V->V       QuickSync video scaling and format conversion
 ... scale_vaapi       V->V       Scale to/from VAAPI surfaces.
 ... sharpness_vaapi   V->V       VAAPI VPP for sharpness
 ... tonemap_vaapi     V->V       VAAPI VPP for tone-mapping
 ... transpose_vaapi   V->V       VAAPI VPP for transpose
 ... vpp_qsv           V->V       Quick Sync Video VPP.
encoders:
 V..... h264_qsv             H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (Intel Quick Sync Video acceleration) (codec h264)
 V....D h264_vaapi           H.264/AVC (VAAPI) (codec h264)
 V..... hevc_qsv             HEVC (Intel Quick Sync Video acceleration) (codec hevc)
 V....D hevc_vaapi           H.265/HEVC (VAAPI) (codec hevc)
 V..... mjpeg_qsv            MJPEG (Intel Quick Sync Video acceleration) (codec mjpeg)
 V....D mjpeg_vaapi          MJPEG (VAAPI) (codec mjpeg)
 V..... mpeg2_qsv            MPEG-2 video (Intel Quick Sync Video acceleration) (codec mpeg2video)
 V....D mpeg2_vaapi          MPEG-2 (VAAPI) (codec mpeg2video)
 V....D vp8_vaapi            VP8 (VAAPI) (codec vp8)
 V....D vp9_vaapi            VP9 (VAAPI) (codec vp9)
 V..... vp9_qsv              VP9 video (Intel Quick Sync Video acceleration) (codec vp9)
test@test:~$ 

次にNVENCも使えるか確認します。

for i in buildconf hwaccels decoders filters encoders; do echo $i:; ffmpeg -hide_banner -${i} | egrep -i "npp|cuvid|nvenc|cuda|nvdec"; done

結果はこのようになると思います。

test@test:~$ for i in buildconf hwaccels decoders filters encoders; do echo $i:; ffmpeg -hide_banner -${i} | egrep -i "npp|cuvid|nvenc|cuda|nvdec"; done
buildconf:
    --enable-cuda-nvcc
    --enable-cuvid
    --enable-nvenc
    --enable-libnpp
    --extra-cflags=-I/usr/local/cuda-11.4/include
    --extra-ldflags=-L/usr/local/cuda-11.4/lib64
hwaccels:
cuda
decoders:
 V..... av1_cuvid            Nvidia CUVID AV1 decoder (codec av1)
 V..... h264_cuvid           Nvidia CUVID H264 decoder (codec h264)
 V..... hevc_cuvid           Nvidia CUVID HEVC decoder (codec hevc)
 V..... mjpeg_cuvid          Nvidia CUVID MJPEG decoder (codec mjpeg)
 V..... mpeg1_cuvid          Nvidia CUVID MPEG1VIDEO decoder (codec mpeg1video)
 V..... mpeg2_cuvid          Nvidia CUVID MPEG2VIDEO decoder (codec mpeg2video)
 V..... mpeg4_cuvid          Nvidia CUVID MPEG4 decoder (codec mpeg4)
 V..... vc1_cuvid            Nvidia CUVID VC1 decoder (codec vc1)
 V..... vp8_cuvid            Nvidia CUVID VP8 decoder (codec vp8)
 V..... vp9_cuvid            Nvidia CUVID VP9 decoder (codec vp9)
filters:
 ... hwupload_cuda     V->V       Upload a system memory frame to a CUDA device.
 ... overlay_cuda      VV->V      Overlay one video on top of another using CUDA
 ... scale_cuda        V->V       GPU accelerated video resizer
 ... scale_npp         V->V       NVIDIA Performance Primitives video scaling and format conversion
 ... thumbnail_cuda    V->V       Select the most representative frame in a given sequence of consecutive frames.
 ... transpose_npp     V->V       NVIDIA Performance Primitives video transpose
 T.. yadif_cuda        V->V       Deinterlace CUDA frames
encoders:
 V....D h264_nvenc           NVIDIA NVENC H.264 encoder (codec h264)
 V..... nvenc                NVIDIA NVENC H.264 encoder (codec h264)
 V..... nvenc_h264           NVIDIA NVENC H.264 encoder (codec h264)
 V..... nvenc_hevc           NVIDIA NVENC hevc encoder (codec hevc)
 V....D hevc_nvenc           NVIDIA NVENC hevc encoder (codec hevc)
test@test:~$

比較検証

VMAFについて

VMAF Video Multimethod Assessment Fusion はアメリカ南カリフォルニア大学と、フランスのナント大学デジタル科学研究所IPIラボ、アメリカテキサス大学オースティン校のイメージ&ビデオ工学研究室が協力し、Netflixが開発した動画の品質を評価するツールです。

比較した動画が近ければ近いほど100点になりますし、全く違っていれば0点になります。

詳しい紹介は弊社のさくらのナレッジに紹介記事がありますので、そちらを参考にしていただければ。

今回は上記記事を参考に、H.264の動画をH.265にトランスコードして変換速度や品質という点で評価をしていきたいと思います。

VMAF比較モデルデータの入手

wget https://github.com/Netflix/vmaf/archive/refs/heads/master.zip
unzip master.zip 'vmaf-master/model/*'
sudo cp -r vmaf-master/model /usr/local/share/

比較用動画の入手

今回は Creative Commons Attribution 3.0 で公開されている動画 Big Buck Bunny を使用します。
動画ライセンスについてはこちら https://peach.blender.org/about/

wget http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_30fps_normal.mp4

この動画のビットレートや長さなど詳細情報をffprobeコマンドで確認します。

test@test:~$ ffprobe -i bbb_sunflower_1080p_30fps_normal.mp4 
ffprobe version N-104716-g96caa01f13 Copyright (c) 2007-2021 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --prefix=/home/ubuntu/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ubuntu/ffmpeg_build/include --extra-ldflags=-L/home/ubuntu/ffmpeg_build/lib --enable-cuda-nvcc --nvccflags='-gencode arch=compute_52,code=sm_52 -O2' --enable-cuvid --enable-nvenc --enable-libnpp --extra-cflags=-I/usr/local/cuda-11.5/include --extra-ldflags=-L/usr/local/cuda-11.5/lib64 --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/ubuntu/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libvmaf --enable-vaapi --enable-libmfx --enable-nonfree
  libavutil      57.  9.101 / 57.  9.101
  libavcodec     59. 14.100 / 59. 14.100
  libavformat    59.  9.102 / 59.  9.102
  libavdevice    59.  0.101 / 59.  0.101
  libavfilter     8. 17.100 /  8. 17.100
  libswscale      6.  1.101 /  6.  1.101
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'bbb_sunflower_1080p_30fps_normal.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    creation_time   : 2013-12-16T17:44:39.000000Z
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
    composer        : Sacha Goedegebure
  Duration: 00:10:34.53, start: 0.000000, bitrate: 3481 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 2998 kb/s, 30 fps, 30 tbr, 30k tbn (default)
    Metadata:
      creation_time   : 2013-12-16T17:44:39.000000Z
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default)
    Metadata:
      creation_time   : 2013-12-16T17:44:42.000000Z
      handler_name    : GPAC ISO Audio Handler
      vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 320 kb/s (default)
    Metadata:
      creation_time   : 2013-12-16T17:44:42.000000Z
      handler_name    : GPAC ISO Audio Handler
      vendor_id       : [0][0][0][0]
    Side data:
      audio service type: main
ubuntu@test:~$ 
 Duration: 00:10:34.53, start: 0.000000, bitrate: 3481 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 2998 kb/s, 30 fps, 30 tbr, 30k tbn (default)

10分34秒53の長さで平均ビットレート3481 kb/s 1920x1080 30fps のh264のファイルというのが確認できました。

このままでは、動画の尺が長すぎるので、3分の動画に切り取り、音声トラックも不要なのでカットしたものを使用したいと思います。

ffmpeg -ss 15 -t 180 -i bbb_sunflower_1080p_30fps_normal.mp4 -vcodec copy -an -y base.mp4
ubuntu@test:~$ ffmpeg -ss 15 -t 180 -i bbb_sunflower_1080p_30fps_normal.mp4 -vcodec copy -an -y base.mp4
ffmpeg version N-104716-g96caa01f13 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --prefix=/home/ubuntu/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ubuntu/ffmpeg_build/include --extra-ldflags=-L/home/ubuntu/ffmpeg_build/lib --enable-cuda-nvcc --nvccflags='-gencode arch=compute_52,code=sm_52 -O2' --enable-cuvid --enable-nvenc --enable-libnpp --extra-cflags=-I/usr/local/cuda-11.5/include --extra-ldflags=-L/usr/local/cuda-11.5/lib64 --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/ubuntu/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libvmaf --enable-vaapi --enable-libmfx --enable-nonfree
  libavutil      57.  9.101 / 57.  9.101
  libavcodec     59. 14.100 / 59. 14.100
  libavformat    59.  9.102 / 59.  9.102
  libavdevice    59.  0.101 / 59.  0.101
  libavfilter     8. 17.100 /  8. 17.100
  libswscale      6.  1.101 /  6.  1.101
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'bbb_sunflower_1080p_30fps_normal.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    creation_time   : 2013-12-16T17:44:39.000000Z
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
    composer        : Sacha Goedegebure
  Duration: 00:10:34.53, start: 0.000000, bitrate: 3481 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 2998 kb/s, 30 fps, 30 tbr, 30k tbn (default)
    Metadata:
      creation_time   : 2013-12-16T17:44:39.000000Z
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default)
    Metadata:
      creation_time   : 2013-12-16T17:44:42.000000Z
      handler_name    : GPAC ISO Audio Handler
      vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 320 kb/s (default)
    Metadata:
      creation_time   : 2013-12-16T17:44:42.000000Z
      handler_name    : GPAC ISO Audio Handler
      vendor_id       : [0][0][0][0]
    Side data:
      audio service type: main
Output #0, mp4, to 'base.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    composer        : Sacha Goedegebure
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
    encoder         : Lavf59.9.102
  Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 2998 kb/s, 30 fps, 30 tbr, 30k tbn (default)
    Metadata:
      creation_time   : 2013-12-16T17:44:39.000000Z
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame= 5600 fps=0.0 q=-1.0 Lsize=   57406kB time=00:02:59.96 bitrate=2613.1kbits/s speed=2.5e+03x    
video:57344kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.107650%
ubuntu@test:~$

これで、平均ビットレート 2613.1kbits/s 容量 57406kB な base.mp4という動画ができあがります。

Duration: 00:03:00.07, start: 0.000000, bitrate: 2611 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 2608 kb/s, 30 fps, 30 tbr, 30k tbn (default)

動画の長さが ほぼ3分平均ビットレートが 2611 kb/sとなりました。また、音声トラックも無くなっています。

1.デフォルト設定での比較

特にビットレートや品質をいじらず、デフォルト設定で吐き出す動画での比較をまず行います。

X265

エンコード

x265でエンコードします。timeコマンドをつけて時間を測定します。

time ffmpeg -i base.mp4 -c:v libx265 -tag:v hvc1 -y encoded1_x265.mp4
ubuntu@test:~$ time ffmpeg -i base.mp4 -c:v libx265 -tag:v hvc1 -y encoded1_x265.mp4
ffmpeg version N-104716-g96caa01f13 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --prefix=/home/ubuntu/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ubuntu/ffmpeg_build/include --extra-ldflags=-L/home/ubuntu/ffmpeg_build/lib --enable-cuda-nvcc --nvccflags='-gencode arch=compute_52,code=sm_52 -O2' --enable-cuvid --enable-nvenc --enable-libnpp --extra-cflags=-I/usr/local/cuda-11.5/include --extra-ldflags=-L/usr/local/cuda-11.5/lib64 --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/ubuntu/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libvmaf --enable-vaapi --enable-libmfx --enable-nonfree
  libavutil      57.  9.101 / 57.  9.101
  libavcodec     59. 14.100 / 59. 14.100
  libavformat    59.  9.102 / 59.  9.102
  libavdevice    59.  0.101 / 59.  0.101
  libavfilter     8. 17.100 /  8. 17.100
  libswscale      6.  1.101 /  6.  1.101
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'base.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    encoder         : Lavf59.9.102
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
  Duration: 00:03:00.07, start: 0.000000, bitrate: 2611 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 2608 kb/s, 30 fps, 30 tbr, 30k tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265))
Press [q] to stop, [?] for help
x265 [info]: HEVC encoder version 3.2.1+1-b5c86a64bbbe
x265 [info]: build info [Linux][GCC 9.3.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2
x265 [info]: Main profile, Level-4 (Main tier)
x265 [info]: Thread pool created using 2 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 1 / wpp(17 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 3
x265 [info]: Keyframe min / max / scenecut / bias: 25 / 250 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / off / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-28.0 / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip signhide tmvp b-intra
x265 [info]: tools: strong-intra-smoothing lslices=6 deblock sao
Output #0, mp4, to 'encoded1_x265.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    genre           : Animation
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    encoder         : Lavf59.9.102
  Stream #0:0(und): Video: hevc (hvc1 / 0x31637668), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 30 fps, 15360 tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.14.100 libx265
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame= 5402 fps= 11 q=36.0 Lsize=   24645kB time=00:02:59.96 bitrate=1121.8kbits/s speed=0.355x     
video:24576kB audio:0kB subtitle:0kB other streams:0kB global headers:2kB muxing overhead: 0.282367%
x265 [info]: frame I:     44, Avg QP:23.79  kb/s: 32273.90
x265 [info]: frame P:   1446, Avg QP:29.02  kb/s: 2387.69 
x265 [info]: frame B:   3912, Avg QP:35.24  kb/s: 297.00  
x265 [info]: Weighted P-Frames: Y:0.1% UV:0.1%
x265 [info]: consecutive B-frames: 12.1% 5.0% 13.6% 46.9% 22.4% 

encoded 5402 frames in 506.12s (10.67 fps), 1117.09 kb/s, Avg QP:33.48

real	8m27.114s
user	16m25.939s
sys	0m0.793s
ubuntu@test:~$ 

エンコード時間は8分27秒 平均ビットレートは1117.09 kb/s QPの平均は33.48とのこと。
ファイル容量としては24645kBになりました。

VMAF

今度は、動画品質を比較します。3分そのまま比較するには時間がかかるので、冒頭30秒程度で比較します。

ffmpeg -i encoded1_x265.mp4 -i base.mp4 -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[aa]; \
[1:v]settb=AVTB,setpts=PTS-STARTPTS[bb]; \
[aa][bb]libvmaf=log_fmt=xml:log_path=/dev/stdout: \
model_path=/usr/local/share/model/vmaf_v0.6.1.json: \
n_threads=16:shortest=1:repeatlast=0" -an -f null -t 30 -
VMAF score: 90.875059

平均スコアは90.875059点です

IntelQSV

エンコード

time ffmpeg -hwaccel qsv -hwaccel_output_format qsv -c:v h264_qsv -i base.mp4 -c:v hevc_qsv -tag:v hvc1 -y encoded1_qsv.mp4
ubuntu@test:~$ time ffmpeg -hwaccel qsv -hwaccel_output_format qsv -c:v h264_qsv -i base.mp4 -c:v hevc_qsv -tag:v hvc1 -y encoded1_qsv.mp4
ffmpeg version N-104716-g96caa01f13 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --prefix=/home/ubuntu/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ubuntu/ffmpeg_build/include --extra-ldflags=-L/home/ubuntu/ffmpeg_build/lib --enable-cuda-nvcc --nvccflags='-gencode arch=compute_52,code=sm_52 -O2' --enable-cuvid --enable-nvenc --enable-libnpp --extra-cflags=-I/usr/local/cuda-11.5/include --extra-ldflags=-L/usr/local/cuda-11.5/lib64 --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/ubuntu/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libvmaf --enable-vaapi --enable-libmfx --enable-nonfree
  libavutil      57.  9.101 / 57.  9.101
  libavcodec     59. 14.100 / 59. 14.100
  libavformat    59.  9.102 / 59.  9.102
  libavdevice    59.  0.101 / 59.  0.101
  libavfilter     8. 17.100 /  8. 17.100
  libswscale      6.  1.101 /  6.  1.101
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'base.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    encoder         : Lavf59.9.102
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
  Duration: 00:03:00.07, start: 0.000000, bitrate: 2611 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 2608 kb/s, 30 fps, 30 tbr, 30k tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_qsv) -> hevc (hevc_qsv))
Press [q] to stop, [?] for help
Output #0, mp4, to 'encoded1_qsv.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    genre           : Animation
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    encoder         : Lavf59.9.102
  Stream #0:0(und): Video: hevc (hvc1 / 0x31637668), qsv(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 1000 kb/s, 30 fps, 15360 tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.14.100 hevc_qsv
    Side data:
      cpb: bitrate max/min/avg: 0/0/1000000 buffer size: 0 vbv_delay: N/A
[h264_qsv @ 0x55b379e9e980] A decode call did not consume any data: expect more data at input (-10)
    Last message repeated 2 times
frame= 5403 fps= 68 q=-0.0 Lsize=   18767kB time=00:02:59.93 bitrate= 854.4kbits/s speed=2.25x    
video:18696kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.375563%

real	1m20.087s
user	0m11.801s
sys	0m4.269s
ubuntu@test:~$ 

VMAF

ffmpeg -i encoded1_qsv.mp4 -i base.mp4 -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[aa]; \
[1:v]settb=AVTB,setpts=PTS-STARTPTS[bb]; \
[aa][bb]libvmaf=log_fmt=xml:log_path=/dev/stdout: \
model_path=/usr/local/share/model/vmaf_v0.6.1.json: \
n_threads=16:shortest=1:repeatlast=0" -an -f null -t 30 -
VMAF score: 61.542799

NVENC

エンコード

time ffmpeg -hwaccel cuda -hwaccel_output_format cuda -c:v h264_cuvid -i base.mp4 -c:v hevc_nvenc -tag:v hvc1 -y encoded1_nvenc.mp4
ubuntu@test:~$ time ffmpeg -hwaccel cuda -hwaccel_output_format cuda -c:v h264_cuvid -i base.mp4 -c:v hevc_nvenc -tag:v hvc1 -y encoded1_nvenc.mp4
ffmpeg version N-104716-g96caa01f13 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --prefix=/home/ubuntu/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ubuntu/ffmpeg_build/include --extra-ldflags=-L/home/ubuntu/ffmpeg_build/lib --enable-cuda-nvcc --nvccflags='-gencode arch=compute_52,code=sm_52 -O2' --enable-cuvid --enable-nvenc --enable-libnpp --extra-cflags=-I/usr/local/cuda-11.5/include --extra-ldflags=-L/usr/local/cuda-11.5/lib64 --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/ubuntu/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libvmaf --enable-vaapi --enable-libmfx --enable-nonfree
  libavutil      57.  9.101 / 57.  9.101
  libavcodec     59. 14.100 / 59. 14.100
  libavformat    59.  9.102 / 59.  9.102
  libavdevice    59.  0.101 / 59.  0.101
  libavfilter     8. 17.100 /  8. 17.100
  libswscale      6.  1.101 /  6.  1.101
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'base.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    encoder         : Lavf59.9.102
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
  Duration: 00:03:00.07, start: 0.000000, bitrate: 2611 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 2608 kb/s, 30 fps, 30 tbr, 30k tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_cuvid) -> hevc (hevc_nvenc))
Press [q] to stop, [?] for help
Output #0, mp4, to 'encoded1_nvenc.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    genre           : Animation
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    encoder         : Lavf59.9.102
  Stream #0:0(und): Video: hevc (Main) (hvc1 / 0x31637668), cuda(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 2000 kb/s, 30 fps, 15360 tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.14.100 hevc_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000 vbv_delay: N/A
frame= 5404 fps=448 q=24.0 Lsize=   46456kB time=00:03:00.10 bitrate=2113.1kbits/s dup=0 drop=196 speed=14.9x    
video:46433kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.049782%

real	0m12.366s
user	0m2.908s
sys	0m0.777s
ubuntu@test:~$

VMAF

ffmpeg -i encoded1_nvenc.mp4 -i base.mp4 -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[aa]; \
[1:v]settb=AVTB,setpts=PTS-STARTPTS[bb]; \
[aa][bb]libvmaf=log_fmt=xml:log_path=/dev/stdout: \
model_path=/usr/local/share/model/vmaf_v0.6.1.json: \
n_threads=16:shortest=1:repeatlast=0" -an -f null -t 30 -
VMAF score: 57.907177

デフォルト設定でのまとめ

元ファイル X265 IntelQSV NVEnc
容量 57406kB 24645kB 18767kB 46456kB
エンコード時間 - 8m27.114s 1m20.087s 0m12.366s
品質 100 90.875059 61.542799 57.907177

デフォルト設定では、どれも元ファイルからは小さくなりましたが、IntelQSVは品質の劣化が激しすぎました。
NVEncは高速ですが、容量も減らず、画質も低いという結果に。

パラメータ設定を色々いじらなければならないという点と、ソフトウェアエンコードのチューニングの高さを感じました。

2.ビットレート1500kbpsでの比較

今度はビットレートを全部同じにして測ります。

X265

エンコード

time ffmpeg -i base.mp4 -c:v libx265 -vb 1500k -tag:v hvc1 -y encoded2_x265.mp4
ubuntu@test:~$ time ffmpeg -i base.mp4 -c:v libx265 -vb 1500k -tag:v hvc1 -y encoded2_x265.mp4
ffmpeg version N-104716-g96caa01f13 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --prefix=/home/ubuntu/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ubuntu/ffmpeg_build/include --extra-ldflags=-L/home/ubuntu/ffmpeg_build/lib --enable-cuda-nvcc --nvccflags='-gencode arch=compute_52,code=sm_52 -O2' --enable-cuvid --enable-nvenc --enable-libnpp --extra-cflags=-I/usr/local/cuda-11.5/include --extra-ldflags=-L/usr/local/cuda-11.5/lib64 --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/ubuntu/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libvmaf --enable-vaapi --enable-libmfx --enable-nonfree
  libavutil      57.  9.101 / 57.  9.101
  libavcodec     59. 14.100 / 59. 14.100
  libavformat    59.  9.102 / 59.  9.102
  libavdevice    59.  0.101 / 59.  0.101
  libavfilter     8. 17.100 /  8. 17.100
  libswscale      6.  1.101 /  6.  1.101
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'base.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    encoder         : Lavf59.9.102
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
  Duration: 00:03:00.07, start: 0.000000, bitrate: 2611 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 2608 kb/s, 30 fps, 30 tbr, 30k tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265))
Press [q] to stop, [?] for help
x265 [info]: HEVC encoder version 3.2.1+1-b5c86a64bbbe
x265 [info]: build info [Linux][GCC 9.3.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2
x265 [info]: Main profile, Level-4 (Main tier)
x265 [info]: Thread pool created using 2 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 1 / wpp(17 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 3
x265 [info]: Keyframe min / max / scenecut / bias: 25 / 250 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / off / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : ABR-1500 kbps / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip signhide tmvp b-intra
x265 [info]: tools: strong-intra-smoothing lslices=6 deblock sao
Output #0, mp4, to 'encoded2_x265.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    genre           : Animation
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    encoder         : Lavf59.9.102
  Stream #0:0(und): Video: hevc (hvc1 / 0x31637668), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 1500 kb/s, 30 fps, 15360 tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.14.100 libx265
    Side data:
      cpb: bitrate max/min/avg: 0/0/1500000 buffer size: 0 vbv_delay: N/A
frame= 5402 fps=9.9 q=34.0 Lsize=   33230kB time=00:02:59.96 bitrate=1512.6kbits/s speed=0.331x    
video:33161kB audio:0kB subtitle:0kB other streams:0kB global headers:2kB muxing overhead: 0.209701%
x265 [info]: frame I:     44, Avg QP:21.05  kb/s: 42710.20
x265 [info]: frame P:   1446, Avg QP:25.93  kb/s: 3180.38 
x265 [info]: frame B:   3912, Avg QP:32.67  kb/s: 425.94  
x265 [info]: Weighted P-Frames: Y:0.1% UV:0.1%
x265 [info]: consecutive B-frames: 12.1% 5.0% 13.6% 46.9% 22.4% 

encoded 5402 frames in 542.08s (9.97 fps), 1507.66 kb/s, Avg QP:30.77

real	9m3.057s
user	17m34.614s
sys	0m0.845s
ubuntu@test:~$ 

VMAF

ffmpeg -i encoded2_x265.mp4 -i base.mp4 -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[aa]; \
[1:v]settb=AVTB,setpts=PTS-STARTPTS[bb]; \
[aa][bb]libvmaf=log_fmt=xml:log_path=/dev/stdout: \
model_path=/usr/local/share/model/vmaf_v0.6.1.json: \
n_threads=16:shortest=1:repeatlast=0" -an -f null -t 30 -
VMAF score: 89.445395

IntelQSV

エンコード

time ffmpeg -hwaccel qsv -hwaccel_output_format qsv -c:v h264_qsv -i base.mp4 -c:v hevc_qsv -vb 1500k -tag:v hvc1 -y encoded2_qsv.mp4
ubuntu@test:~$ time ffmpeg -hwaccel qsv -hwaccel_output_format qsv -c:v h264_qsv -i base.mp4 -c:v hevc_qsv -vb 1500k -tag:v hvc1 -y encoded2_qsv.mp4
ffmpeg version N-104716-g96caa01f13 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --prefix=/home/ubuntu/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ubuntu/ffmpeg_build/include --extra-ldflags=-L/home/ubuntu/ffmpeg_build/lib --enable-cuda-nvcc --nvccflags='-gencode arch=compute_52,code=sm_52 -O2' --enable-cuvid --enable-nvenc --enable-libnpp --extra-cflags=-I/usr/local/cuda-11.5/include --extra-ldflags=-L/usr/local/cuda-11.5/lib64 --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/ubuntu/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libvmaf --enable-vaapi --enable-libmfx --enable-nonfree
  libavutil      57.  9.101 / 57.  9.101
  libavcodec     59. 14.100 / 59. 14.100
  libavformat    59.  9.102 / 59.  9.102
  libavdevice    59.  0.101 / 59.  0.101
  libavfilter     8. 17.100 /  8. 17.100
  libswscale      6.  1.101 /  6.  1.101
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'base.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    encoder         : Lavf59.9.102
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
  Duration: 00:03:00.07, start: 0.000000, bitrate: 2611 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 2608 kb/s, 30 fps, 30 tbr, 30k tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_qsv) -> hevc (hevc_qsv))
Press [q] to stop, [?] for help
Output #0, mp4, to 'encoded2_qsv.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    genre           : Animation
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    encoder         : Lavf59.9.102
  Stream #0:0(und): Video: hevc (hvc1 / 0x31637668), qsv(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 1500 kb/s, 30 fps, 15360 tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.14.100 hevc_qsv
    Side data:
      cpb: bitrate max/min/avg: 0/0/1500000 buffer size: 0 vbv_delay: N/A
[h264_qsv @ 0x5648a970d9c0] A decode call did not consume any data: expect more data at input (-10)
    Last message repeated 2 times
frame= 5403 fps= 67 q=-0.0 Lsize=   29281kB time=00:02:59.93 bitrate=1333.1kbits/s speed=2.23x    
video:29210kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.240921%

real	1m20.839s
user	0m11.740s
sys	0m4.166s

VMAF

ffmpeg -i encoded2_qsv.mp4 -i base.mp4 -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[aa]; \
[1:v]settb=AVTB,setpts=PTS-STARTPTS[bb]; \
[aa][bb]libvmaf=log_fmt=xml:log_path=/dev/stdout: \
model_path=/usr/local/share/model/vmaf_v0.6.1.json: \
n_threads=16:shortest=1:repeatlast=0" -an -f null -t 30 -
VMAF score: 69.507522

NVENC

エンコード

time ffmpeg -hwaccel cuda -hwaccel_output_format cuda -c:v h264_cuvid -i base.mp4 -c:v hevc_nvenc -vb 1500k -tag:v hvc1 -y encoded2_nvenc.mp4
ubuntu@test:~$ time ffmpeg -hwaccel cuda -hwaccel_output_format cuda -c:v h264_cuvid -i base.mp4 -c:v hevc_nvenc -vb 1500k -tag:v hvc1 -y encoded2_nvenc.mp4
ffmpeg version N-104716-g96caa01f13 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --prefix=/home/ubuntu/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ubuntu/ffmpeg_build/include --extra-ldflags=-L/home/ubuntu/ffmpeg_build/lib --enable-cuda-nvcc --nvccflags='-gencode arch=compute_52,code=sm_52 -O2' --enable-cuvid --enable-nvenc --enable-libnpp --extra-cflags=-I/usr/local/cuda-11.5/include --extra-ldflags=-L/usr/local/cuda-11.5/lib64 --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/ubuntu/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libvmaf --enable-vaapi --enable-libmfx --enable-nonfree
  libavutil      57.  9.101 / 57.  9.101
  libavcodec     59. 14.100 / 59. 14.100
  libavformat    59.  9.102 / 59.  9.102
  libavdevice    59.  0.101 / 59.  0.101
  libavfilter     8. 17.100 /  8. 17.100
  libswscale      6.  1.101 /  6.  1.101
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'base.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    encoder         : Lavf59.9.102
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
  Duration: 00:03:00.07, start: 0.000000, bitrate: 2611 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 2608 kb/s, 30 fps, 30 tbr, 30k tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_cuvid) -> hevc (hevc_nvenc))
Press [q] to stop, [?] for help
Output #0, mp4, to 'encoded2_nvenc.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    genre           : Animation
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    encoder         : Lavf59.9.102
  Stream #0:0(und): Video: hevc (Main) (hvc1 / 0x31637668), cuda(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 1500 kb/s, 30 fps, 15360 tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.14.100 hevc_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/1500000 buffer size: 3000000 vbv_delay: N/A
frame= 5404 fps=447 q=26.0 Lsize=   35671kB time=00:03:00.10 bitrate=1622.5kbits/s dup=0 drop=196 speed=14.9x    
video:35648kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.064404%

real	0m12.364s
user	0m3.036s
sys	0m0.625s

VMAF

ffmpeg -i encoded2_nvenc.mp4 -i base.mp4 -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[aa]; \
[1:v]settb=AVTB,setpts=PTS-STARTPTS[bb]; \
[aa][bb]libvmaf=log_fmt=xml:log_path=/dev/stdout: \
model_path=/usr/local/share/model/vmaf_v0.6.1.json: \
n_threads=16:shortest=1:repeatlast=0" -an -f null -t 30 -
VMAF score: 56.520844

ビットレート1500kbpsでのまとめ

元ファイル X265 IntelQSV NVEnc
容量 57406kB 33230kB 29281kB 35671kB
エンコード時間 - 9m3.057s 1m20.839s 0m12.364s
品質 100 89.445395 69.507522 56.520844

QSVは容量としては一番小さいですが、画質がいまひとつな感じ、NVEncは画質の割に容量が大きいと、速さだけが取り柄な感じに

3.ビットレート1000kbpsでの比較

X265

エンコード

time ffmpeg -i base.mp4 -c:v libx265 -vb 1000k -tag:v hvc1 -y encoded3_x265.mp4
ubuntu@test:~$ time ffmpeg -i base.mp4 -c:v libx265 -vb 1000k -tag:v hvc1 -y encoded3_x265.mp4
ffmpeg version N-104716-g96caa01f13 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --prefix=/home/ubuntu/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ubuntu/ffmpeg_build/include --extra-ldflags=-L/home/ubuntu/ffmpeg_build/lib --enable-cuda-nvcc --nvccflags='-gencode arch=compute_52,code=sm_52 -O2' --enable-cuvid --enable-nvenc --enable-libnpp --extra-cflags=-I/usr/local/cuda-11.5/include --extra-ldflags=-L/usr/local/cuda-11.5/lib64 --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/ubuntu/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libvmaf --enable-vaapi --enable-libmfx --enable-nonfree
  libavutil      57.  9.101 / 57.  9.101
  libavcodec     59. 14.100 / 59. 14.100
  libavformat    59.  9.102 / 59.  9.102
  libavdevice    59.  0.101 / 59.  0.101
  libavfilter     8. 17.100 /  8. 17.100
  libswscale      6.  1.101 /  6.  1.101
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'base.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    encoder         : Lavf59.9.102
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
  Duration: 00:03:00.07, start: 0.000000, bitrate: 2611 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 2608 kb/s, 30 fps, 30 tbr, 30k tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265))
Press [q] to stop, [?] for help
x265 [info]: HEVC encoder version 3.2.1+1-b5c86a64bbbe
x265 [info]: build info [Linux][GCC 9.3.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2
x265 [info]: Main profile, Level-4 (Main tier)
x265 [info]: Thread pool created using 2 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 1 / wpp(17 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 3
x265 [info]: Keyframe min / max / scenecut / bias: 25 / 250 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / off / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : ABR-1000 kbps / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip signhide tmvp b-intra
x265 [info]: tools: strong-intra-smoothing lslices=6 deblock sao
Output #0, mp4, to 'encoded3_x265.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    genre           : Animation
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    encoder         : Lavf59.9.102
  Stream #0:0(und): Video: hevc (hvc1 / 0x31637668), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 1000 kb/s, 30 fps, 15360 tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.14.100 libx265
    Side data:
      cpb: bitrate max/min/avg: 0/0/1000000 buffer size: 0 vbv_delay: N/A
frame= 5402 fps= 11 q=37.0 Lsize=   22257kB time=00:02:59.96 bitrate=1013.1kbits/s speed=0.362x    
video:22187kB audio:0kB subtitle:0kB other streams:0kB global headers:2kB muxing overhead: 0.312640%
x265 [info]: frame I:     44, Avg QP:24.26  kb/s: 30861.06
x265 [info]: frame P:   1446, Avg QP:29.50  kb/s: 2045.53 
x265 [info]: frame B:   3912, Avg QP:36.03  kb/s: 289.32  
x265 [info]: Weighted P-Frames: Y:0.1% UV:0.1%
x265 [info]: consecutive B-frames: 12.1% 5.0% 13.6% 46.9% 22.4% 

encoded 5402 frames in 496.52s (10.88 fps), 1008.43 kb/s, Avg QP:34.18

real	8m17.488s
user	16m7.761s
sys	0m0.773s
ubuntu@test:~$ 

VMAF

ffmpeg -i encoded3_x265.mp4 -i base.mp4 -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[aa]; \
[1:v]settb=AVTB,setpts=PTS-STARTPTS[bb]; \
[aa][bb]libvmaf=log_fmt=xml:log_path=/dev/stdout: \
model_path=/usr/local/share/model/vmaf_v0.6.1.json: \
n_threads=16:shortest=1:repeatlast=0" -an -f null -t 30 -
VMAF score: 84.688443

IntelQSV

エンコード

time ffmpeg -hwaccel qsv -hwaccel_output_format qsv -c:v h264_qsv -i base.mp4 -c:v hevc_qsv -vb 1000k -tag:v hvc1 -y encoded3_qsv.mp4
ubuntu@test:~$ time ffmpeg -hwaccel qsv -hwaccel_output_format qsv -c:v h264_qsv  -i base.mp4 -c:v hevc_qsv -vb 1000k -tag:v hvc1 -y encoded3_qsv.mp4
ffmpeg version N-104716-g96caa01f13 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --prefix=/home/ubuntu/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ubuntu/ffmpeg_build/include --extra-ldflags=-L/home/ubuntu/ffmpeg_build/lib --enable-cuda-nvcc --nvccflags='-gencode arch=compute_52,code=sm_52 -O2' --enable-cuvid --enable-nvenc --enable-libnpp --extra-cflags=-I/usr/local/cuda-11.5/include --extra-ldflags=-L/usr/local/cuda-11.5/lib64 --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/ubuntu/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libvmaf --enable-vaapi --enable-libmfx --enable-nonfree
  libavutil      57.  9.101 / 57.  9.101
  libavcodec     59. 14.100 / 59. 14.100
  libavformat    59.  9.102 / 59.  9.102
  libavdevice    59.  0.101 / 59.  0.101
  libavfilter     8. 17.100 /  8. 17.100
  libswscale      6.  1.101 /  6.  1.101
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'base.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    encoder         : Lavf59.9.102
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
  Duration: 00:03:00.07, start: 0.000000, bitrate: 2611 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 2608 kb/s, 30 fps, 30 tbr, 30k tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_qsv) -> hevc (hevc_qsv))
Press [q] to stop, [?] for help
Output #0, mp4, to 'encoded3_qsv.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    genre           : Animation
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    encoder         : Lavf59.9.102
  Stream #0:0(und): Video: hevc (hvc1 / 0x31637668), qsv(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 1000 kb/s, 30 fps, 15360 tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.14.100 hevc_qsv
    Side data:
      cpb: bitrate max/min/avg: 0/0/1000000 buffer size: 0 vbv_delay: N/A
[h264_qsv @ 0x564179dc39c0] A decode call did not consume any data: expect more data at input (-10)
    Last message repeated 2 times
frame= 5403 fps= 68 q=-0.0 Lsize=   18767kB time=00:02:59.93 bitrate= 854.4kbits/s speed=2.26x    
video:18696kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.375563%

real	1m19.657s
user	0m11.701s
sys	0m4.231s
ubuntu@test:~$ 

VMAF

ffmpeg -i encoded3_qsv.mp4 -i base.mp4 -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[aa]; \
[1:v]settb=AVTB,setpts=PTS-STARTPTS[bb]; \
[aa][bb]libvmaf=log_fmt=xml:log_path=/dev/stdout: \
model_path=/usr/local/share/model/vmaf_v0.6.1.json: \
n_threads=16:shortest=1:repeatlast=0" -an -f null -t 30 -
VMAF score: 61.542799

NVENC

エンコード

time ffmpeg -hwaccel cuda -hwaccel_output_format cuda -c:v h264_cuvid -i base.mp4 -c:v hevc_nvenc -vb 1000k -tag:v hvc1 -y encoded3_nvenc.mp4
ubuntu@test:~$ time ffmpeg -hwaccel cuda -hwaccel_output_format cuda -c:v h264_cuvid -i base.mp4 -c:v hevc_nvenc -vb 1000k -tag:v hvc1 -y encoded3_nvenc.mp4
ffmpeg version N-104716-g96caa01f13 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --prefix=/home/ubuntu/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ubuntu/ffmpeg_build/include --extra-ldflags=-L/home/ubuntu/ffmpeg_build/lib --enable-cuda-nvcc --nvccflags='-gencode arch=compute_52,code=sm_52 -O2' --enable-cuvid --enable-nvenc --enable-libnpp --extra-cflags=-I/usr/local/cuda-11.5/include --extra-ldflags=-L/usr/local/cuda-11.5/lib64 --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/ubuntu/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libvmaf --enable-vaapi --enable-libmfx --enable-nonfree
  libavutil      57.  9.101 / 57.  9.101
  libavcodec     59. 14.100 / 59. 14.100
  libavformat    59.  9.102 / 59.  9.102
  libavdevice    59.  0.101 / 59.  0.101
  libavfilter     8. 17.100 /  8. 17.100
  libswscale      6.  1.101 /  6.  1.101
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'base.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    encoder         : Lavf59.9.102
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
  Duration: 00:03:00.07, start: 0.000000, bitrate: 2611 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 2608 kb/s, 30 fps, 30 tbr, 30k tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_cuvid) -> hevc (hevc_nvenc))
Press [q] to stop, [?] for help
Output #0, mp4, to 'encoded3_nvenc.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    genre           : Animation
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    encoder         : Lavf59.9.102
  Stream #0:0(und): Video: hevc (Main) (hvc1 / 0x31637668), cuda(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 1000 kb/s, 30 fps, 15360 tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.14.100 hevc_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/1000000 buffer size: 2000000 vbv_delay: N/A
frame= 5404 fps=445 q=29.0 Lsize=   24597kB time=00:03:00.10 bitrate=1118.8kbits/s dup=0 drop=196 speed=14.8x    
video:24574kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.092730%

real	0m12.409s
user	0m2.938s
sys	0m0.640s
ubuntu@test:~$ 

VMAF

ffmpeg -i encoded3_nvenc.mp4 -i base.mp4 -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[aa]; \
[1:v]settb=AVTB,setpts=PTS-STARTPTS[bb]; \
[aa][bb]libvmaf=log_fmt=xml:log_path=/dev/stdout: \
model_path=/usr/local/share/model/vmaf_v0.6.1.json: \
n_threads=16:shortest=1:repeatlast=0" -an -f null -t 30 -
VMAF score: 53.518960

ビットレート1000kbpsでのまとめ

元ファイル X265 IntelQSV NVEnc
容量 57406kB 22257kB 18767kB 24597kB
エンコード時間 - 8m17.488s 1m19.657s 0m12.409s
品質 100 84.688443 61.542799 53.518960

ここでも容量が少なかったのはQSVですが、やはり、品質もそれなりという記録に。
NVEncは早いけど品質がという点はやはり変わらず。

4.qP20での比較

qPはH264やH265で行われてる離散コサイン変換の量子化におけるパラメータの一つで、数字が少なければ少ないほど画質が向上し0の場合量子化を行わないため可逆圧縮となる。

X265

エンコード

time ffmpeg -i base.mp4 -c:v libx265 -crf 20 -tag:v hvc1 -y encoded4_x265.mp4
ubuntu@test:~$ time ffmpeg -i base.mp4 -c:v libx265 -crf 20  -tag:v hvc1 -y encoded4_x265.mp4
ffmpeg version N-104716-g96caa01f13 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --prefix=/home/ubuntu/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ubuntu/ffmpeg_build/include --extra-ldflags=-L/home/ubuntu/ffmpeg_build/lib --enable-cuda-nvcc --nvccflags='-gencode arch=compute_52,code=sm_52 -O2' --enable-cuvid --enable-nvenc --enable-libnpp --extra-cflags=-I/usr/local/cuda-11.5/include --extra-ldflags=-L/usr/local/cuda-11.5/lib64 --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/ubuntu/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libvmaf --enable-vaapi --enable-libmfx --enable-nonfree
  libavutil      57.  9.101 / 57.  9.101
  libavcodec     59. 14.100 / 59. 14.100
  libavformat    59.  9.102 / 59.  9.102
  libavdevice    59.  0.101 / 59.  0.101
  libavfilter     8. 17.100 /  8. 17.100
  libswscale      6.  1.101 /  6.  1.101
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'base.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    encoder         : Lavf59.9.102
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
  Duration: 00:03:00.07, start: 0.000000, bitrate: 2611 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 2608 kb/s, 30 fps, 30 tbr, 30k tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265))
Press [q] to stop, [?] for help
x265 [info]: HEVC encoder version 3.2.1+1-b5c86a64bbbe
x265 [info]: build info [Linux][GCC 9.3.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2
x265 [info]: Main profile, Level-4 (Main tier)
x265 [info]: Thread pool created using 2 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 1 / wpp(17 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 3
x265 [info]: Keyframe min / max / scenecut / bias: 25 / 250 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / off / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-20.0 / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip signhide tmvp b-intra
x265 [info]: tools: strong-intra-smoothing lslices=6 deblock sao
Output #0, mp4, to 'encoded4_x265.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    genre           : Animation
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    encoder         : Lavf59.9.102
  Stream #0:0(und): Video: hevc (hvc1 / 0x31637668), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 30 fps, 15360 tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.14.100 libx265
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame= 5402 fps=8.5 q=28.0 Lsize=   67010kB time=00:02:59.96 bitrate=3050.3kbits/s speed=0.282x     
video:66940kB audio:0kB subtitle:0kB other streams:0kB global headers:2kB muxing overhead: 0.104675%
x265 [info]: frame I:     44, Avg QP:15.80  kb/s: 68891.00
x265 [info]: frame P:   1446, Avg QP:20.51  kb/s: 7221.56 
x265 [info]: frame B:   3912, Avg QP:27.02  kb/s: 759.82  
x265 [info]: Weighted P-Frames: Y:0.1% UV:0.1%
x265 [info]: consecutive B-frames: 12.1% 5.0% 13.6% 46.9% 22.4% 

encoded 5402 frames in 636.93s (8.48 fps), 3044.43 kb/s, Avg QP:25.19

real	10m37.926s
user	20m34.709s
sys	0m0.929s
ubuntu@test:~$ 

VMAF

ffmpeg -i encoded4_x265.mp4 -i base.mp4 -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[aa]; \
[1:v]settb=AVTB,setpts=PTS-STARTPTS[bb]; \
[aa][bb]libvmaf=log_fmt=xml:log_path=/dev/stdout: \
model_path=/usr/local/share/model/vmaf_v0.6.1.json: \
n_threads=16:shortest=1:repeatlast=0" -an -f null -t 30 -
VMAF score: 96.116558

IntelQSV

エンコード

time ffmpeg -hwaccel qsv -hwaccel_output_format qsv -c:v h264_qsv -i base.mp4 -c:v hevc_qsv -q 20 -tag:v hvc1 -y encoded4_qsv.mp4
ubuntu@test:~$ time ffmpeg -hwaccel qsv -hwaccel_output_format qsv -c:v h264_qsv -i base.mp4 -c:v hevc_qsv -q 20 -tag:v hvc1 -y encoded4_qsv.mp4
ffmpeg version N-104716-g96caa01f13 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --prefix=/home/ubuntu/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ubuntu/ffmpeg_build/include --extra-ldflags=-L/home/ubuntu/ffmpeg_build/lib --enable-cuda-nvcc --nvccflags='-gencode arch=compute_52,code=sm_52 -O2' --enable-cuvid --enable-nvenc --enable-libnpp --extra-cflags=-I/usr/local/cuda-11.5/include --extra-ldflags=-L/usr/local/cuda-11.5/lib64 --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/ubuntu/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libvmaf --enable-vaapi --enable-libmfx --enable-nonfree
  libavutil      57.  9.101 / 57.  9.101
  libavcodec     59. 14.100 / 59. 14.100
  libavformat    59.  9.102 / 59.  9.102
  libavdevice    59.  0.101 / 59.  0.101
  libavfilter     8. 17.100 /  8. 17.100
  libswscale      6.  1.101 /  6.  1.101
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'base.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    encoder         : Lavf59.9.102
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
  Duration: 00:03:00.07, start: 0.000000, bitrate: 2611 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 2608 kb/s, 30 fps, 30 tbr, 30k tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_qsv) -> hevc (hevc_qsv))
Press [q] to stop, [?] for help
Output #0, mp4, to 'encoded4_qsv.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    genre           : Animation
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    encoder         : Lavf59.9.102
  Stream #0:0(und): Video: hevc (hvc1 / 0x31637668), qsv(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 1000 kb/s, 30 fps, 15360 tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.14.100 hevc_qsv
    Side data:
      cpb: bitrate max/min/avg: 0/0/1000000 buffer size: 0 vbv_delay: N/A
[h264_qsv @ 0x55c4959db240] A decode call did not consume any data: expect more data at input (-10)
    Last message repeated 2 times
frame= 5403 fps= 71 q=-0.0 Lsize=   63605kB time=00:02:59.93 bitrate=2895.8kbits/s speed=2.35x    
video:63540kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.103299%

real	1m16.614s
user	0m10.170s
sys	0m4.166s
ubuntu@test:~$  

VMAF

ffmpeg -i encoded4_qsv.mp4 -i base.mp4 -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[aa]; \
[1:v]settb=AVTB,setpts=PTS-STARTPTS[bb]; \
[aa][bb]libvmaf=log_fmt=xml:log_path=/dev/stdout: \
model_path=/usr/local/share/model/vmaf_v0.6.1.json: \
n_threads=16:shortest=1:repeatlast=0" -an -f null -t 30 -
VMAF score: 76.933815

NVENC

エンコード

time ffmpeg -hwaccel cuda -hwaccel_output_format cuda -c:v h264_cuvid -i base.mp4 -c:v hevc_nvenc -cq 20 -tag:v hvc1 -y encoded4_nvenc.mp4
ubuntu@test:~$ time ffmpeg -hwaccel cuda -hwaccel_output_format cuda -c:v h264_cuvid -i base.mp4 -c:v hevc_nvenc -cq 20 -tag:v hvc1 -y encoded4_nvenc.mp4
ffmpeg version N-104716-g96caa01f13 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --prefix=/home/ubuntu/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ubuntu/ffmpeg_build/include --extra-ldflags=-L/home/ubuntu/ffmpeg_build/lib --enable-cuda-nvcc --nvccflags='-gencode arch=compute_52,code=sm_52 -O2' --enable-cuvid --enable-nvenc --enable-libnpp --extra-cflags=-I/usr/local/cuda-11.5/include --extra-ldflags=-L/usr/local/cuda-11.5/lib64 --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/ubuntu/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libvmaf --enable-vaapi --enable-libmfx --enable-nonfree
  libavutil      57.  9.101 / 57.  9.101
  libavcodec     59. 14.100 / 59. 14.100
  libavformat    59.  9.102 / 59.  9.102
  libavdevice    59.  0.101 / 59.  0.101
  libavfilter     8. 17.100 /  8. 17.100
  libswscale      6.  1.101 /  6.  1.101
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'base.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    encoder         : Lavf59.9.102
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
  Duration: 00:03:00.07, start: 0.000000, bitrate: 2611 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 2608 kb/s, 30 fps, 30 tbr, 30k tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_cuvid) -> hevc (hevc_nvenc))
Press [q] to stop, [?] for help
Output #0, mp4, to 'encoded4_nvenc.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    genre           : Animation
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    encoder         : Lavf59.9.102
  Stream #0:0(und): Video: hevc (Main) (hvc1 / 0x31637668), cuda(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 30 fps, 15360 tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.14.100 hevc_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 4000000 vbv_delay: N/A
frame= 5404 fps=421 q=12.0 Lsize=  181398kB time=00:03:00.10 bitrate=8251.0kbits/s dup=0 drop=196 speed=  14x    
video:181373kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.013716%

real	0m13.124s
user	0m3.218s
sys	0m0.996s
ubuntu@test:~$ 

VMAF

ffmpeg -i encoded4_nvenc.mp4 -i base.mp4 -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[aa]; \
[1:v]settb=AVTB,setpts=PTS-STARTPTS[bb]; \
[aa][bb]libvmaf=log_fmt=xml:log_path=/dev/stdout: \
model_path=/usr/local/share/model/vmaf_v0.6.1.json: \
n_threads=16:shortest=1:repeatlast=0" -an -f null -t 30 -
VMAF score: 61.453680

qP20でのでのまとめ

元ファイル X265 IntelQSV NVEnc
容量 57406kB 67010kB 63605kB 181398kB
エンコード時間 - 10m37.926s 1m16.614s 0m13.124s
品質 100 96.116558 76.933815 61.453680

QP指定しての圧縮だと、QSVもなかなか良い値に持ってくる。
NVEncは使用してるカードがBフレーム圧縮非対応なので、それが原因なのか非常に大きいファイルが出来上がってしまった。
その割に品質が劣っているのでどうしようもない。

5.qP35での比較

X265

エンコード

time ffmpeg -i base.mp4 -c:v libx265 -crf 35  -tag:v hvc1 -y encoded5_x265.mp4
ubuntu@test:~$ time ffmpeg -i base.mp4 -c:v libx265 -crf 35  -tag:v hvc1 -y encoded5_x265.mp4
ffmpeg version N-104716-g96caa01f13 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --prefix=/home/ubuntu/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ubuntu/ffmpeg_build/include --extra-ldflags=-L/home/ubuntu/ffmpeg_build/lib --enable-cuda-nvcc --nvccflags='-gencode arch=compute_52,code=sm_52 -O2' --enable-cuvid --enable-nvenc --enable-libnpp --extra-cflags=-I/usr/local/cuda-11.5/include --extra-ldflags=-L/usr/local/cuda-11.5/lib64 --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/ubuntu/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libvmaf --enable-vaapi --enable-libmfx --enable-nonfree
  libavutil      57.  9.101 / 57.  9.101
  libavcodec     59. 14.100 / 59. 14.100
  libavformat    59.  9.102 / 59.  9.102
  libavdevice    59.  0.101 / 59.  0.101
  libavfilter     8. 17.100 /  8. 17.100
  libswscale      6.  1.101 /  6.  1.101
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'base.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    encoder         : Lavf59.9.102
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
  Duration: 00:03:00.07, start: 0.000000, bitrate: 2611 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 2608 kb/s, 30 fps, 30 tbr, 30k tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265))
Press [q] to stop, [?] for help
x265 [info]: HEVC encoder version 3.2.1+1-b5c86a64bbbe
x265 [info]: build info [Linux][GCC 9.3.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2
x265 [info]: Main profile, Level-4 (Main tier)
x265 [info]: Thread pool created using 2 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 1 / wpp(17 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 3
x265 [info]: Keyframe min / max / scenecut / bias: 25 / 250 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / off / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-35.0 / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip signhide tmvp b-intra
x265 [info]: tools: strong-intra-smoothing lslices=6 deblock sao
Output #0, mp4, to 'encoded5_x265.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    genre           : Animation
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    encoder         : Lavf59.9.102
  Stream #0:0(und): Video: hevc (hvc1 / 0x31637668), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 30 fps, 15360 tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.14.100 libx265
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame= 5402 fps= 13 q=43.0 Lsize=   10350kB time=00:02:59.96 bitrate= 471.1kbits/s speed=0.42x     
video:10281kB audio:0kB subtitle:0kB other streams:0kB global headers:2kB muxing overhead: 0.672828%
x265 [info]: frame I:     44, Avg QP:30.80  kb/s: 14992.60
x265 [info]: frame P:   1446, Avg QP:36.75  kb/s: 907.22  
x265 [info]: frame B:   3912, Avg QP:42.40  kb/s: 140.59  
x265 [info]: Weighted P-Frames: Y:0.1% UV:0.1%
x265 [info]: consecutive B-frames: 12.1% 5.0% 13.6% 46.9% 22.4% 

encoded 5402 frames in 427.98s (12.62 fps), 466.78 kb/s, Avg QP:40.79

real	7m8.962s
user	13m55.681s
sys	0m0.793s
ubuntu@test:~$ 

VMAF

ffmpeg -i encoded5_x265.mp4 -i base.mp4 -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[aa]; \
[1:v]settb=AVTB,setpts=PTS-STARTPTS[bb]; \
[aa][bb]libvmaf=log_fmt=xml:log_path=/dev/stdout: \
model_path=/usr/local/share/model/vmaf_v0.6.1.json: \
n_threads=16:shortest=1:repeatlast=0" -an -f null -t 30 -
VMAF score: 78.392523

IntelQSV

エンコード

time ffmpeg -hwaccel qsv -hwaccel_output_format qsv -c:v h264_qsv  -i base.mp4 -c:v hevc_qsv -q 35 -tag:v hvc1 -y encoded5_qsv.mp4
ubuntu@test:~$ time ffmpeg -hwaccel qsv -hwaccel_output_format qsv -c:v h264_qsv  -i base.mp4 -c:v hevc_qsv -q 35 -tag:v hvc1 -y encoded5_qsv.mp4
ffmpeg version N-104716-g96caa01f13 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --prefix=/home/ubuntu/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ubuntu/ffmpeg_build/include --extra-ldflags=-L/home/ubuntu/ffmpeg_build/lib --enable-cuda-nvcc --nvccflags='-gencode arch=compute_52,code=sm_52 -O2' --enable-cuvid --enable-nvenc --enable-libnpp --extra-cflags=-I/usr/local/cuda-11.5/include --extra-ldflags=-L/usr/local/cuda-11.5/lib64 --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/ubuntu/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libvmaf --enable-vaapi --enable-libmfx --enable-nonfree
  libavutil      57.  9.101 / 57.  9.101
  libavcodec     59. 14.100 / 59. 14.100
  libavformat    59.  9.102 / 59.  9.102
  libavdevice    59.  0.101 / 59.  0.101
  libavfilter     8. 17.100 /  8. 17.100
  libswscale      6.  1.101 /  6.  1.101
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'base.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    encoder         : Lavf59.9.102
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
  Duration: 00:03:00.07, start: 0.000000, bitrate: 2611 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 2608 kb/s, 30 fps, 30 tbr, 30k tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_qsv) -> hevc (hevc_qsv))
Press [q] to stop, [?] for help
Output #0, mp4, to 'encoded5_qsv.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    genre           : Animation
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    encoder         : Lavf59.9.102
  Stream #0:0(und): Video: hevc (hvc1 / 0x31637668), qsv(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 1000 kb/s, 30 fps, 15360 tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.14.100 hevc_qsv
    Side data:
      cpb: bitrate max/min/avg: 0/0/1000000 buffer size: 0 vbv_delay: N/A
[h264_qsv @ 0x555e6b934240] A decode call did not consume any data: expect more data at input (-10)
    Last message repeated 2 times
frame= 5403 fps= 74 q=-0.0 Lsize=   10471kB time=00:02:59.93 bitrate= 476.7kbits/s speed=2.47x    
video:10407kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.622844%

real	1m12.999s
user	0m10.296s
sys	0m3.795s
ubuntu@test:~$ 

VMAF

ffmpeg -i encoded5_qsv.mp4 -i base.mp4 -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[aa]; \
[1:v]settb=AVTB,setpts=PTS-STARTPTS[bb]; \
[aa][bb]libvmaf=log_fmt=xml:log_path=/dev/stdout: \
model_path=/usr/local/share/model/vmaf_v0.6.1.json: \
n_threads=16:shortest=1:repeatlast=0" -an -f null -t 30 -
VMAF score: 65.246589

NVENC

エンコード

time ffmpeg -hwaccel cuda -hwaccel_output_format cuda -c:v h264_cuvid -i base.mp4 -c:v hevc_nvenc -cq 35 -tag:v hvc1 -y encoded5_nvenc.mp4
ubuntu@test:~$ time ffmpeg -hwaccel cuda -hwaccel_output_format cuda -c:v h264_cuvid -i base.mp4 -c:v hevc_nvenc -cq 35 -tag:v hvc1 -y encoded5_nvenc.mp4
ffmpeg version N-104716-g96caa01f13 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --prefix=/home/ubuntu/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ubuntu/ffmpeg_build/include --extra-ldflags=-L/home/ubuntu/ffmpeg_build/lib --enable-cuda-nvcc --nvccflags='-gencode arch=compute_52,code=sm_52 -O2' --enable-cuvid --enable-nvenc --enable-libnpp --extra-cflags=-I/usr/local/cuda-11.5/include --extra-ldflags=-L/usr/local/cuda-11.5/lib64 --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/ubuntu/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libvmaf --enable-vaapi --enable-libmfx --enable-nonfree
  libavutil      57.  9.101 / 57.  9.101
  libavcodec     59. 14.100 / 59. 14.100
  libavformat    59.  9.102 / 59.  9.102
  libavdevice    59.  0.101 / 59.  0.101
  libavfilter     8. 17.100 /  8. 17.100
  libswscale      6.  1.101 /  6.  1.101
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'base.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    encoder         : Lavf59.9.102
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
  Duration: 00:03:00.07, start: 0.000000, bitrate: 2611 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 2608 kb/s, 30 fps, 30 tbr, 30k tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_cuvid) -> hevc (hevc_nvenc))
Press [q] to stop, [?] for help
Output #0, mp4, to 'encoded5_nvenc.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    genre           : Animation
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    encoder         : Lavf59.9.102
  Stream #0:0(und): Video: hevc (Main) (hvc1 / 0x31637668), cuda(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 30 fps, 15360 tbn (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.14.100 hevc_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 4000000 vbv_delay: N/A
frame= 5404 fps=447 q=27.0 Lsize=   33893kB time=00:03:00.10 bitrate=1541.6kbits/s dup=0 drop=196 speed=14.9x    
video:33870kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.067662%

real	0m12.360s
user	0m2.978s
sys	0m0.632s
ubuntu@test:~$ 

VMAF

ffmpeg -i encoded5_nvenc.mp4 -i base.mp4 -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[aa]; \
[1:v]settb=AVTB,setpts=PTS-STARTPTS[bb]; \
[aa][bb]libvmaf=log_fmt=xml:log_path=/dev/stdout: \
model_path=/usr/local/share/model/vmaf_v0.6.1.json: \
n_threads=16:shortest=1:repeatlast=0" -an -f null -t 30 -
VMAF score: 57.821041

qP35でのでのまとめ

元ファイル X265 IntelQSV NVEnc
容量 57406kB 10350kB 10471kB 33893kB
エンコード時間 - 7m8.962s 1m12.999s 0m12.360s
VMAF品質 100 78.392523 65.246589 57.821041

X265とQSVは容量がほぼ近いが、画質で比較すると

まとめ

改めてx265とQSV、NVEncを比較しましたが、単純にビットレートやqP指定でのエンコードの場合、HWエンコーダの特性を考えて最適な値にしないと、ただ早くて画質は悪いという状況になるため、パラメータの調整が必須というのがよくわかったのと、
VMAFにて客観的な比較ができるため、VMAFの値を参考にチューニングをする必要がある。

今回NVEncが散々な値になっているのは、一つにTU117がH265のBフレーム圧縮に対応していないため、容量が大きくなりやすいという傾向があると考えられる。
この辺は Tesla T4など Bフレーム圧縮対応の環境で追加比較を行いたい。
また、今回は圧縮時間の劇的な差を見るためにH265にした経緯があるが、H264のトランスコードという状況でも追加検証を行なってみたい。

今回はこの辺で時間切れのため、後日追加検証の上、記事をあげたいと思う。

21
14
1

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
21
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?