Skip to content

Instantly share code, notes, and snippets.

@contribu
Last active May 16, 2023 15:16
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save contribu/8a572edaccb86ae749449a3fec83ce5f to your computer and use it in GitHub Desktop.
Save contribu/8a572edaccb86ae749449a3fec83ce5f to your computer and use it in GitHub Desktop.
#!/bin/bash
# License of this script: CC0
# Installation of dependent libraries and softwares is required to use this script
# ex. nasm, yasm, libmp3lame-dev, libopus-dev, libvorbis-dev, libvpx-dev...
set -ex
# setup
temp_dir=$(mktemp -d)
# build openh264
cd $temp_dir
git clone -b v1.7.0 --depth 1 --single-branch https://github.com/cisco/openh264.git
cd openh264
make -j `nproc`
sudo make install
sudo ldconfig
# replace openh264 binary to avoid license problem
cd $temp_dir
curl -o ./libopenh264-1.7.0-linux64.4.so.bz2 -L https://github.com/cisco/openh264/releases/download/v1.7.0/libopenh264-1.7.0-linux64.4.so.bz2
bunzip2 libopenh264-1.7.0-linux64.4.so.bz2
sudo cp libopenh264-1.7.0-linux64.4.so /usr/local/lib/libopenh264.so.1.7.0
sudo rm /usr/local/lib/libopenh264.a
# build ffmpeg
cd $temp_dir
git clone https://git.ffmpeg.org/ffmpeg.git
cd ffmpeg
git checkout n3.4.2
./configure --enable-libopenh264 --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx
make -j `nproc`
sudo make install
# cleanup
cd
rm -rf $temp_dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment