Add x265 and lame

This commit is contained in:
Jerome Wu
2022-10-04 14:53:42 +08:00
parent d5edbe9e5d
commit 1fd52fd851
6 changed files with 120 additions and 14 deletions

View File

@@ -3,6 +3,8 @@
# ex:
# bash ffmpeg-wasm.sh -o ffmpeg.js
set -euo pipefail
EXPORT_NAME="createFFmpegCore"
CONF_FLAGS=(
@@ -26,7 +28,6 @@ CONF_FLAGS=(
-lpostproc
-lswresample
-lswscale
-lx264
-Wno-deprecated-declarations
$LDFLAGS
-sUSE_SDL=2 # use emscripten SDL2 lib port

View File

@@ -1,5 +1,7 @@
#!/bin/bash
set -euo pipefail
CONF_FLAGS=(
--target-os=none # disable target specific configs
--arch=x86_32 # use x86_32 arch
@@ -21,15 +23,11 @@ CONF_FLAGS=(
--objcc=emcc
--dep-cc=emcc
--extra-cflags="$CFLAGS"
--extra-cxxflags="$CFLAGS"
--extra-cxxflags="$CXXFLAGS"
# disable thread when FFMPEG_ST is NOT defined
${FFMPEG_ST:+ --disable-pthreads --disable-w32threads --disable-os2threads}
# extra libraries
--enable-gpl
--enable-libx264
)
emconfigure ./configure "${CONF_FLAGS[@]}"
emconfigure ./configure "${CONF_FLAGS[@]}" $@
emmake make -j

15
build/lame.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
set -euo pipefail
CONF_FLAGS=(
--prefix=$INSTALL_DIR # install library in a build directory for FFmpeg to include
--host=i686-linux # use i686 linux
--disable-shared # disable shared library
--disable-frontend # exclude lame executable
--disable-analyzer-hooks # exclude analyzer hooks
--disable-dependency-tracking # speed up one-time build
--disable-gtktest
)
CFLAGS=$CFLAGS emconfigure ./configure "${CONF_FLAGS[@]}"
emmake make install -j

64
build/x265.sh Executable file
View File

@@ -0,0 +1,64 @@
#!/bin/bash
set -euo pipefail
BASE_FLAGS=(
-DCMAKE_TOOLCHAIN_FILE=$EM_TOOLCHAIN_FILE
-DENABLE_LIBNUMA=OFF
-DENABLE_SHARED=OFF
-DENABLE_CLI=OFF
)
FLAGS_12BIT=(
${BASE_FLAGS[@]}
-DHIGH_BIT_DEPTH=ON
-DEXPORT_C_API=OFF
-DMAIN12=ON
)
FLAGS_10BIT=(
${BASE_FLAGS[@]}
-DHIGH_BIT_DEPTH=ON
-DEXPORT_C_API=OFF
)
FLAGS_MAIN=(
${BASE_FLAGS[@]}
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR
-DEXTRA_LIB="x265_main10.a;x265_main12.a"
-DEXTRA_LINK_FLAGS=-L.
-DLINKED_10BIT=ON
-DLINKED_12BIT=ON
)
cd source
rm -rf build
mkdir -p build
cd build
mkdir -p main 10bit 12bit
cd 12bit
emmake cmake ../.. -DCMAKE_CXX_FLAGS="$CXXFLAGS" ${FLAGS_12BIT[@]}
emmake make -j
cd ../10bit
emmake cmake ../.. -DCMAKE_CXX_FLAGS="$CXXFLAGS" ${FLAGS_10BIT[@]}
emmake make -j
cd ../main
ln -sf ../10bit/libx265.a libx265_main10.a
ln -sf ../12bit/libx265.a libx265_main12.a
emmake cmake ../.. -DCMAKE_CXX_FLAGS="$CXXFLAGS" ${FLAGS_MAIN[@]}
emmake make -j
mv libx265.a libx265_main.a
# Merge static libraries
emar -M <<EOF
CREATE libx265.a
ADDLIB libx265_main.a
ADDLIB libx265_main10.a
ADDLIB libx265_main12.a
SAVE
END
EOF
emmake make install -j