finally I've managed to compile a better and faster ffmpeg, mplayer and mediainfo (http://mediainfo.sourceforge.net/en) for my DS-409+.
As a test I wrote up a script that is used to create a video overview image with several screens and technical information like this:

This script finishes that task on the DS in 17 seconds:
- Code: Select all
diskstation> time sh imagegrabber-busybox -big -fast -idx /volume1/Video/Animations\ -\ Shorts/elephantsdream-1920-hd-mpeg4-su-ac3.avi
mediainfo = /opt/bin/mediainfo
mplayer = /usr/local/bin/mplayer
ffmpeg = /usr/local/bin/ffmpeg
convert = /opt/bin/convert
montage = /opt/bin/montage
Retrieving video details...
--> file size = 260.777 MiB
--> duration = 653 seconds
--> resolution = 1920x1080 pixels
--> video codec = S-Mpeg 4 v2
--> audio codec = AC-3
--> frame rate = 24.000
--> frame count = 15691
--> display aspect ratio = 16:9
AVI: ODML: Broken (incomplete?) file detected. Will use traditional index.
--> printed duration = 00:02:32
--> printed frame rate = 24.000
Generating video info...
--> field values
--> field labels
Extracting screen #1 (00:00:15)...
Extracting screen #2 (00:00:30)...
Extracting screen #3 (00:00:45)...
Extracting screen #4 (00:01:00)...
Extracting screen #5 (00:01:16)...
Extracting screen #6 (00:01:31)...
Extracting screen #7 (00:01:46)...
Extracting screen #8 (00:02:01)...
Extracting screen #9 (00:02:16)...
Building final overview image (using +/-append) ...
real 0m 17.08s
user 0m 15.57s
sys 0m 1.09s
For a comparison I tried the same script (modifying some paths only) on a Quad-Core Linux PC. After 5 runs it had the video file almost completely in file cache so almost no NFS overhead is involved:
- Code: Select all
ancoron@quadcore:~$ time imagegrabber-busybox -big -fast -idx /net/diskstation/video/Animations\ -\ Shorts/elephantsdream-1920-hd-mpeg4-su-ac3.avi
mediainfo = /usr/bin/mediainfo
mplayer = /usr/bin/mplayer
ffmpeg = /usr/bin/ffmpeg
convert = /usr/bin/convert
montage = /usr/bin/montage
Retrieving video details...
--> file size = 260.777 MiB
--> duration = 653 seconds
--> resolution = 1920x1080 pixels
--> video codec = S-Mpeg 4 v2
--> audio codec = AC-3
--> frame rate = 24.000
--> frame count = 15691
--> display aspect ratio = 16:9
AVI: ODML: Broken (incomplete?) file detected. Will use traditional index.
--> printed duration = 00:02:32
--> printed frame rate = 24.000
Generating video info...
--> field values
--> field labels
Extracting screen #1 (00:00:15)...
Extracting screen #2 (00:00:30)...
Extracting screen #3 (00:00:45)...
Extracting screen #4 (00:01:00)...
Extracting screen #5 (00:01:16)...
Extracting screen #6 (00:01:31)...
Extracting screen #7 (00:01:46)...
Extracting screen #8 (00:02:01)...
Extracting screen #9 (00:02:16)...
Building final overview image (using +/-append) ...
real 0m19.457s
user 0m42.690s
sys 0m0.670s
Well, that's nice.
mediainfo
Compiling mediainfo was just straight forward as it doesn't have any external dependency. I just had to add some options for cross-compiling and disabling parallel make:
- Code: Select all
CONFIG_OPTS="--host=powerpc-unknown-linux --target=powerpc-unknown-linux --build=i686-pc-linux --prefix=/usr/local"
ZenLib_Options=""
CC=/usr/local/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-gcc
export CC
CXX=/usr/local/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-g++
export CXX
LD=/usr/local/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-ld
export LD
RANLIB=/usr/local/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-ranlib
export RANLIB
CFLAGS="-I/usr/local/powerpc-linux-gnuspe/include -mcpu=8548 -mhard-float -mfloat-gprs=double"
export CFLAGS
CXXFLAGS="$CFLAGS"
export CXXFLAGS
LDFLAGS="-L/usr/local/powerpc-linux-gnuspe/lib"
export LDFLAGS
#############################################################################
# Setup for parallel builds
Zen_Make()
{
make
}
Just make sure to include the custom configure options:
- Code: Select all
./configure $ZenLib_Options $CONFIG_OPTS $*
ffmpeg
Compiling ffmpeg required some other libraries and header files obtained through IPKG. But in the end it was very straight forward too:
- Code: Select all
./configure --enable-cross-compile --disable-altivec --cross-prefix=/usr/local/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe- --arch=powerpc --prefix=/usr/local --extra-cflags="-I/usr/local/powerpc-linux-gnuspe/opt/include -I/usr/local/powerpc-linux-gnuspe/include -mcpu=8548 -mhard-float -mfloat-gprs=double" --extra-ldflags="-L/usr/local/powerpc-linux-gnuspe/opt/lib -L/usr/local/powerpc-linux-gnuspe/lib -R/usr/local/lib:/opt/lib" --enable-shared --disable-static --enable-gpl --enable-nonfree --enable-postproc --enable-swscale --enable-avfilter --enable-avfilter-lavf --enable-libmp3lame --enable-libvorbis --enable-libxvid --disable-ffserver --disable-ffplay --disable-network --disable-devices --disable-vhook
This is against which libraries my ffmpeg is linked:
- Code: Select all
diskstation> sh /root/ldd /usr/local/bin/ffmpeg
libavfilter.so.0 => /usr/local/lib/libavfilter.so.0 (0x0ffdb000)
libpostproc.so.51 => /usr/local/lib/libpostproc.so.51 (0x0ffb1000)
libswscale.so.0 => /usr/local/lib/libswscale.so.0 (0x0ff6a000)
libavdevice.so.52 => /usr/local/lib/libavdevice.so.52 (0x0ff48000)
libavformat.so.52 => /usr/local/lib/libavformat.so.52 (0x0fe36000)
libavcodec.so.52 => /usr/local/lib/libavcodec.so.52 (0x0f7be000)
libavutil.so.49 => /usr/local/lib/libavutil.so.49 (0x0f78b000)
libm.so.6 => /lib/libm.so.6 (0x0f6e8000)
libc.so.6 => /lib/libc.so.6 (0x0f58a000)
libz.so.1 => /opt/lib/libz.so.1 (0x0f557000)
libbz2.so.1.0 => /opt/lib/libbz2.so.1.0 (0x0f524000)
libmp3lame.so.0 => /opt/lib/libmp3lame.so.0 (0x0f48e000)
libvorbisenc.so.2 => /opt/lib/libvorbisenc.so.2 (0x0f378000)
libvorbis.so.0 => /opt/lib/libvorbis.so.0 (0x0f32b000)
libxvidcore.so.4 => /opt/lib/libxvidcore.so.4 (0x0f221000)
/lib/ld.so.1 (0x30000000)
libogg.so.0 => /opt/lib/libogg.so.0 (0x0f1fb000)
libpthread.so.0 => /lib/libpthread.so.0 (0x0f18a000)
mplayer
Mplayer is a bit of a beast when it comes to cross-compiling as its configure script doesn't provide parameters for separate host and target gcc. Therefore I just configured mplayer for the target:
- Code: Select all
./configure --prefix=/usr/local --disable-vm --disable-xf86keysym --disable-tv --enable-rpath --enable-cross-compile --cc=/usr/local/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-gcc --as=/usr/local/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-as --nm=/usr/local/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-nm --ar=/usr/local/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-ar --ranlib=/usr/local/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-ranlib --target=powerpc-unknown-linux --extra-cflags="-I/usr/local/powerpc-linux-gnuspe/opt/include -I/usr/local/powerpc-linux-gnuspe/include -mcpu=8548 -mhard-float -mfloat-gprs=double" --extra-ldflags="-L/usr/local/powerpc-linux-gnuspe/lib -L/usr/local/powerpc-linux-gnuspe/opt/lib -R/usr/local/lib:/opt/lib" --enable-png --enable-jpeg
After that don't just run make, as this won't work. I had to modify the generated config.mak file to use the correct host gcc and to disable stripping:
- Code: Select all
HOST_CC = gcc
...
INSTALLSTRIP =
But after that change make && make install just went through (although I encountered a lot of compile warnings). The output of ldd on the syno box shows up like this:
- Code: Select all
diskstation> sh /root/ldd /usr/local/bin/mplayer
libjpeg.so.62 => /opt/lib/libjpeg.so.62 (0x0ffbc000)
libfreetype.so.6 => /opt/lib/libfreetype.so.6 (0x0ff24000)
libfontconfig.so.1 => /opt/lib/libfontconfig.so.1 (0x0fed1000)
libbz2.so.1.0 => /opt/lib/libbz2.so.1.0 (0x0fe9e000)
libxvidcore.so.4 => /opt/lib/libxvidcore.so.4 (0x0fd94000)
libm.so.6 => /lib/libm.so.6 (0x0fcf1000)
libpthread.so.0 => /lib/libpthread.so.0 (0x0fc80000)
libdl.so.2 => /lib/libdl.so.2 (0x0fc5d000)
libmp3lame.so.0 => /opt/lib/libmp3lame.so.0 (0x0fbc7000)
libc.so.6 => /lib/libc.so.6 (0x0fa69000)
libz.so => /opt/lib/libz.so (0x0fa36000)
libexpat.so.1 => /opt/lib/libexpat.so.1 (0x0f9f0000)
/lib/ld.so.1 (0x30000000)
If anyone needs further instructions please don't hesitate.
Ancoron




