我如何修改这个ffmpeg构建脚本以获得最小的二进制大小输出 [英] how do i modify this ffmpeg build script for minimal binary size output

查看:159
本文介绍了我如何修改这个ffmpeg构建脚本以获得最小的二进制大小输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在3个芯片组上构建android的ffmpeg二进制文件。输出文件大小太大,不能在项目中包含约15mb。



https://github.com/falnatsheh/ ffmpeg-android 是github项目repo



ffmpeg的.sh构建脚本就像这样

 #!/ bin / bash 

。 abi_settings.sh $ 1 $ 2 $ 3

pushd ffmpeg

案例$ 1
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||退出1

make -j $ {NUMBER_OF_CORES}&& make install ||退出1

popd

我尝试添加 - 第一行在配置,但编译器抱怨说,我没有设置一个目标os,即使它的下一行



在应用程序中,我只使用ffmpeg来输入mp4视频并转置和转动
这里是两个命令。

  -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 

其中%s是文件路径



然后连接文件


$ b -c:一个副本-bsf:a aac_adtstoasc%s

/ code>

如果有人可以通过构建脚本来帮助我,这将是真棒

解决方案

您可以关闭某些功能,并打开解码,多路分解,您需要。



如:

  **  -  disable-demuxers ** 
** - 禁用解码器**
** - 禁用设备**
** - 过滤器**
** - 启用解码器= h264 **
** - 启用解码器= mp3 ***
** - enable-demuxer = mpegts **

推荐给你一个开源Android和IOS ffmpeg



https://github.com/bbcallen/ijkplayer


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

解决方案

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

这篇关于我如何修改这个ffmpeg构建脚本以获得最小的二进制大小输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