跳至内容

Jixun's Blog 填坑还是开坑,这是个好问题。

Mastodon

在 Debian 10 下交叉编译 ffmpeg

先踩坑总结一下…

# 安装依赖 (Ubuntu 可能有些包不同)
apt-get install git zlib1g-dev libtool-bin cmake clang meson autogen gperf nasm unzip pax mercurial subversion ed texinfo bison flex cvs yasm automake autoconf pkg-config ragel

# 切换目录 (推荐选个短点的路径)
mkdir /ci && cd /ci

# 下包
git clone https://github.com/rdp/ffmpeg-windows-build-helpers.git ffmpeg-win
cd ffmpeg-win

# 单 64 位
nice -n19 -- ./cross_compile_ffmpeg.sh --build-ffmpeg-static=y --disable-nonfree=n --compiler-flavors=win64 --prefer-stable=y --sandbox-ok=y

# 32 + 64 位
# 32 位有些包可能有毛病,我踩了 Lame MP3 依赖的坑后就不编译 x86 的了 _(:3__
# https://github.com/rdp/ffmpeg-windows-build-helpers/issues/485#issuecomment-694502317
git apply <<'EOF'
diff --git a/cross_compile_ffmpeg.sh b/cross_compile_ffmpeg.sh
index ba78d01..184407b 100755
--- a/cross_compile_ffmpeg.sh
+++ b/cross_compile_ffmpeg.sh
@@ -1280,7 +1280,7 @@ build_libsndfile() {
 build_lame() {
   do_svn_checkout https://svn.code.sf.net/p/lame/svn/trunk/lame lame_svn
   cd lame_svn
-    sed -i.bak "1{/^\xef\xbb\xbf$/d}" libmp3lame/i386/nasm.h # Remove a UTF-8 BOM that breaks nasm if it's still there; should be fixed in trunk eventually https://sourceforge.net/p/lame/patches/81/
+    sed -i.bak '1s/^\xEF\xBB\xBF//' libmp3lame/i386/nasm.h # Remove a UTF-8 BOM that breaks nasm if it's still there; should be fixed in trunk eventually https://sourceforge.net/p/lame/patches/81/
     generic_configure "--enable-nasm"
     do_make_and_make_install
   cd ..
EOF
nice -n19 -- ./cross_compile_ffmpeg.sh --build-ffmpeg-static=y --disable-nonfree=n --compiler-flavors=multi --prefer-stable=y --sandbox-ok=y

编译参数说明:

继续阅读 »