Skip to content

Instantly share code, notes, and snippets.

@headupinclouds
Created May 13, 2019 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save headupinclouds/efcd338707ef1479ced5f59d31fec97c to your computer and use it in GitHub Desktop.
Save headupinclouds/efcd338707ef1479ced5f59d31fec97c to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
X264_URL=ftp://ftp.videolan.org/pub/x264/snapshots/x264-snapshot-20190430-2245.tar.bz2
FFMPEG_URL=https://github.com/headupinclouds/FFmpeg/archive/n4.1-dev-45499e557c-x264-0.tar.gz
install_dir=${PWD}/_install
mkdir -p ${install_dir}
MY_CC=/usr/bin/gcc-4.8
MY_CXX=/usr/bin/g++-4.8
x264_opts=(
# Standard options:
--prefix=${install_dir}
# Configuration options:
--enable-static
--disable-opencl
# Advanced options:
--disable-asm
--enable-pic
# External library support:
--disable-swscale
--disable-avs
--disable-lavf
--disable-ffms
--disable-gpac
--disable-lsmash
)
function build_x264
{
target=${X264_URL}
name=${target##*/}
curl ${target} -o ${name}
tar -vxjf ${name}
pushd ${name%.*.*}
CC=${MY_CC} CXX=${MY_CXX} ./configure ${x264_opts[@]} && make -j8 && make install
popd
}
# Notes:
# * https://stackoverflow.com/questions/50952336/ffmpeg-why-arent-all-my-codecs-showing-up-when-i-call-av-codec-next
# * https://superuser.com/a/915337
configure_opts=(
# Licensing options:
--enable-gpl # need for libx264
# Standard options:
--fatal-warnings
--prefix=${install_dir}
--pkgconfigdir=${install_dir}/lib/pkgconfig
# Program options:
#--disable-programs # don't disable for ffmpeg tool
# Documentation options
--disable-doc
--disable-htmlpages
--disable-manpages
--disable-podpages
--disable-txtpages
# Component options:
#--disable-avfilter # don't disable for ffmpeg tool
--disable-avdevice
--disable-postproc
--disable-avresample
--disable-network
# Individual component options:
--disable-everything
--enable-decoder=h264
--enable-demuxer=mov
--enable-parser=h264
--enable-muxer=image2 # https://superuser.com/a/915337
--enable-demuxer=image2
--enable-protocol=file
--enable-encoder=bmp
--enable-filter=scale,overlay # 'scale' filter not present
# External library support:
--disable-autodetect
--enable-libx264
# Toolchain options:
--enable-cross-compile
--cc=${MY_CC}
--cxx=${MY_CXX}
# Advanced options (experts only):
# Optimization options (experts only):
--disable-asm
# Developer options (useful when working on FFmpeg itself):
--disable-asm
--enable-debug
--disable-optimizations
)
function build_ffmpeg
{
target=${FFMPEG_URL}
name=${target##*/}
wget ${target} -O ${name}
tar zxvf ${name}
pushd FFmpeg-${name%.*.*}
export PKG_CONFIG_PATH=${install_dir}/lib/pkgconfig
CC=${MY_CC} CXX=${MY_CXX} ./configure ${configure_opts[@]} && make -j8 && make install
popd
}
build_x264
build_ffmpeg
#!/bin/bash
set -e
X264_URL=ftp://ftp.videolan.org/pub/x264/snapshots/x264-snapshot-20190430-2245.tar.bz2
FFMPEG_URL=https://github.com/headupinclouds/FFmpeg/archive/n4.1-dev-45499e557c-x264-0.tar.gz
install_dir=${PWD}/_install
mkdir -p ${install_dir}
MY_CC=/usr/bin/gcc-4.8
MY_CXX=/usr/bin/g++-4.8
x264_opts=(
# Standard options:
--prefix=${install_dir}
# Configuration options:
--enable-static
--disable-opencl
# Advanced options:
--disable-asm
--enable-pic
# External library support:
--disable-swscale
--disable-avs
--disable-lavf
--disable-ffms
--disable-gpac
--disable-lsmash
)
function build_x264
{
target=${X264_URL}
name=${target##*/}
curl ${target} -o ${name}
tar -vxjf ${name}
pushd ${name%.*.*}
CC=${MY_CC} CXX=${MY_CXX} ./configure ${x264_opts[@]} && make -j8 && make install
popd
}
# Notes:
# * https://stackoverflow.com/questions/50952336/ffmpeg-why-arent-all-my-codecs-showing-up-when-i-call-av-codec-next
# * https://superuser.com/a/915337
configure_opts=(
# Licensing options:
--enable-gpl # need for libx264
# Standard options:
--fatal-warnings
--prefix=${install_dir}
--pkgconfigdir=${install_dir}/lib/pkgconfig
# Program options:
#--disable-programs # don't disable for ffmpeg tool
# Documentation options
--disable-doc
--disable-htmlpages
--disable-manpages
--disable-podpages
--disable-txtpages
# Component options:
#--disable-avfilter # don't disable for ffmpeg tool
--disable-avdevice
--disable-postproc
--disable-avresample
--disable-network
# Individual component options:
--disable-everything
--enable-decoder=h264
--enable-demuxer=mov
--enable-parser=h264
--enable-muxer=image2 # https://superuser.com/a/915337
--enable-demuxer=image2
--enable-protocol=file
--enable-encoder=bmp
--enable-filter=scale,overlay # 'scale' filter not present
# External library support:
--disable-autodetect
--enable-libx264
# Toolchain options:
--enable-cross-compile
--cc=${MY_CC}
--cxx=${MY_CXX}
# Advanced options (experts only):
# Optimization options (experts only):
--disable-asm
# Developer options (useful when working on FFmpeg itself):
--disable-asm
--enable-debug
--disable-optimizations
)
function build_ffmpeg
{
target=${FFMPEG_URL}
name=${target##*/}
wget ${target} -O ${name}
tar zxvf ${name}
pushd FFmpeg-${name%.*.*}
export PKG_CONFIG_PATH=${install_dir}/lib/pkgconfig
CC=${MY_CC} CXX=${MY_CXX} ./configure ${configure_opts[@]} && make -j8 && make install
popd
}
build_x264
build_ffmpeg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment