画像圧縮プログラムのSSIM比較

こちらのMサイズを圧縮します

人が減ってきた夜の旺角(香港)のフリー素材 - ぱくたそ

元のサイズ: 1968495バイト

Photoshop 23.1.0 Release

圧縮設定 圧縮後サイズ 圧縮率[%] SSIM
Great 1857313 94 0.949639
Excellent 808601 41 0.932082
Very Good 479340 24 0.90924
Good 271353 14 0.875281
Fair 198991 10 0.849169
Poor 181823 9.2 0.841396
Very Poor 127910 6.4 0.794932

TinyJpeg

https://tinyjpg.com/

圧縮設定 圧縮後サイズ 圧縮率[%] SSIM
標準 405648 20 0.902383

WEBSITE PLANET

https://www.websiteplanet.com/ja/webtools/imagecompressor/

圧縮設定 圧縮後サイズ 圧縮率[%] SSIM
標準 290346 15 0.921095

mozjpeg

brew install mozjpeg
djpeg original.jpg | cjpeg -quality 80 > mozjpeg_80.jpg
圧縮設定 圧縮後サイズ 圧縮率[%] SSIM
100 1590213 81 0.981104
95 822661 42 0.963509
90 575467 29 0.949991
85 459889 23 0.939699
80 393243 20 0.931684
75 345098 18 0.92489
70 314537 16 0.919387
65 287868 15 0.913465
60 266308 14 0.908341
55 248811 13 0.903638
50 234643 12 0.899497
45 221200 11 0.894545
40 205655 10 0.88877
35 191658 9.7 0.882185
30 174679 8.9 0.873319
25 157005 8.0 0.861803
20 137270 7.0 0.845599
15 115902 5.9 0.821904
10 90365 4.6 0.781339

guetzli

brew install guetzli
guetzli --quality 100 original.jpg guetzli_100.jpg
圧縮設定 圧縮後サイズ 圧縮率[%] SSIM
100 1692329 86 0.994849
98 1112058 56 0.982535
96 827689 42 0.975307
94 672226 34 0.968616
92 576593 29 0.961595
90 514508 26 0.956176
88 459795 23 0.951042
86 422522 21 0.945941
84 394728 20 0.941691

グラフに起こすと f:id:taku-woohar:20211226135703p:plain

見た感じではTinyJpegはPhotoshopのVery GoodとGoodに近しい性能でmozjpegはそれよりも良い成績で、WEBSITE PLANETとguetzliが最も良い成績となりました。 ただしguetzliは圧縮にだいぶ時間がかかるので、どこでも使えるというものでもなさそうです。

Macbook Pro '14で動画エンコード

環境

素材

  • sony_xavcs_30p.MP4
    • 1920 × 1080 29.97fps
    • 50Mbps
    • Sony RX100M4 X-AVCS
    • 2865F
    • 1分36秒
  • canon_uhd.MP4
    • 3840x2160 29.97fps
    • 120Mbps
    • Canon PowerShot G7 X Mark III
    • 1419F
    • 47秒
  • gh5_422_uhd.MP4
    • 3840x2160 29.97fps
    • 150Mbps
    • LUMIX GH5
    • 525F
    • 17秒

FFmpeg

FFmpegはバージョン4.4.1を使用します。

Input Codec FPS
sony_xavcs_30p.MP4 libx264 88
h264_videotoolbox 61
libx265 9.01
hevc_videotoolbox 57
vp9 6.7
canon_uhd.MP4 libx264 30
h264_videotoolbox 51
libx265 2.71
hevc_videotoolbox 15
vp9 5.6
gh5_422_uhd.MP4 libx264 14
h264_videotoolbox 16
libx265 3.26
hevc_videotoolbox 15
vp9 3.5
ffmpeg -y -i sony_xavcs_30p.MP4 -c:v libx264 -b:v 5000k fhd2fhd_x264_1.mp4
ffmpeg -y -i sony_xavcs_30p.MP4 -c:v h264_videotoolbox -b:v 5000k fhd2fhd_toolbox_h264_1.mp4
ffmpeg -y -i sony_xavcs_30p.MP4 -c:v libx265 -b:v 5000k fhd2fhd_x265_1.mp4
ffmpeg -y -i sony_xavcs_30p.MP4 -c:v hevc_videotoolbox -b:v 5000k fhd2fhd_toolbox_h265_1.mp4
ffmpeg -y -i sony_xavcs_30p.MP4 -c:v vp9 -b:v 5000k fhd2fhd_vp9_1.mp4


