From 8015577fdb2187f9d28458691b95dad2106a0fc9 Mon Sep 17 00:00:00 2001 From: Tiago Daniel Jacobs Date: Fri, 1 Sep 2017 09:32:02 -0300 Subject: [PATCH] * Build FFmpeg with support for Opus (pull #457) --- ffmpeg/cppbuild.sh | 45 ++++++++++++++++++++++++++++--- ffmpeg/ffmpeg-3.3.2-android.patch | 23 +++++++++------- 2 files changed, 56 insertions(+), 12 deletions(-) diff --git a/ffmpeg/cppbuild.sh b/ffmpeg/cppbuild.sh index 7071a835785..5e9b9d69863 100755 --- a/ffmpeg/cppbuild.sh +++ b/ffmpeg/cppbuild.sh @@ -8,7 +8,7 @@ if [[ -z "$PLATFORM" ]]; then fi DISABLE="--disable-w32threads --disable-iconv --disable-opencl --disable-sdl --disable-bzlib --disable-lzma" -ENABLE="--enable-pthreads --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-runtime-cpudetect --enable-zlib --enable-libmp3lame --enable-libspeex --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-openssl --enable-libopenh264 --enable-libx264 --enable-libx265 --enable-libvpx --enable-libfreetype" +ENABLE="--enable-pthreads --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-runtime-cpudetect --enable-zlib --enable-libmp3lame --enable-libspeex --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-openssl --enable-libopenh264 --enable-libx264 --enable-libx265 --enable-libvpx --enable-libfreetype --enable-libopus" # minimal configuration to support MPEG-4 streams with H.264 and AAC as well as Motion JPEG # DISABLE="--disable-w32threads --disable-iconv --disable-libxcb --disable-opencl --disable-sdl --disable-bzlib --disable-lzma --disable-everything" @@ -17,6 +17,7 @@ ENABLE="--enable-pthreads --enable-shared --enable-gpl --enable-version3 --enabl ZLIB=zlib-1.2.11 LAME=lame-3.99.5 SPEEX=speex-1.2.0 +OPUS=opus-1.1.5 OPENCORE_AMR=opencore-amr-0.1.5 OPENSSL=openssl-1.1.0f OPENH264_VERSION=1.7.0 @@ -28,6 +29,7 @@ FREETYPE_VERSION=2.8 download http://zlib.net/$ZLIB.tar.gz $ZLIB.tar.gz download http://downloads.sourceforge.net/project/lame/lame/3.99/$LAME.tar.gz $LAME.tar.gz download http://downloads.xiph.org/releases/speex/$SPEEX.tar.gz $SPEEX.tar.gz +download https://archive.mozilla.org/pub/opus/$OPUS.tar.gz $OPUS.tar.gz download http://sourceforge.net/projects/opencore-amr/files/opencore-amr/$OPENCORE_AMR.tar.gz/download $OPENCORE_AMR.tar.gz download https://www.openssl.org/source/$OPENSSL.tar.gz $OPENSSL.tar.gz download https://github.com/cisco/openh264/archive/v$OPENH264_VERSION.tar.gz openh264-$OPENH264_VERSION.tar.gz @@ -45,6 +47,7 @@ echo "Decompressing archives..." tar --totals -xzf ../$ZLIB.tar.gz tar --totals -xzf ../$LAME.tar.gz tar --totals -xzf ../$SPEEX.tar.gz +tar --totals -xzf ../$OPUS.tar.gz tar --totals -xzf ../$OPENCORE_AMR.tar.gz tar --totals -xzf ../$OPENSSL.tar.gz tar --totals -xzf ../openh264-$OPENH264_VERSION.tar.gz @@ -84,7 +87,11 @@ case $PLATFORM in make install cd ../include make install - cd ../../$OPENCORE_AMR + cd ../../$OPUS + ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=arm-linux + make -j $MAKEJ + make install + cd ../$OPENCORE_AMR ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=arm-linux make -j $MAKEJ make install @@ -145,7 +152,11 @@ case $PLATFORM in make install cd ../include make install - cd ../../$OPENCORE_AMR + cd ../../$OPUS + ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=i686-linux + make -j $MAKEJ + make install + cd ../$OPENCORE_AMR ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=i686-linux make -j $MAKEJ make install @@ -192,6 +203,10 @@ case $PLATFORM in ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=i686-linux CFLAGS="-m32" make -j $MAKEJ make install + cd ../$OPUS + ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=i686-linux CFLAGS="-m32" + make -j $MAKEJ + make install cd ../$OPENCORE_AMR ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=i686-linux CFLAGS="-m32" CXXFLAGS="-m32" make -j $MAKEJ @@ -238,6 +253,10 @@ case $PLATFORM in ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=x86_64-linux CFLAGS="-m64" make -j $MAKEJ make install + cd ../$OPUS + ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=x86_64-linux CFLAGS="-m64" + make -j $MAKEJ + make install cd ../$OPENCORE_AMR ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=x86_64-linux CFLAGS="-m64" CXXFLAGS="-m64" make -j $MAKEJ @@ -299,6 +318,10 @@ case $PLATFORM in ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=arm-linux-gnueabihf make -j $MAKEJ make install + cd ../$OPUS + ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=arm-linux-gnueabihf + make -j $MAKEJ + make install cd ../$OPENCORE_AMR ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=arm-linux-gnueabihf make -j $MAKEJ @@ -374,6 +397,10 @@ case $PLATFORM in ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --build=ppc64le-linux CFLAGS="-m64" make -j $MAKEJ make install + cd ../$OPUS + ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --build=ppc64le-linux CFLAGS="-m64" CXXFLAGS="-m64" + make -j $MAKEJ + make install cd ../$OPENCORE_AMR ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --build=ppc64le-linux CFLAGS="-m64" CXXFLAGS="-m64" make -j $MAKEJ @@ -420,6 +447,10 @@ case $PLATFORM in ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic make -j $MAKEJ make install + cd ../$OPUS + ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic + make -j $MAKEJ + make install cd ../$OPENCORE_AMR ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic make -j $MAKEJ @@ -464,6 +495,10 @@ case $PLATFORM in ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --build=i686-w64-mingw32 CFLAGS="-m32" make -j $MAKEJ make install + cd ../$OPUS + ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --build=i686-w64-mingw32 CFLAGS="-m32" + make -j $MAKEJ + make install cd ../$OPENCORE_AMR ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --build=i686-w64-mingw32 CFLAGS="-m32" CXXFLAGS="-m32" make -j $MAKEJ @@ -508,6 +543,10 @@ case $PLATFORM in ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --build=x86_64-w64-mingw32 CFLAGS="-m64" make -j $MAKEJ make install + cd ../$OPUS + ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --build=x86_64-w64-mingw32 CFLAGS="-m64" + make -j $MAKEJ + make install cd ../$OPENCORE_AMR ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --build=x86_64-w64-mingw32 CFLAGS="-m64" CXXFLAGS="-m64" make -j $MAKEJ diff --git a/ffmpeg/ffmpeg-3.3.2-android.patch b/ffmpeg/ffmpeg-3.3.2-android.patch index e501623b521..03fe0c0bd1b 100644 --- a/ffmpeg/ffmpeg-3.3.2-android.patch +++ b/ffmpeg/ffmpeg-3.3.2-android.patch @@ -14,11 +14,7 @@ diff -ruN ffmpeg-3.3.2/configure ffmpeg-3.3.2-android/configure { echo "#include " echo "#include FT_FREETYPE_H" - -diff -ruN ffmpeg-3.3.2/configure ffmpeg-3.3.2-android/configure ---- ffmpeg-3.3.2/configure 2017-06-07 11:04:02.000000000 +0900 -+++ ffmpeg-3.3.2-android/configure 2017-06-23 20:32:00.139387669 +0900 -@@ -5802,7 +5802,7 @@ +@@ -5804,7 +5802,7 @@ { use_pkg_config opencv opencv2/core/core_c.h cvCreateImageHeader || require opencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } || require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader; } @@ -27,7 +23,16 @@ diff -ruN ffmpeg-3.3.2/configure ffmpeg-3.3.2-android/configure enabled libopenjpeg && { { check_lib openjpeg-2.1/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || check_lib openjpeg-2.1/openjpeg.h opj_version -lopenjp2 || { check_lib openjpeg-2.0/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || -@@ -5821,7 +5821,7 @@ +@@ -5812,7 +5810,7 @@ + { check_lib openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || + die "ERROR: libopenjpeg not found"; } + enabled libopenmpt && require_pkg_config "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create +-enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create ++enabled libopus && add_cppflags -I ../include/opus/ && require opus opus_multistream.h opus_multistream_decoder_create -lopus + enabled libpulse && require_pkg_config libpulse pulse/pulseaudio.h pa_context_new + enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket + enabled librubberband && require_pkg_config "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new +@@ -5823,7 +5821,7 @@ enabled libsnappy && require snappy snappy-c.h snappy_compress -lsnappy enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr && LIBSOXR="-lsoxr" enabled libssh && require_pkg_config libssh libssh/sftp.h sftp_init @@ -36,7 +41,7 @@ diff -ruN ffmpeg-3.3.2/configure ffmpeg-3.3.2-android/configure enabled libtesseract && require_pkg_config tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame && -@@ -5869,7 +5869,7 @@ +@@ -5871,7 +5869,7 @@ die "ERROR: libx264 must be installed and version must be >= 0.118."; } && { check_cpp_condition x264.h "X264_MPEG2" && enable libx262; } @@ -45,7 +50,7 @@ diff -ruN ffmpeg-3.3.2/configure ffmpeg-3.3.2-android/configure { check_cpp_condition x265.h "X265_BUILD >= 68" || die "ERROR: libx265 version must be >= 68."; } enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode -lxavs -@@ -5914,10 +5914,10 @@ +@@ -5916,10 +5914,10 @@ check_header OMX_Core.h ; } || die "ERROR: OpenMAX IL headers not found"; } enabled openssl && { use_pkg_config openssl openssl/ssl.h OPENSSL_init_ssl || @@ -59,7 +64,7 @@ diff -ruN ffmpeg-3.3.2/configure ffmpeg-3.3.2-android/configure + check_lib openssl/ssl.h OPENSSL_init_ssl -lssl -lcrypto -lws2_32 -lgdi32 || die "ERROR: openssl not found"; } enabled qtkit_indev && { check_header_objcc QTKit/QTKit.h || disable qtkit_indev; } - + diff -ruN ffmpeg-3.3.2/library.mak ffmpeg-3.3.2-android/library.mak --- ffmpeg-3.3.2/library.mak 2017-06-07 11:03:56.000000000 +0900 +++ ffmpeg-3.3.2-android/library.mak 2017-06-23 20:10:54.718543524 +0900