HandBrake1.1.0の32bit版をビルドしてみる(Windows版)

HandBrake 1.1.0 が公開されたのでいつものようにFDK-AACを有効にしてビルドしてみた。
バージョン 1.0.7 と比べて若干違っていたので別エントリーで備忘録。
(HandBrake 1.1.1~1.3.3でも動作を確認しました。)
(HandBrake 1.4.0ではCLIのみ動作を確認しました。)

と思って記事を書き始めたのだが、途中でもっとキレイにまとめられているサイト様を発見。

faac(FDK-AAC)対応のHandBrakeをビルドする方法

わざわざ私の駄文を公開する必要もなさそうなので紹介のみで割愛w

32bit版について

公式では 1.1.0 から32bit版のバイナリは配布されなくなった。

Nightly Build のページに理由を発見。

32bit builds are no longer provided. This is due to an increasing number of out of memory crashes that happen due to the 32bit process memory limit.

Google先生で翻訳してみる。

32ビットビルドは提供されなくなりました。 これは、32ビットのプロセスメモリ制限のために発生するメモリ不足クラッシュの数が増えているためです。

解像度がSDくらいならいけると思うけどサポート的に32bitはキツイと判断されたようだ。
(VideoHelpでも1.0.7が32bitのlast versionになっている。)

32bit版のビルド

時代の流れか、、、と思いつつもあえて32bitでのビルドを試みる。

32bit用のmingw-w64のビルドスクリプトを実行。

scripts/mingw-w64-build i686 /home/${USER}/toolchains/

問題なく完了。
続いてパスを通して

export PATH=/home/${USER}/toolchains/mingw-w64-i686/bin:${PATH}

32bit版 HandBrake をビルド。

./configure --cross=i686-w64-mingw32 --enable-qsv --enable-fdk-aac --launch-jobs=$(nproc) --launch --build="./build32"

ここでエラー発生。

result: FAILURE (code 2)

build/log/build.txt を見ると x265_10bit のビルド中にエラーを吐いている。