ffmpeg -y -i canon_uhd.MP4 -c:v libx264 -b:v 5000k uhd2fhd_x264_1.mp4
ffmpeg -y -i canon_uhd.MP4 -c:v h264_videotoolbox -b:v 5000k uhd2fhd_toolbox_h264_1.mp4
ffmpeg -y -i canon_uhd.MP4 -c:v libx265 -b:v 5000k uhd2fhd_h265_1.mp4
ffmpeg -y -i canon_uhd.MP4 -c:v hevc_videotoolbox -b:v 5000k uhd2fhd_toolbox_h265_1.mp4
ffmpeg -y -i canon_uhd.MP4 -c:v vp9 -b:v 5000k uhd2fhd_vp9_1.mp4


ffmpeg -y -i gh5_422_uhd.MP4 -c:v libx264 -b:v 5000k -pix_fmt yuv420p uhd422_to_fhd_x264_1.mp4
ffmpeg -y -i gh5_422_uhd.MP4 -c:v h264_videotoolbox -b:v 5000k  -pix_fmt yuv420p uhd422_to_fhd_toolbox_h264_1.mp4
ffmpeg -y -i gh5_422_uhd.MP4 -c:v libx265 -b:v 5000k -pix_fmt yuv420p uhd422_to_fhd_h265_1.mp4
ffmpeg -y -i gh5_422_uhd.MP4 -c:v hevc_videotoolbox -b:v 5000k  -pix_fmt yuv420p uhd422_to_fhd_toolbox_h265_1.mp4
ffmpeg -y -i gh5_422_uhd.MP4 -c:v vp9 -b:v 5000k  -pix_fmt yuv420p uhd422_to_fhd_vp9_1.mp4

Adobe Media Encoder編

Input Codec Min:Sec FPS
sony_xavcs_30p.MP4 H.264 0:15 191
HEVC(H.265) 0:17 168
canon_uhd.MP4 H.264 0:27 52
HEVC(H.265) 0:30 47
gh5_422_uhd.MP4 H.264 0:10 52
HEVC(H.265) 0:11 47

nginxを使ってローカルにミニマム開発環境を整える

まず表示するファイルを用意します。

mkdir html
echo "OK" > html/index.html

その次に nginx-min.conf というファイルを以下の内容でカレントディレクトリに作成します。

events {
    worker_connections  10;
}

http {
    server {
        listen       8080;
        listen  [::]:8080;
        server_name  localhost;

        location / {
            root   html;
            index  index.html index.htm;
        }
    }
}

以下のコマンドで構文チェックします。ファイル名をしている時は絶対パスでないと、nginx標準のディレクトリ配下を見に行って今します。

nginx -t -p `pwd` -c nginx-min.conf

syntax is oktest is successful と表示されていたらOKです。

nginx  -p `pwd` -c nginx-min.conf -g "pid nginx.pid;"

で起動して、停止する時は

kill $(cat nginx.pid)

です。

次にローカル用の証明書を作ります。 https://github.com/FiloSottile/mkcert を使用します。

brew install mkcert

このコマンドでCAをインストールします

mkcert --install

こんなふうに言われます

Created a new local CA 💥
Sudo password:
The local CA is now installed in the system trust store! ⚡️
Warning: "certutil" is not available, so the CA can't be automatically installed in Firefox! ⚠️
Install "certutil" with "brew install nss" and re-run "mkcert -install" 👈

