The TS-419P II has a 2 GHz Marvell Feroceon "Kirkwood" CPU, which is an armv5tel architecture, according to "uname -m" - we have to keep this in mind when compiling some of the packages, since we will be tuning builds for this architecture and will have to disable platform-specific assembly optimizations for the most part. Now, onto the steps involved:
- Install "Optware IPKG" via the QNAP Qpkg centre, if you haven't already.
- Log into the NAS via ssh.
- Install the some packages required for building ffmpeg and its dependencies via ipkg, by typing:
ipkg update ipkg install gcc make pkgconfig libstdc++ git coreutils
- Ensure that /etc/ld.so.conf is set up so that /opt/lib is a location for shared libraries:
if ! grep -q /opt/lib /etc/ld.so.conf; then echo /opt/lib >> /etc/ld.so.conf; else echo no; fi
Alternatively, you can manually edit /etc/ld.so.conf and make sure it looks like this:/lib /usr/lib /usr/local/lib /opt/lib
- Install some codec libraries for ffmpeg via ipkg:
ipkg install lame faad2 libogg libtheora libvorbis libmatroska libmpeg2
- Next, create a directory in which you can download and compile some required packages:
mkdir /opt/build
- Build & install faac:
cd /opt/build/ wget http://downloads.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.gz tar -xzvf faac-1.28.tar.gz cd faac-1.28/ CFLAGS="-march=armv5te -mtune=marvell-f -Wall -O2 -fstrength-reduce -finline-functions -ffast-math -fomit-frame-pointer" ./configure --prefix=/opt --enable-static=no make make install
- Build & install x264 (the version shipped by ipkg is too old for ffmpeg):
cd /opt/build/ git clone git://git.videolan.org/x264.git cd x264/ CFLAGS="-march=armv5te -Wall -O2 -fstrength-reduce -finline-functions -ffast-math -fomit-frame-pointer" ./configure --prefix=/opt --enable-shared --system-libx264 --disable-asm make make install
- Build & install xvidcore:
Note: the configure script for the latest xvidcore isn't compatible with the awk tool available on the QNAP NAS. The workaround is to download an earlier version of xvidcore as well and replace the current version's configure script with the older one; this is done in the example below:cd /opt/build/ wget http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz tar -xzvf xvidcore-1.3.2.tar.gz cd xvidcore/build/generic/ wget http://downloads.xvid.org/downloads/xvidcore-1.3.0.tar.gz tar -xzvf vidcore-1.3.0.tar.gz cp -v xvidcore/build/generic/configure . CFLAGS="-march=armv5te -mtune=marvell-f -Wall -O2 -fstrength-reduce -finline-functions -ffast-math -fomit-frame-pointer" ./configure --prefix=/opt make make install
- Finally, build & install ffmpeg:
cd /opt/build/ wget http://ffmpeg.org/releases/ffmpeg-1.2.tar.gz tar -xzvf ffmpeg-1.2.tar.gz cd ffmpeg-1.2/ CFLAGS="-march=armv5te -Wall -O2 -fstrength-reduce -finline-functions -ffast-math -fomit-frame-pointer" ./configure --prefix=/opt --enable-gpl --enable-nonfree --enable-bzlib --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --disable-asm --disable-debug make make install
- Run ldconfig to make sure all shared library additions are picked up:
ldconfig
If you would like to override the system's ffmpeg with your new custom version, simply edit your PATH and make sure /opt/bin comes before /usr/bin.