目次
文書の過去の版を表示しています。
ffmpeg - オーディオ/ビデオ 記録・変換・再生 コマンド
インストール
Scoop によるインストール。
ffmpeg をインストールする。
$ scoop install ffmpeg
Installing 'ffmpeg' (4.2.2) [64bit] ffmpeg-4.2.2-win64-static.zip (66.1 MB) [=====================================================================] 100% Checking hash of ffmpeg-4.2.2-win64-static.zip ... ok. Extracting ffmpeg-4.2.2-win64-static.zip ... done. Linking ~\scoop\apps\ffmpeg\current => ~\scoop\apps\ffmpeg\4.2.2 Creating shim for 'ffmpeg'. Creating shim for 'ffplay'. Creating shim for 'ffprobe'. 'ffmpeg' (4.2.2) was installed successfully!
VP9 & AV1(AO 対応な ffmpeg をインストール
https://github.com/BtbN/FFmpeg-Builds/releases/ より ffmpeg をインストールする。
- ~\scoop\buckets\main\bucket\ffmpeg.json
{ "version": "4.3.2", "description": "A complete, cross-platform solution to record, convert and stream audio and video.", "homepage": "https://ffmpeg.org", "license": "GPL-3.0-or-later", "architecture": { "64bit": { "url": "https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2021-02-24-12-33/ffmpeg-n4.3.2-win64-gpl-4.3.zip", "hash": "6af75afe7e689e8313ba0780ce55c82727bf768df9ebcd759ce9e5e81d5381c3", "extract_dir": "ffmpeg-n4.3.2-win64-gpl-4.3" } }, "env_add_path": [ "bin" ], "checkver": { "github": "https://github.com/BtbN/FFmpeg-Builds", "regex": "/autobuild-(?<time>[\\d-]+)/ffmpeg-n(?<version>[\\d.]+)-(?<commit>\\d+)-g(?<hash>[a-z\\d]+)-win64-gpl-[\\d.]+\\.zip", "replace": "${version}-${commit}" }, "autoupdate": { "architecture": { "64bit": { "url": "https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-$matchTime/ffmpeg-n$version-g$matchHash-win64-gpl-$majorVersion.$minorVersion.zip", "extract_dir": "ffmpeg-n$version-g$matchHash-win64-gpl-$majorVersion.$minorVersion" } } } }
ffmpeg を入れ直します。
$ scoop uninstall ffmpeg $ scoop install ffmpeg
ちなみに、scoop 標準の ffmpeg だと Invalid argument になりました😅
$ ffmpeg -i ElectricSheep_test001.gif -c vp9 -b:v 0 -crf 41 ElectricSheep_test001.webm
ffmpeg version n4.3.1-221-gd08bcbffff Copyright (c) 2000-2021 the FFmpeg developers built with gcc 9.3-win32 (GCC) 20200320 configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-zlib --enable-libxml2 --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-opencl --enable-libvmaf --disable-vulkan --enable-libvorbis --enable-amf --enable-libaom --enable-avisynth --enable-libdav1d --enable-libdavs2 --enable-ffnvcodec --enable-cuda-llvm --disable-libglslang --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libtwolame --enable-libvidstab --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-libs=-lgomp libavutil 56. 51.100 / 56. 51.100 libavcodec 58. 91.100 / 58. 91.100 libavformat 58. 45.100 / 58. 45.100 libavdevice 58. 10.100 / 58. 10.100 libavfilter 7. 85.100 / 7. 85.100 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc 55. 7.100 / 55. 7.100 Input #0, gif, from 'ElectricSheep_test001.gif': Metadata: comment : Made with ScreenToGif Duration: 00:02:52.74, start: 0.000000, bitrate: 17547 kb/s Stream #0:0: Video: gif, bgra, 800x450, 12.75 fps, 100 tbr, 100 tbn, 100 tbc [NULL @ 0000028c2c748100] Unable to find a suitable output format for '0' 0: Invalid argument
バージョンアップしたら、ffmpeg.json の url を書き換えます。
url を書き換えただけだと、ダウンロード時の破損チェック (ERROR Hash check failed!) に引っかかるので、その場合は json の hash を Actual: の内容に書き換えます。
$ scoop install ffmpeg Installing 'ffmpeg' (4.3.2) [64bit] ffmpeg-n4.3.2-win64-gpl-4.3.zip (86.3 MB) [==================================================] 100% Checking hash of ffmpeg-n4.3.2-win64-gpl-4.3.zip ... ERROR Hash check failed! App: main/ffmpeg URL: https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2021-02-24-12-33/ffmpeg-n4.3.2-win64-gpl-4.3.zip First bytes: 50 4B 03 04 0A 00 00 00 Expected: a5987fa32a06a21820eb3569fbf8d3ea72ad65bc9db39157a60920f75143315c Actual: 6af75afe7e689e8313ba0780ce55c82727bf768df9ebcd759ce9e5e81d5381c3 Please try again or create a new issue by using the following link and paste your console output: https://github.com/ScoopInstaller/Main/issues/new?title=ffmpeg%404.3.2%3a+hash+check+failed
参考: https://gist.github.com/HUMORCE/7ce41aba793085e8c3c5f6e8fd1266b9
トラブルシューティング
「そのようなホストは不明です。」というエラーが発生してインストールできない
$ scoop install ffmpeg
Installing 'ffmpeg' (4.3.1) [64bit] そのようなホストは不明です。 そのようなホストは不明です。 URL https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-4.3.1-win64-static.zip is not valid
Zeranoe ffmpeg、9月18日に閉鎖へ | ニコラボ
@Zeranoe / Twitter
http://ffmpeg.zeranoe.com will close on Sep 18, 2020, and all builds will be removed. If you're using Zeranoe @FFmpeg Builds in your product, please ensure that you have a hosting strategy in place by the 18th. Thank you to everyone who supported the project along the way!
ffmpeg.zeranoe.com 2020年9月18日に終了し、すべてのビルドが削除されます。 Zeranoe を使用している場合 @FFmpeg 製品を組み込みます。18日までにホスティング戦略を実施していることを確認してください。プロジェクトをサポートしてくださった皆様、ありがとうございました!
Zeranoe の ffmpeg が 2020年9月18日 から配布されなくなって困っている方は以下の方法をお試しください。
ffmpeg-4.3.1-win64-static.zip と同等のものを探します。
VideoHelp - Forum and Software downloads の ffmpeg Old Versions Downloads - VideoHelp に ffmpeg-4.3.1-win64-static.zip が転がっています。
ffmpeg-4.3.1-win64-static.zip (71.4MB sha256: aad816cd86d29f43f25d64094a4b5c23b47d28e9f5bb93720b0368bf331737c6)
これを今回は scoop の cache にヒットさせてインストールを続行させてみたいと思います。
scoop cache は ~\scoop\cache
ディレクトリに格納されています。
VideoHelp の ffmpeg-4.3.1-win64-static.zip を scoop cache に ffmpeg#4.3.1#https_ffmpeg.zeranoe.com_builds_win64_static_ffmpeg-4.3.1-win64-static.zip というファイル名で格納します。
scoop はインストール時にパッケージのキャッシュ有無をチェックして、存在していればキャッシュファイルがダウンロード時に破損していないかを sha256 アルゴリズムを使用して、bucket の json 定義のハッシュコードと一致するかを確認しています。
そのため、正規の配布パッケージを異なるファイルをキャッシュに格納しても、破損しているものと判断されて削除してしまいます。
ちなみに、ハッシュチェックが通らない場合は以下のようなエラーとなります。
Installing 'ffmpeg' (4.3.1) [64bit] Loading ffmpeg-4.3.1-win64-static.zip from cache Checking hash of ffmpeg-4.3.1-win64-static.zip ... ERROR Hash check failed! App: main/ffmpeg URL: https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-4.3.1-win64-static.zip First bytes: 50 4B 03 04 0A 00 00 00 Expected: f33a409dc61df9448dcd0505c6d1614a1c161397b3e5ceaebf8f5c0287374108 Actual: aad816cd86d29f43f25d64094a4b5c23b47d28e9f5bb93720b0368bf331737c6 Please try again or create a new issue by using the following link and paste your console output: https://github.com/ScoopInstaller/Main/issues/new?title=ffmpeg%404.3.1%3a+hash+check+failed
キャッシュをロードしたけど、期待される(Expected)ハッシュは f33a409dc61df9448dcd0505c6d1614a1c161397b3e5ceaebf8f5c0287374108 ですが、実際(Actual)は aad816cd86d29f43f25d64094a4b5c23b47d28e9f5bb93720b0368bf331737c6 が返されたとハッシュチェックエラーを報告して scoop はキャッシュファイルを削除する。
ハッシュチェックエラーにしないためには、scoop と同じアルゴリズムを使用して sha256 ハッシュを算出して、bucket の json 定義を修正する必要がある。
scoop の lib\install.ps1 をロードして VideoHelp のファイルに対する sha256 ハッシュを計算する。
もしくは、一旦キャッシュファイルが消えて入れ直すことが手間でなければ、Actual: の値を使用する。
$ . ~\scoop\apps\scoop\current\lib\install.ps1 $ compute_hash ~\scoop\cache\ffmpeg#4.3.1#https_ffmpeg.zeranoe.com_builds_win64_static_ffmpeg-4.3.1-win64-static.zip sha256
※compute_hash 関数の使用方法は compute_hash [ファイル名] [アルゴリズム] です。
aad816cd86d29f43f25d64094a4b5c23b47d28e9f5bb93720b0368bf331737c6
そして、~\scoop\buckets\main\bucket\ffmpeg.json
の sha256 ハッシュ値を修正する。
architecture → 64bit → hash の既存定義をコメントアウトして、再計算したハッシュ値で定義し直す。
{ "version": "4.3.1", "description": "A complete, cross-platform solution to record, convert and stream audio and video.", "homepage": "https://ffmpeg.org", "license": "GPL-3.0-or-later", "architecture": { "64bit": { "url": "https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-4.3.1-win64-static.zip", //"hash": "f33a409dc61df9448dcd0505c6d1614a1c161397b3e5ceaebf8f5c0287374108", "hash": "aad816cd86d29f43f25d64094a4b5c23b47d28e9f5bb93720b0368bf331737c6", "extract_dir": "ffmpeg-4.3.1-win64-static" }, "32bit": { "url": "https://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-4.3.1-win32-static.zip", "hash": "589e2dedd5bba34dede84c9513505768f4042a33b5bf21d90b97901da635a245", "extract_dir": "ffmpeg-4.3.1-win32-static" } }, "bin": [ "bin\\ffmpeg.exe", "bin\\ffplay.exe", "bin\\ffprobe.exe" ], "checkver": { "url": "https://ffmpeg.zeranoe.com/builds/win64/static/", "regex": "ffmpeg-([\\d.]+)-win64-static\\.zip", "reverse": true }, "autoupdate": { "architecture": { "64bit": { "url": "https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-$version-win64-static.zip", "extract_dir": "ffmpeg-$version-win64-static" }, "32bit": { "url": "https://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-$version-win32-static.zip", "extract_dir": "ffmpeg-$version-win32-static" } } } }
一旦 ffmpeg をアンインストールしてからインストールし直すと正常にインストールされる。
$ scoop uninstall ffmpeg
Uninstalling 'ffmpeg' (4.3.1). 'ffmpeg' was uninstalled.
$ scoop install ffmpeg
Installing 'ffmpeg' (4.3.1) [64bit] Loading ffmpeg-4.3.1-win64-static.zip from cache Checking hash of ffmpeg-4.3.1-win64-static.zip ... ok. Extracting ffmpeg-4.3.1-win64-static.zip ... done. Linking ~\scoop\apps\ffmpeg\current => ~\scoop\apps\ffmpeg\4.3.1 Creating shim for 'ffmpeg'. Creating shim for 'ffplay'. Creating shim for 'ffprobe'. 'ffmpeg' (4.3.1) was installed successfully!
参考文献
AOMedia Video 1 - Wikipedia
AV1エンコーダーの速度と品質の比較 - ffmpeg(libaom) vs SVT-AV1 - Qiita
おさえておきたいffmpeg高速化のまとめ:CPU使用率100%、Load Averageがぁあぁぁぁというときに ヽ(゚ー゚*ヽ)(ノ*゚ー゚)ノわぁい - Qiita
ffmpeg4.0のAV1使ってみた - exits
- windows/ffmpeg.1614604134.txt.gz
- 最終更新: 2021/03/01 22:08
- by ともやん