証明書を作成します。

mkcert localhost

ローカルに秘密鍵と、証明書のペアが生成されます。

localhost-key.pem localhost.pem

nginxの設定を以下の様に書き換えて再度、起動します。

events {
    worker_connections  10;
}

http {
    server {
        listen       8080;
        listen  [::]:8080;
        server_name  localhost;

        root   html;
        location / {
            index  index.html index.htm;
        }
    }
    server {
        listen       8081 ssl;
        server_name  localhost;

        ssl_certificate     localhost.pem;
        ssl_certificate_key localhost-key.pem;

        location / {
            root   html;
            index  index.html index.htm;
        }
    }
}

起動すると https://localhost:8081/ のURLで証明書のエラーが出ることもなく接続できるのが確認できると思います。

PHPにプロキシすることを考えます。 以下の様な app.php を用意します。

<?php
phpinfo();

これを以下のコマンドで起動しておき

php -S localhost:8082 app.php

nginxの設定をプロキシするよう変えます。

http {
    ...
    server {
        ...
        location / {
            proxy_pass  http://localhost:8082/;
        }

https://localhost:8081/ を開くとPHPの詳細が確認できると思います。


[追記]

nginxの最新バージョンではlogの出力先が固定されているので -e オプションで出力先を変更する必要がある

nginx -e /dev/null  -p `pwd` -c nginx-min.conf -g "pid nginx.pid;"

macOS CatalinaでTensorflow 1.15.3をビルド

ビルド環境

  • macOS Catalina 10.15.6
  • Python3.8
  • GCC Apple clang version 11.0.3 (clang-1103.0.32.62)
conda create -n tf_38_2 python=3.8
conda activate tf_38_2

pipモジュールのインストール

pip install -U --user pip six 'numpy<1.19.0' wheel setuptools mock 'future>=0.17.1' 'gast==0.2.2' typing_extensions
pip install -U --user keras_applications --no-deps
pip install -U --user keras_preprocessing --no-deps
git clone https://github.com/tensorflow/tensorflow tensorflow_38_2
cd tensorflow_38_2
git checkout v1.15.3

Bazelのインストール

export BAZEL_VERSION=0.26.1
curl -fLO "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-darwin-x86_64.sh"
chmod +x "bazel-${BAZEL_VERSION}-installer-darwin-x86_64.sh"
./bazel-${BAZEL_VERSION}-installer-darwin-x86_64.sh --user
bazel --version

この2つのパッチを参考にファイルを修正します。

Fix GCC 10.1 compile error. by cbalint13 · Pull Request #40654 · tensorflow/tensorflow · GitHub

py-tensorflow1: fix Python 3.8 build. · macports/macports-ports@f63da02 · GitHub

configureの内容

% ./configure
WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown".
You have bazel 0.26.1 installed.
Please specify the location of python. [Default is /Users/tak/opt/anaconda3/envs/tf_38_2/bin/python]: 


Found possible Python library paths:
  /Users/tak/opt/anaconda3/envs/tf_38_2/lib/python3.8/site-packages
Please input the desired Python library path to use.  Default is [/Users/tak/opt/anaconda3/envs/tf_38_2/lib/python3.8/site-packages]

Do you wish to build TensorFlow with XLA JIT support? [Y/n]: y
XLA JIT support will be enabled for TensorFlow.

Do you wish to build TensorFlow with OpenCL SYCL support? [y/N]: n
No OpenCL SYCL support will be enabled for TensorFlow.

Do you wish to build TensorFlow with ROCm support? [y/N]: n
No ROCm support will be enabled for TensorFlow.

Do you wish to build TensorFlow with CUDA support? [y/N]: n
No CUDA support will be enabled for TensorFlow.

Do you wish to download a fresh release of clang? (Experimental) [y/N]: n
Clang will not be downloaded.

Do you wish to build TensorFlow with MPI support? [y/N]: n
No MPI support will be enabled for TensorFlow.

Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native -Wno-sign-compare]: 


Would you like to interactively configure ./WORKSPACE for Android builds? [y/N]: n
Not configuring the WORKSPACE for Android builds.

Do you wish to build TensorFlow with iOS support? [y/N]: n
No iOS support will be enabled for TensorFlow.

Preconfigured Bazel build configs. You can use any of the below by adding "--config=<>" to your build command. See .bazelrc for more details.
    --config=mkl            # Build with MKL support.
    --config=monolithic     # Config for mostly static monolithic build.
    --config=gdr            # Build with GDR support.
    --config=verbs          # Build with libverbs support.
    --config=ngraph         # Build with Intel nGraph support.
    --config=numa           # Build with NUMA support.
    --config=dynamic_kernels    # (Experimental) Build kernels into separate shared objects.
    --config=v2             # Build TensorFlow 2.x instead of 1.x.
Preconfigured Bazel build configs to DISABLE default on features:
    --config=noaws          # Disable AWS S3 filesystem support.
    --config=nogcp          # Disable GCP support.
    --config=nohdfs         # Disable HDFS support.
    --config=noignite       # Disable Apache Ignite support.
    --config=nokafka        # Disable Apache Kafka support.
    --config=nonccl         # Disable NVIDIA NCCL support.
Configuration finished

ビルド実行

bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package

ビルド完了したら以下のパッチを参考にソース修正

Fix TensorFlow on Python 3.8 logger issue by yongtang · Pull Request #33953 · tensorflow/tensorflow · GitHub

./bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
pip install /tmp/tensorflow_pkg/tensorflow-1.15.3-cp38-cp38-macosx_10_15_x86_64.whl

これでビルドは完了です。

macOS CatalinaでTensorflow 2.3.0をビルド

ビルド環境

  • macOS Catalina 10.15.6
  • Python3.8
  • GCC Apple clang version 11.0.3 (clang-1103.0.32.62)

macOS用のAnacondaをインストール

Anaconda | Individual Edition

conda create -n tf_38 python=3.8
conda activate tf_38

以下がセットアップ内容

Collecting package metadata (current_repodata.json): done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.8.3
  latest version: 4.8.4

Please update conda by running

    $ conda update -n base -c defaults conda



## Package Plan ##

  environment location: /Users/tak/opt/anaconda3/envs/tf_38

  added / updated specs:
    - python=3.8


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    pip-20.2.2                 |           py38_0         1.7 MB
    python-3.8.5               |       h26836e1_0        20.7 MB
    setuptools-49.6.0          |           py38_0         747 KB
    ------------------------------------------------------------
                                           Total:        23.1 MB

The following NEW packages will be INSTALLED:

  ca-certificates    pkgs/main/osx-64::ca-certificates-2020.7.22-0
  certifi            pkgs/main/osx-64::certifi-2020.6.20-py38_0
  libcxx             pkgs/main/osx-64::libcxx-10.0.0-1
  libedit            pkgs/main/osx-64::libedit-3.1.20191231-h1de35cc_1
  libffi             pkgs/main/osx-64::libffi-3.3-hb1e8313_2
  ncurses            pkgs/main/osx-64::ncurses-6.2-h0a44026_1
  openssl            pkgs/main/osx-64::openssl-1.1.1g-h1de35cc_0
  pip                pkgs/main/osx-64::pip-20.2.2-py38_0
  python             pkgs/main/osx-64::python-3.8.5-h26836e1_0
  readline           pkgs/main/osx-64::readline-8.0-h1de35cc_0
  setuptools         pkgs/main/osx-64::setuptools-49.6.0-py38_0
  sqlite             pkgs/main/osx-64::sqlite-3.33.0-hffcf06c_0
  tk                 pkgs/main/osx-64::tk-8.6.10-hb0a8c7a_0
  wheel              pkgs/main/noarch::wheel-0.35.1-py_0
  xz                 pkgs/main/osx-64::xz-5.2.5-h1de35cc_0
  zlib               pkgs/main/osx-64::zlib-1.2.11-h1de35cc_3

pipモジュールのインストール

pip install -U --user pip six 'numpy<1.19.0' wheel setuptools mock 'future>=0.17.1' 'gast==0.3.3' typing_extensions
pip install -U --user keras_applications --no-deps
pip install -U --user keras_preprocessing --no-deps
git clone https://github.com/tensorflow/tensorflow tensorflow_38
cd tensorflow_38
git checkout v2.3.0

Bazelのインストール

export BAZEL_VERSION=3.1.0
curl -fLO "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-darwin-x86_64.sh"
chmod +x "bazel-${BAZEL_VERSION}-installer-darwin-x86_64.sh"
./bazel-${BAZEL_VERSION}-installer-darwin-x86_64.sh --user

export PATH="$PATH:$HOME/bin"

bazel --version

Xcodeの設定

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license
bazel clean --expunge

このパッチを参考にファイルを修正します。

Fix GCC 10.1 compile error. by cbalint13 · Pull Request #40654 · tensorflow/tensorflow · GitHub

configureの内容

% ./configure     
You have bazel 3.1.0 installed.
Please specify the location of python. [Default is /Users/tak/opt/anaconda3/envs/tf_38/bin/python3]: 


Found possible Python library paths:
  /Users/tak/opt/anaconda3/envs/tf_38/lib/python3.8/site-packages
Please input the desired Python library path to use.  Default is [/Users/tak/opt/anaconda3/envs/tf_38/lib/python3.8/site-packages]

Do you wish to build TensorFlow with OpenCL SYCL support? [y/N]: n
No OpenCL SYCL support will be enabled for TensorFlow.

Do you wish to build TensorFlow with ROCm support? [y/N]: n
No ROCm support will be enabled for TensorFlow.

Do you wish to build TensorFlow with CUDA support? [y/N]: n
No CUDA support will be enabled for TensorFlow.

Do you wish to download a fresh release of clang? (Experimental) [y/N]: n
Clang will not be downloaded.

Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native -Wno-sign-compare]:  


