Skip to content

Instantly share code, notes, and snippets.

@amaya382
Last active August 29, 2015 14:12
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 amaya382/71f1ba4b5df4d476690e to your computer and use it in GitHub Desktop.
Save amaya382/71f1ba4b5df4d476690e to your computer and use it in GitHub Desktop.
chinachu encode
#!/bin/bash
log=/home/chinachu/chinachu/log/encode
echo -----start encoding @$(date +%Y/%m/%d/%H:%M:%S)----- >> $log
start=$(date +%s)
echo $1 >> $log
ffmpeg -i $1 -vcodec libx264 -acodec libfdk_aac -tune animation ${1%.*}.mp4 2>&1 | grep "^[^f]" >> $log
end=$(date +%s)
diff=$(expr $end - $start)
echo about $(expr $diff / 60) min. >> $log
echo ---finish encoding @$(date +%Y/%m/%d/%H:%M:%S)--- >> $log
echo >> $log
exit 0
sudo apt-get remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
sudo apt-get -y install build-essential libfaac-dev libgpac-dev \
libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev \
librtmp-dev libsdl1.2-dev libtheora-dev libva-dev libvdpau-dev libvorbis-dev \
libx11-dev libxfixes-dev pkg-config texi2html yasm zlib1g-dev
# libx264(for mp4)
cd
mkdir tmp
cd tmp
git clone --depth 1 git://git.videolan.org/x264
cd x264
./configure --enable-static
make
sudo make install
# libfdk-aac(for mp4)
cd ../
wget http://downloads.sourceforge.net/opencore-amr/fdk-aac-0.1.0.tar.gz
tar xzvf fdk-aac-0.1.0.tar.gz
cd fdk-aac-0.1.0
./configure
make
sudo make install
# libvpx(for webm)
cd ../
git clone --depth 1 http://git.chromium.org/webm/libvpx.git
cd libvpx
./configure
make
sudo make install
# libopus(or apt-get?)(for webm)
cd ~/tmp
wget http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz
tar xzvf opus-1.1.tar.gz
cd opus-1.1
./configure --disable-shared
make
sudo make install
# ffmpeg
cd ../
wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
tar xjvf ffmpeg-snapshot.tar.bz2
cd ffmpeg
./configure --bindir="/usr/local/bin" --extra-libs=-ldl --enable-gpl \
--enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libtheora \
--enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab --enable-libfaac
make
sudo make install
  1. make ffmpeg
  2. put encode.sh
  3. add following to chinachu settings and restart chinachu
"recordedCommand": "/path/to/encode.sh",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment