x264 はH.264 映像ストリームを作成する為のライブラリです。100%完成してはいませんが、少なくともH.264の機能のなかで品質に影響の大きな機能はほとんど、なんらかの形でサポートしています。H.264規格の先進的な機能の中には、本質的に映像の品質とは全く無関係なものたくさん定義されています。そうしたものの多くは、まだx264には実装されていません。
エンコーダの機能
7.1.3.1. What is x264?
x264 is a library for creating H.264 video streams. It is not 100% complete, but currently it has at least some kind of support for most of the H.264 features which impact quality. There are also many advanced features in the H.264 specification which have nothing to do with video quality per se; many of these are not yet implemented in x264.
Encoder features
H.264 は ITU と MPEG が共同で開発した新しいデジタルビデオコデックの名称です。大変ややこしい事に、“ISO/IEC 14496-10“ とか “MPEG-4 Part 10“ などとも言います。一般的には “MPEG-4 AVC“ とか、単に “AVC“ とも呼ばれます。
なんと呼ぼうと H.264 は一般的にMPEG-4 ASPの品質を 5%~30%低いビットレートで実現できますから、試す価値はあります。実際の結果は素材映像の内容とエンコーダの性能によります。しかしH.264はメリットだけではありません。 デコードには極めて高速なCPUと大量のメモリが必要なようです。実例を挙げると、1733 MHzのAthlonで、DVD解像度の1500kbps H.264 ビデオの再生はCPUの約35% を使います。これに対してDVD-解像度の1500kbps MPEG-4 ASP ビデオはCPUの10%しか使いません。これは大半のユーザーにとってHD解像度の再生はほとんど問題外だという事です。また同時に、そこそこのDVD ripですら2.0 GHz程度以下のプロセッサではぎくしゃくする事があると言う事でもあります。
エンコードに必要な性能は、少なくとも x264ではそこまで酷くありません。例えば、1733 MHzの Athlon では一般的な DVD エンコードは 5-15fps程度で走ります。
この文書ではH.264の詳細は説明しませんが、おおまかな概略はこちらのpdfにあります: The H.264/AVC Advanced Video Coding Standard: Overview and Introduction to the Fidelity Range Extensions.
*当ブログ内に一部試訳あり、Doom9-AVC情報試訳も参照。
http://www.mplayerhq.hu/DOCS/HTML/en/video-codecs.html#codec-h264-whatis
H.264 is one name for a new digital video codec jointly developed by the ITU and MPEG. It can also be correctly referred to by the cumbersome names of “ISO/IEC 14496-10“ or “MPEG-4 Part 10“. More frequently, it is referred to as “MPEG-4 AVC“ or just “AVC“.
Whatever you call it, H.264 may be worth trying because it can typically match the quality of MPEG-4 ASP with 5%-30% less bitrate. Actual results will depend on both the source material and the encoder. The gains from using H.264 do not come for free: Decoding H.264 streams seems to have steep CPU and memory requirements. For instance, on a 1733 MHz Athlon, a DVD-resolution 1500kbps H.264 video requires around 35% CPU to decode. By comparison, decoding a DVD-resolution 1500kbps MPEG-4 ASP stream requires around 10% CPU. This means that decoding high-definition streams is almost out of the question for most users. It also means that even a decent DVD rip may sometimes stutter on processors slower than 2.0 GHz or so.
At least with x264, encoding requirements are not much worse than what you are used to with MPEG-4 ASP. For instance, on a 1733 MHz Athlon a typical DVD encode would run at 5-15fps.
This document is not intended to explain the details of H.264, but if you are interested in a brief overview, you may want to read The H.264/AVC Advanced Video Coding Standard: Overview and Introduction to the Fidelity Range Extensions.
MPlayer は libavcodec のH.264デコーダを使います。2004年7月以降、libavcodec は少なくとも最小限の H.264 デコードはできるようになっていて、それ以後もサポートする機能とCPU利用効率の両面で大きく進歩しています。常に最近のSVN checkoutを使うよう心がけて下さい。
libavcodecの H.264デコード機能が最近進化したかどうかを手っ取り早く確かめるには、FFmpeg Subversion repository's web interface. をまめに見ておくと良いでしょう。
http://www.mplayerhq.hu/DOCS/HTML/en/video-codecs.html#codec-x264-playback
MPlayer uses libavcodec's H.264 decoder. libavcodec has had at least minimally usable H.264 decoding since around July 2004, however major changes and improvements have been implemented since that time, both in terms of more functionalities supported and in terms of improved CPU usage. Just to be certain, it is always a good idea to use a recent Subversion checkout.
If you want a quick and easy way to know whether there have been recent changes to libavcodec's H.264 decoding, you might keep an eye on FFmpeg Subversion repository's web interface.
subversion クライアントをインストールしてあれば、以下のコマンドで最新の x264 ソースコードがダウンロードできます。:
svn co svn://svn.videolan.org/x264/trunk x264
x264 のAPI に変更があれば MPlayer のソースコードも追随しますから、MPlayerも常にSVN版を使うのが良いでしょう。おそらくこの状況は x264が「リリース」されたら変わると思いますが、それまでの間 x264 は極めて「unstable」と考えるべきでしょう。というのは、プログラミング・インタフェイスが変わる事があるからです[*1]。
x264のビルドとインストール方法は標準的なものです:
./configure && make && sudo make install
これで libx264.a が /usr/local/lib
に、そして x264.h が /usr/local/include
にインストールされます。
x264 のライブラリとヘッダが標準的な場所にあれば、x264 をサポートする MPlayer のビルドは簡単です。通常通り:
./configure && make && sudo make install
これでMEncoderの./configureスクリプトがx264を自動検出します。これで準備は完了。
http://www.mplayerhq.hu/DOCS/HTML/en/video-codecs.html#codec-x264-encode
If you have the subversion client installed, the latest x264 sources can be gotten with this command:
svn co svn://svn.videolan.org/x264/trunk x264
MPlayer sources are updated whenever an x264 API change occurs, so it is always suggested to use MPlayer from Subversion as well. Perhaps this situation will change when and if an x264 “release“ occurs. Meanwhile, x264 should be considered very unstable, in the sense that its programming interface is subject to change.
x264 is built and installed in the standard way:
./configure && make && sudo make install
This installs libx264.a in /usr/local/lib and x264.h is placed in /usr/local/include. With the x264 library and header placed in the standard locations, building MPlayer with x264 support is easy. Just run the standard:
./configure && make && sudo make install
The ./configure script will autodetect that you have satisfied the requirements for x264.