Would you like to interactively configure ./WORKSPACE for Android builds? [y/N]: n
Not configuring the WORKSPACE for Android builds.

Do you wish to build TensorFlow with iOS support? [y/N]: n
No iOS support will be enabled for TensorFlow.

Preconfigured Bazel build configs. You can use any of the below by adding "--config=<>" to your build command. See .bazelrc for more details.
    --config=mkl            # Build with MKL support.
    --config=monolithic     # Config for mostly static monolithic build.
    --config=ngraph         # Build with Intel nGraph support.
    --config=numa           # Build with NUMA support.
    --config=dynamic_kernels    # (Experimental) Build kernels into separate shared objects.
    --config=v2             # Build TensorFlow 2.x instead of 1.x.
Preconfigured Bazel build configs to DISABLE default on features:
    --config=noaws          # Disable AWS S3 filesystem support.
    --config=nogcp          # Disable GCP support.
    --config=nohdfs         # Disable HDFS support.
    --config=nonccl         # Disable NVIDIA NCCL support.
Configuration finished

ビルド開始

bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package

インストール作業

./bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
pip install /tmp/tensorflow_pkg/tensorflow-2.3.0-cp38-cp38-macosx_10_15_x86_64.whl

これでインストール完了です。

iMac proでエンコード

環境

