and other brilliant error messages

Update 3 – Updated the guide for building FFmpeg 2.1, with libx264 which is required for Serviio 1.3. The patch for the libshine encoder is no longer needed now that it has been merged into FFmpeg. I’m proud to have suggested and tested that feature and contributed in some small way to FFmpeg!

Update – I discovered that the cross-compiled ARMv5 build of FFmpeg cannot encode AC3 audio without severe artifacts. After a very long time spent recompiling with different options, trying static builds etc. I finally found that the Synology cross toolchain (GCC 4.2.1) appears to cause the problem. Compiling natively on a bootstrapped ARMv5 Synology system with GCC 4.2.3 produces a working binary. However, I had to spend a long time re-working the method, particularly since you can’t run automake to build libshine on the Synology due to a dependency on a threaded version of Perl, which is missing from the Optware repo, and in turn is very tricky to compile. I have appended the ARM shared build guide to the end of this post.

This method will build FFmpeg with portable shared libraries (linked with relative paths) using a Ubuntu Desktop 12 VM. The >10MB size of the static executable is kind of getting out of hand especially on embedded systems with very limited RAM. Using shared libs means many concurrent instances of FFmpeg can use broadly the same memory footprint, and package distribution binaries can be smaller – our target systems already have libmp3lame, libz, libssl, libcrypto, libfreetype, libexpat, and libpthread which add up to several megabytes. I’m also guessing that the OS will decide when to unload them from RAM which could help when FFmpeg is being launched repeatedly in a short period of time.

Although the unmodified source code will compile successfully for QorIQ CPUs, the FFmpeg binary will core dump when running any command on a video file. I contacted Synology Support for help with this issue. Their developers mentioned that they had needed to make numerous patches to the source of the version they used for DSM, and they guessed that the following one in particular was likely to be needed. This produced a working binary.

Native compile for ARMv5 systems

Here is the method to natively compile FFmpeg with libshine and libass, with shared libraries rather than static. It transpires that the cross compiled build has a broken AC3 encoder which produces crackling and muffled audio streams. The guide assumes a bootstrapped NAS with the optware-devel tools installed. See my much earlier blog post for details of how to set that up, since there are some pitfalls. I haven’t run through and tested the whole sequence – I have assembled this from hundreds of lines of notes I made while working – but I’m publishing it here to help others, and to refer to in future when I need to build newer FFmpeg revisions for future Serviio releases.

Here’s how the library dependencies look. There are no links to any libraries in /opt, and DSM-bundled libraries in /lib are linked to where possible. All the other new libraries are kept within the Serviio lib folder (../lib relative to the ffmpeg binary).

Hello, I don’t have any Linux experience but I need tom compile ffmpeg to support video streaming on my Intel Synology NAS.
I followed this note under a Ubuntu 12 VM (using Oracle VM).
The process seems to work correctly but I don’t have any ffmpeg file created.

Everything seem just fine ’til the end…
(I run it with sudo then as root)…

root@ubuntu:~/Downloads/DSM-source/ffmpeg# export CFLAGS=”-I${TOOLCHAIN}/include”
root@ubuntu:~/Downloads/DSM-source/ffmpeg# make
Makefile:2: config.mak: No such file or directory
Makefile:47: /common.mak: No such file or directory
Makefile:89: /libavutil/Makefile: No such file or directory
Makefile:89: /library.mak: No such file or directory
Makefile:169: /doc/Makefile: No such file or directory
Makefile:170: /tests/Makefile: No such file or directory
make: *** No rule to make target `/tests/Makefile’. Stop.
root@ubuntu:~/Downloads/DSM-source/ffmpeg# make install
Makefile:2: config.mak: No such file or directory
Makefile:47: /common.mak: No such file or directory
Makefile:89: /libavutil/Makefile: No such file or directory
Makefile:89: /library.mak: No such file or directory
Makefile:169: /doc/Makefile: No such file or directory
Makefile:170: /tests/Makefile: No such file or directory
make: *** No rule to make target `/tests/Makefile’. Stop.
root@ubuntu:~/Downloads/DSM-source/ffmpeg#

I tried many times, many different ways but I’ve been unable to compile an INTEL version.
I created a VM (VirtualBOX) with Ubuntu 12.10, 10.04 (64bits AND 32bits) and never been able to pass the librtmp & ffmpeg compilation.

I searched on Internet and already spend to much hours ;o(
If anyone could share an “how to”, this will be just fantastic !
This way anyone could compile…

If not, do anybody will be nice enough to share an INTEL version ?
PS It will be used for Subsonic and video support ;o)

What I like about all this Serviio and Synology business is WHAT DOES IT ALL MEAN????

I have a Synology NAS, I have a Samsung Smart TV – I want the F**ker to play Xvid, .MKV – I heard Serviio would help me achieve this. But I’ll be f**ked if I can follow your instructions / find the links to where the files reside.

I admit I might be a bit dyslexic and have the attention of a gnat, but two hours in I haven’t a f**king clue why I can’t get things working. I need you to provide pictures, step by step instruction, links to files, instructions on where to save them, instruction of which ones to download first and install first, if I need to extract them, where to extract them, how to get the Synology NAS to act upon the information. No abriviation, no block paragraph’s. Even a youtube video would be helpful.

Or if you think I need to direct my frustrations at Synology please let me know.

I’m afraid I don’t have time to record YouTube videos for you. The intended audience for my posts is a reasonably technical one. If you are only interested in running Serviio, this particular post is not for you – it’s intended to show other technically-minded people how I compiled FFmpeg so as to help other aspiring Linux hobbyists. For running Serviio on Synology you want this post:

Thanks, post corrected. It’s entirely possible there are some more errors in there. When I last updated it I had an issue in the WordPress editor and had to revert to a draft, whereupon WordPress helpfully mangled the syntax of the whole thing by HTML encoding the entire post. It made a real mess, and the only way back was the run the post back through a free online HTML decoder – but I guess it wasn’t perfect.

Hi,
thanks a lot for this one… I think it might be quite helpful even for other compiling projects. Currently I try to cross-compile ReadyMedia (aka miniDLNA) for the Synology DiskStation DS213+ under DS4.3. However I can’t seem to get it working right. I managed once to compile the minidlnad deamon, starting it on the diskstation returned in some dump.

Might somebody be interested in helping out with the ReadyMedia compilation?