how do i modify this ffmpeg build script for minim

2019-04-17 11:34发布

问题:

I'm trying to build the ffmpeg binaries for android on 3 chipsets. The output file size is too large to include in the project around 15mb.

https://github.com/falnatsheh/ffmpeg-android is the github project repo

the .sh build script for ffmpeg is like this

#!/bin/bash

. abi_settings.sh $1 $2 $3

pushd ffmpeg

case $1 in
  armeabi-v7a | armeabi-v7a-neon)
    CPU='cortex-a8'
  ;;
  x86)
    CPU='i686'
  ;;
esac

make clean

./configure \
--target-os="$TARGET_OS" \
--cross-prefix="$CROSS_PREFIX" \
--arch="$NDK_ABI" \
--cpu="$CPU" \
--enable-runtime-cpudetect \
--sysroot="$NDK_SYSROOT" \
--enable-pic \
--enable-libx264 \
--enable-pthreads \
--disable-debug \
--disable-ffserver \
--enable-version3 \
--enable-hardcoded-tables \
--disable-ffplay \
--disable-ffprobe \
--enable-gpl \
--enable-yasm \
--disable-doc \
--disable-shared \
--enable-static \
--pkg-config="${2}/ffmpeg-pkg-config" \
--prefix="${2}/build/${1}" \
--extra-cflags="-I${TOOLCHAIN_PREFIX}/include $CFLAGS" \
--extra-ldflags="-L${TOOLCHAIN_PREFIX}/lib $LDFLAGS" \
--extra-libs="-lm" \
--extra-cxxflags="$CXX_FLAGS" || exit 1

make -j${NUMBER_OF_CORES} && make install || exit 1

popd

I tried adding --disable-everything as the first line in configure but then the compiler complains that I didnt set a target-os even though its the next line

In the app I only use ffmpeg to take input mp4 videos and transpose and rotate them here are the two commands

-y -i %s -vf transpose=%d -tune film -metadata:s:v rotate=0 -c:v libx264 -preset ultrafast -crf 27 -c:a copy -bsf:a aac_adtstoasc %s

where %s is a file path

and then concat files

-y -i concat:%s -preset ultrafast -crf 27 -c:v copy -c:a copy -bsf:a aac_adtstoasc %s

If someone can help me with the build script that would be awesome

回答1:

You can turn off some feature, and open the decoding,demultiplexing you need.

such as :

**--disable-demuxers**
**--disable-decoders**
**--disable-devices**
**--disable-filters**
**--enable-decoder=h264**
**--enable-decoder=mp3***
**--enable-demuxer=mpegts**

Recommend to you an open source Android and IOS ffmpeg

https://github.com/bbcallen/ijkplayer



回答2:

You can use the shotgun approach. This is just a semi-random list for example purposes and may not fit your needs exactly:

./configure \
--disable-everything \
--enable-decoder=aac,h264,mjpeg,mpeg2video,mpeg4 \
--enable-encoder=aac,mpeg4,libx264 \
--enable-protocol=concat,file \
--enable-demuxer=aac,avi,h264,image2,matroska,pcm_s16le,mov,m4v,rawvideo,wav \
--enable-muxer=h264,ipod,mov,mp4 \
--enable-parser=aac,h264,mjpeg,mpeg4video,mpegaudio,mpegvideo,png \
--enable-bsf=aac_adtstoasc \
--enable-filter=transpose \
--enable-gpl \
--enable-libx264
  • You will have to experiment because you may forget to enable something when you use --disable-everything. Refer to ./configure --help.

  • The --(dis|en)able-* options can accept a comma separated list as shown in my example.