素材

いつもの

  • sony_xavcs_30p.MP4
    • 1920 × 1080 29.97fps
    • 50Mbps
    • Sony RX100M4 X-AVCS
    • 11175F
    • 6分13秒
  • canon_uhd.MP4
    • 3840x2160 29.97fps
    • 120Mbps
    • Canon PowerShot G7 X Mark III
    • 1423F
    • 47秒
  • gh5_422_uhd.MP4
    • 3840x2160 29.97fps
    • 150Mbps
    • LUMIX GH5
    • 1770F
    • 59秒

Adobe Media Encoder編

Input Codec Min:Sec FPS
sony_xavcs_30p.MP4 H.264 1:03 177
HEVC(H.265) 1:12 155
canon_uhd.MP4 H.264 0:14 101
HEVC(H.265) 0:13 109
gh5_422_uhd.MP4 H.264 0:20 88
HEVC(H.265) 0:20 88

sony_xavcs_30p.MP4 のエンコードの場合、ほぼCPUは使われず、GPUだけとなりました。 GPUエンコード律速となっています。 f:id:taku-woohar:20200521192610p:plain

canon_uhd.MP4の場合、先ほどよりはCPUの負荷が上がっていますが、それでも利用率は低いです。 あとH.265はGPUも少し利用率低めです。 f:id:taku-woohar:20200521193036p:plain