/home/USER/HandBrake/build32/contrib/x265/x265_v2.6/source/common/x86/pixel-a.asm:13872: error: undefined symbol `r7' (first use)
/home/USER/HandBrake/build32/contrib/x265/x265_v2.6/source/common/x86/pixel-a.asm:13872: error:  (Each undefined symbol is reported only once.)
/home/USER/HandBrake/build32/contrib/x265/x265_v2.6/source/common/x86/pixel-a.asm:13873: error: undefined symbol `xmmm8' (first use)
/home/USER/HandBrake/build32/contrib/x265/x265_v2.6/source/common/x86/pixel-a.asm:13874: error: undefined symbol `xmmm11' (first use)
/home/USER/HandBrake/build32/contrib/x265/x265_v2.6/source/common/x86/pixel-a.asm:13874: error: undefined symbol `xmmm9' (first use)
/home/USER/HandBrake/build32/contrib/x265/x265_v2.6/source/common/x86/pixel-a.asm:13876: error: undefined symbol `m8' (first use)
/home/USER/HandBrake/build32/contrib/x265/x265_v2.6/source/common/x86/pixel-a.asm:13876: error: undefined symbol `m9' (first use)
/home/USER/HandBrake/build32/contrib/x265/x265_v2.6/source/common/x86/pixel-a.asm:13930: error: undefined symbol `m11' (first use)
/home/USER/HandBrake/build32/contrib/x265/x265_v2.6/source/common/x86/pixel-a.asm:13949: error: undefined symbol `m10' (first use)
/home/USER/HandBrake/build32/contrib/x265/x265_v2.6/source/common/x86/pixel-a.asm:13995: error: (HADDD:1) undefined symbol `sizeofm10' in preprocessor
/home/USER/HandBrake/build32/contrib/x265/x265_v2.6/source/common/x86/pixel-a.asm:13995: error: (HADDD:8) undefined symbol `sizeofm10' in preprocessor
/home/USER/HandBrake/build32/contrib/x265/x265_v2.6/source/common/x86/pixel-a.asm:13997: error: undefined symbol `xmmm10' (first use)
/home/USER/HandBrake/build32/contrib/x265/x265_v2.6/source/common/x86/pixel-a.asm:14094: error: undefined symbol `m12' (first use)
/home/USER/HandBrake/build32/contrib/x265/x265_v2.6/source/common/x86/pixel-a.asm:14142: error: (HADDD:1) undefined symbol `sizeofm12' in preprocessor
/home/USER/HandBrake/build32/contrib/x265/x265_v2.6/source/common/x86/pixel-a.asm:14142: error: (HADDD:8) undefined symbol `sizeofm12' in preprocessor
/home/USER/HandBrake/build32/contrib/x265/x265_v2.6/source/common/x86/pixel-a.asm:14190: error: (HADDD:1) undefined symbol `sizeofm10' in preprocessor
/home/USER/HandBrake/build32/contrib/x265/x265_v2.6/source/common/x86/pixel-a.asm:14190: error: (HADDD:8) undefined symbol `sizeofm10' in preprocessor
/home/USER/HandBrake/build32/contrib/x265/x265_v2.6/source/common/x86/pixel-a.asm:14191: error: undefined symbol `xmmm12' (first use)
/home/USER/HandBrake/build32/contrib/x265/x265_v2.6/source/common/x86/pixel-a.asm:14279: error: undefined symbol `m13' (first use)
/home/USER/HandBrake/build32/contrib/x265/x265_v2.6/source/common/x86/pixel-a.asm:14327: error: (HADDD:1) undefined symbol `sizeofm13' in preprocessor
/home/USER/HandBrake/build32/contrib/x265/x265_v2.6/source/common/x86/pixel-a.asm:14327: error: (HADDD:8) undefined symbol `sizeofm13' in preprocessor
/home/USER/HandBrake/build32/contrib/x265/x265_v2.6/source/common/x86/pixel-a.asm:14375: error: (HADDD:1) undefined symbol `sizeofm12' in preprocessor
/home/USER/HandBrake/build32/contrib/x265/x265_v2.6/source/common/x86/pixel-a.asm:14375: error: (HADDD:8) undefined symbol `sizeofm12' in preprocessor
/home/USER/HandBrake/build32/contrib/x265/x265_v2.6/source/common/x86/pixel-a.asm:14376: error: undefined symbol `xmmm13' (first use)
common/CMakeFiles/common.dir/build.make:62: recipe for target 'common/CMakeFiles/common.dir/x86/pixel-a.asm.obj' failed
make[3]: *** [common/CMakeFiles/common.dir/x86/pixel-a.asm.obj] Error 1

x265 単体でビルドしても同じようなエラーがでるので HandBrake というよりは x265 の問題かも。

しかしながらアセンブラの問題を解決するスキルなど持ち合わせていないので、仕方なく消極的な解決をはかることに。

x265 の32bitビルド時にアセンブラを使用しないようにcmakeのオプションを追加。

-DENABLE_ASSEMBLY=OFF

パッチはこちら

(追記)
バージョン1.4.0用とバージョン1.3.0用を別途準備。

これでビルドは通った。

result: SUCCESS

ちなみに面倒なので x265 を無効にしてビルド、という方法も試したが

./configure --cross=i686-w64-mingw32 --disable-x265 --enable-qsv --enable-fdk-aac --launch-jobs=$(nproc) --launch --build="./build32"

ビルドは成功するものの、GUIの Video Codec に H265(x265) の選択肢が残ってしまう。
もちろん実行すればhb.dllにx265は含まれていないのでエンコードはできない。

まとめ

一応ビルドは成功したが、x265 の 10bit と 12bit のエンコードに関しては遅くて使い物にならない。

加えて、Git の master ブランチではGUIの32bit用の構成がオミットされている様子。

32bit版の HandBrake は公式で 1.0.7、自前ビルドで 1.1.0 までという事になりそうだ。

結局バージョン1.4.0でまた32bit版GUIがビルドできなくなりました。
DLLからのバージョン情報取得あたりに問題がありそうだが、そろそろ32bitにこだわる必要もなさそうなので諦めた・・・

以下、1.3.3までの備忘録。

1.1.1~1.3.3の32bit版は次の処理でGUIがビルドできました。(Gitで確認)

(追記)
バージョン1.1.2だとビルド時にエラーが発生。(1.3.0では不要)

EnumHelper.cs

using HandBrake.Interop.Attributes;

の部分を

using HandBrake.ApplicationServices.Attributes;

に修正したら通った。

(追記)
バージョン1.2.0ではとうとうGUIのソースから32bit構成がオミットされたが、自前で32bit(x86)構成を追加&起動時の64bitチェックをコメントアウトすることでHandBrakeWPFの起動は確認できた。

ただし、単純なエンコード以外は試していないので何かしらの問題は発生するかもしれない。

App.xaml.cs

if (!Environment.Is64BitOperatingSystem)
{
MessageBox.Show(HandBrakeWPF.Properties.Resources.OsBitnessWarning, HandBrakeWPF.Properties.Resources.Warning, MessageBoxButton.OK, MessageBoxImage.Warning);
Application.Current.Shutdown();
return;
}

をコメントアウト。

追記

2021/07/21

HandBrake 1.4.0でCLIの動作を確認しました。
HandBrake 1.4.0でGUIの動作を確認できませんでした。
1.4.0用のパッチを更新しました。

2019/11/11

1.3.0用のパッチを更新しました。

スポンサーリンク

シェアする

  • このエントリーをはてなブックマークに追加

フォローする

スポンサーリンク