一方で、私のホームビデオのサイズを最適化しようとしている私はXubuntuの上Pitiviを使用して、テストとしてWebMのにそれらのいくつかを変換します。サイズの違いは重要です。結果のwebmファイルは元のファイルの約10%にすぎませんが、画質は私にはほとんど同じに見えます。
またavconv
、スクリプトを作成できるようにを使用して変換を実行しようとしましたが、結果のファイルは非常に粗雑に見えます。Pitiviのレンダリング設定を確認した後avconv -i $1 -q 5 -qmin 0 -qmax 63 ${1%.*}.webm
、いくつかのパラメーターを試しましたが、品質はまだがらくたのように見えるので、いくつかの間違ったパラメーターが欠落しているか、使用しているようです。誰かがh264ムービーをwebmに変換し、Pitiviと同じ品質を取得するために使用する正しいパラメーターを知っていますか?
Pitiviの設定は次のとおりです。
Note: This information is based on the FFmpeg Wiki on VP9 encoding. Please refer to that article for more information – it will be continuously maintained and extended. For the best results you should use the a recent version of
ffmpeg
by downloading it from their website (a static build will suffice; it contains thelibvps-vp9
encoder).
VBR encoding gives you the optimal overall quality, since the encoder can freely choose how many bits to assign to a frame. Choose this mode unless you are preparing videos for constant-bitrate streaming.
Typically, if you do not want to target a specific file size, you should let the bitrate vary freely, as that will lead to the highest quality. You can do this by setting the bitrate to 0 and the constant rate factor (CRF) to the target quality level:
ffmpeg -i input.mp4 -c:v libvpx-vp9 -crf 30 -b:v 0 output.webm
CRF value can be from 0–63. Lower values mean better quality. Recommended values range from 15–35, with 31 being recommended for 1080p HD video. Google has a guide with more info on that.
If you want your file to have a specific target bitrate or file size, you need to specify the rate and use two-pass encoding (which will ensure an optimal quality distribution). Here we're choosing 5 MBit/s, which should be enough for 1080p content.
ffmpeg -i input.mp4 -c:v libvpx-vp9 -b:v 5M -pass 1 -f webm /dev/null && \
ffmpeg -i input.mp4 -c:v libvpx-vp9 -b:v 5M -pass 2 output.webm
Windows users need to use NUL
instead of /dev/null
, and a ^
instead of \
.
First of all, libvpx offers constant bitrate and variable bitrate encoding modes. Constant bitrate should be avoided whenever possible (unless you target a specific file size or streaming scenario), since the average quality per file size will be worse. Still, you could try setting a constant bitrate if nothing else works for you, e.g. with 1 MBit/s:
ffmpeg -i input.mp4 -c:v libvpx-vp9 -minrate 5M -maxrate 5M -b:v 5M output.webm
Look at the output and increase or decrease the bit rate to your liking (or file size constraints). For example, you can use 500K
or 5M
, et cetera.
エンコーダがCBRを使用するには-minrate
、-maxrate
とビットレートを指定する必要があります-b:v
。それらはすべて同じ値である必要があります。そうでない場合は、代わりに別のターゲットビットレートを選択してVBRエンコーディングを実行しますが、品質は低くなります。
VP9エンコーディングに現在選択されているオーディオコーデックはOpusです。FFmpegはデフォルトで必要なエンコーダーとそのオプションを選択します。明示的に設定したい場合は-c:a libopus
、それも可能です。その他のオプションについては、libopus
ドキュメントを参照してください。
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加