gh5_422_uhd.MP4 では大分CPU使用率が高くなりました。主にデコード処理に使われているのだと思います。GPUも使用率高めです。なのでこの動画形式だとCPUもGPUも同等に使い切れる変換形式だと思います。 f:id:taku-woohar:20200521193242p:plain

FFmpeg

FFmpegはバージョン4.2.3を使用します。

Input Codec FPS
sony_xavcs_30p.MP4 libx264 81
h264_videotoolbox 189
libx265 27
hevc_videotoolbox 157
canon_uhd.MP4 libx264 26
h264_videotoolbox 52
libx265 10.36
hevc_videotoolbox 45
gh5_422_uhd.MP4 libx264 28
h264_videotoolbox 52
libx265 12
hevc_videotoolbox 45

HEVC Toolboxが使えるのでh.265は少し早くエンコード出来る様です。

ffmpeg -y -i sony_xavcs_30p.MP4 -c:v libx264 -b:v 5000k fhd2fhd_x264_1.mp4
ffmpeg -y -i sony_xavcs_30p.MP4 -c:v h264_videotoolbox -b:v 5000k fhd2fhd_toolbox_h264_1.mp4
ffmpeg -y -i sony_xavcs_30p.MP4 -c:v libx265 -b:v 5000k fhd2fhd_x265_1.mp4
ffmpeg -y -i sony_xavcs_30p.MP4 -c:v hevc_videotoolbox -b:v 5000k fhd2fhd_toolbox_h265_1.mp4


ffmpeg -y -i canon_uhd.MP4 -c:v libx264 -b:v 5000k uhd2fhd_x264_1.mp4
ffmpeg -y -i canon_uhd.MP4 -c:v h264_videotoolbox -b:v 5000k uhd2fhd_toolbox_h264_1.mp4
ffmpeg -y -i canon_uhd.MP4 -c:v libx265 -b:v 5000k uhd2fhd_h265_1.mp4
ffmpeg -y -i canon_uhd.MP4 -c:v hevc_videotoolbox -b:v 5000k uhd2fhd_toolbox_h265_1.mp4


ffmpeg -y -i gh5_422_uhd.MP4 -c:v libx264 -b:v 5000k -pix_fmt yuv420p uhd422_to_fhd_x264_1.mp4
ffmpeg -y -i gh5_422_uhd.MP4 -c:v h264_videotoolbox -b:v 5000k  -pix_fmt yuv420p uhd422_to_fhd_toolbox_h264_1.mp4
ffmpeg -y -i gh5_422_uhd.MP4 -c:v libx265 -b:v 5000k -pix_fmt yuv420p uhd422_to_fhd_h265_1.mp4
ffmpeg -y -i gh5_422_uhd.MP4 -c:v hevc_videotoolbox -b:v 5000k  -pix_fmt yuv420p uhd422_to_fhd_toolbox_h265_1.mp4

Windows機で動画エンコード

環境

素材

