Saturday 30 July 2011

Transcoding movies for Android devices using WinFF ffmpeg and Ubuntu

This is the easiest way to get the task done, it is not pretty but it should work fine.  I tried it on Ubuntu 11.04 no problems.


So I was wanting to watch some AVI files on my ZTE V9 Android device, but had to recode them into mp4 before watching.  Unfortunately the stock Ubuntu version of winff does not allow mp4 coding natively, however there is a easy workaround

Following the instructions on http://ubuntuforums.org/showthread.php?t=786095, I did this:

sudo apt-get remove ffmpeg x264 libx264-dev
sudo apt-get update
sudo apt-get install build-essential checkinstall git checkinstall libfaac-dev \
    libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev \
    libsdl1.2-dev libtheora-dev libva-dev libvdpau-dev libvorbis-dev libx11-dev \
    libxfixes-dev libxvidcore-dev texi2html yasm zlib1g-dev
cd
git clone git://git.videolan.org/x264
cd x264
./configure --enable-static
make
sudo checkinstall --pkgname=x264 --pkgversion="3:$(./version.sh | \
    awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes \
    --fstrans=no --default
cd
git clone git://git.videolan.org/ffmpeg
cd ffmpeg
./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb \
    --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 \
    --enable-libxvid --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab
make
sudo checkinstall --pkgname=ffmpeg --pkgversion="5:$(date +%Y%m%d%H%M)-git" --backup=no \
  --deldoc=yes --fstrans=no --default
hash x264 ffmpeg ffplay ffprobe
cd ~/x264
make distclean
./configure --enable-static
make
sudo checkinstall --pkgname=x264 --pkgversion="3:$(./version.sh | \
    awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes \
    --fstrans=no --default

Install winff using synaptic

apt-get install winff


Download the winff presets from winff site
http://winff.googlecode.com/files/presets-libavcodec52-v6.xml.gz
Extract and copy over the previous ~/.winff/presets.xml  you may want to back up the existing file first.

Open WinFF
In the winff preferences change the path to ffmpeg anf ffplay to:
/usr/local/bin/ffmpeg
/usr/local/bin/ffplay

Looking in the presets, you will notice that there is now a mp4 section and also a Android compatible video section, I chose the Android section for my coding.






WindyCityTech Blogger
windywindycitytech wordpress

No comments:

Post a Comment