Building ffmpeg with libx264 support
June 4, 2017

1. Building libx264

# Clone Repository & configure
git clone git://git.videolan.org/x264.git
cd x264
./configure --prefix=/opt/ffmpeg --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree --enable-libfontconfig --enable-libfreetype
# Make & install
make -j4 && make install
sudo ldconfig

git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
sudo ./configure --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree --enable-libfontconfig --enable-libfreetype
make -j4 && make install

# Create System Alias
sudo vi /etc/bash.bashrc
# Add Line
# alias ffmpeg='/opt/ffmpeg/bin/ffmpeg'

4. Happy Recording!

ffmpeg \
-i "%SOURCE%" \
-s 640x480 -r 30 \
-vf "drawtext='fontfile=/usr/share/fonts/truetype/freefont/FreeSans.ttf: text=%{localtime\}': fontcolor=yellow@1: box=1: boxcolor=black@0.9: x=10: y=400" \
-vcodec libx264 \
-vb 1500k \
-pix_fmt yuv420p \
-preset ultrafast \
-f mp4 /var/www/html/video/$(date +%Y%m%d-%H%M%S).mp4
Tags: ,