前回と同じように1080p 29.97Fに変換します。

  • sony_xavcs_30p.MP4
    • 1920 × 1080 29.97fps
    • 50Mbps
    • Sony RX100M4 X-AVCS
    • 11175F
    • 6分13秒
  • canon_uhd.MP4
    • 3840x2160 29.97fps
    • 120Mbps
    • Canon PowerShot G7 X Mark III
    • 1423F
    • 47秒
  • gh5_422_uhd.MP4
    • 3840x2160 29.97fps
    • 150Mbps
    • LUMIX GH5
    • 1770F
    • 59秒

Adobe Media Encoder編

Input Codec Min:Sec FPS
sony_xavcs_30p.MP4 H.264 0:26 429
HEVC(H.265) 0:41 272
canon_uhd.MP4 H.264 0:12 118
HEVC(H.265) 0:13 109
gh5_422_uhd.MP4 H.264 0:27 65
HEVC(H.265) 0:28 63

f:id:taku-woohar:20200512234309p:plain

sony_xavcs_30p.MP4 と canon_uhd.MP4の場合はIntel内臓GPUでデコードを行い、GeForceエンコードを行なっているため、かなり早いです。

f:id:taku-woohar:20200512233954p:plain

gh5_422_uhd.MP4の場合は、デコードをCPUで行なっているためこちらが性能は下がり気味です。

FFmpeg

FFmpegはChocolateyでインストールしたバージョン4.2.2を使用します。

Input Codec FPS
sony_xavcs_30p.MP4 libx264 44
h264_nvenc 266
libx265 16
hevc_nvenc 166
canon_uhd.MP4 libx264 40
h264_nvenc 92
libx265 17.5
hevc_nvenc 91
gh5_422_uhd.MP4 libx264 32
h264_nvenc 80
libx265 21.01
hevc_nvenc 78

ffmpegの場合は全てCPUでデコードを行います。Adobe Media Encoder程速度は出ていない印象です。ただしnvencの性能は高いです。

ffmpeg -y -i sony_xavcs_30p.MP4 -c:v libx264 -b:v 5000k fhd2fhd_x264_1.mp4
ffmpeg -y -i sony_xavcs_30p.MP4 -c:v h264_nvenc -b:v 5000k fhd2fhd_nvenc_h264_1.mp4
ffmpeg -y -i sony_xavcs_30p.MP4 -c:v libx265 -b:v 5000k fhd2fhd_h265_1.mp4
ffmpeg -y -i sony_xavcs_30p.MP4 -c:v hevc_nvenc -b:v 5000k fhd2fhd_nvenc_hevc_1.mp4


ffmpeg -y -i canon_uhd.MP4 -vf "scale=1920:-1" -c:v libx264 -b:v 5000k uhd2fhd_x264_1.mp4
ffmpeg -y -i canon_uhd.MP4 -vf "scale=1920:-1" -c:v h264_nvenc -b:v 5000k uhd2fhd_nvenc_h264_1.mp4
ffmpeg -y -i canon_uhd.MP4 -vf "scale=1920:-1" -c:v libx265 -b:v 5000k uhd2fhd_h265_1.mp4
ffmpeg -y -i canon_uhd.MP4 -vf "scale=1920:-1" -c:v hevc_nvenc -b:v 5000k uhd2fhd_nvenc_h265_1.mp4


ffmpeg -y -i gh5_422_uhd.MP4 -vf "scale=1920:-1" -c:v libx264 -b:v 5000k -pix_fmt yuv420p uhd422_to_fhd_x264_1.mp4
ffmpeg -y -i gh5_422_uhd.MP4 -vf "scale=1920:-1" -c:v h264_nvenc -b:v 5000k  -pix_fmt yuv420p uhd422_to_fhd_nvenc_h264_1.mp4
ffmpeg -y -i gh5_422_uhd.MP4 -vf "scale=1920:-1" -c:v libx265 -b:v 5000k -pix_fmt yuv420p uhd422_to_fhd_h265_1.mp4
ffmpeg -y -i gh5_422_uhd.MP4 -vf "scale=1920:-1" -c:v hevc_nvenc -b:v 5000k -pix_fmt yuv420p uhd422_to_fhd_nvenc_h265_1.mp4