Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tutorial] Building an FFmpeg static binary for ARMv7
23-04-2016, 13:25 (This post was last modified: 05-11-2020 23:21 by simoncn.)
Post: #1
[Tutorial] Building an FFmpeg static binary for ARMv7
Edit: updated this tutorial for FFmpeg 4.1.

This tutorial describes the steps needed to build a static binary for FFmpeg that can run on an ARMv7 Linux platform (typically a NAS or a single-board computer). To perform the build, you need an Intel-based computer running Linux. The following instructions have been tested on Ubuntu 16.04 LTS x64.

Build instructions:

1) Create a local directory (your linaro directory) that you will use to install the linaro cross-compiler (example: /sd1/linaro)

2) Download the linaro gcc cross-compiler from this link to your linaro directory

3) With your linaro directory as the current directory, run the command:
tar xf gcc-linaro-arm-linux-gnueabihf-4.7-2012.11-20121123_linux.tar.bz2

4) Create a local directory (your ff directory) for the FFmpeg build (example: /sd1/ff)

5) Download the libsoxr 0.1.3 source archive from this link to your ff directory

6) Download the FFmpeg 4.1 source archive from this link to your ff directory.

7) Download the file crtfastmath.c from this link to your ff directory. You will probably need to right-click on the link and select "Save as".

8) Download the script file makeff.sh from this link to your ff directory and make it executable by running the command:
chmod 755 makeff.sh

9) Edit the makeff.sh script file to change the LINARO= line to match the name of your linaro directory

10) If cmake isn't already installed, run the command: sudo apt-get install cmake

11) With your ff directory as the current directory, start the build by running the command: ./makeff.sh

12) When the build has completed successfully (about 30 minutes), you will find the static binary as a file named ffmpeg in the directory ffmpeg/ffmpeg-4.1/build underneath your ff directory

The static binary includes libsoxr and doesn't include any other additional libraries. It contains the default FFmpeg components without any nonfree or GPL code. If you want to change this, you can edit the makeff.sh file.

Problem solving:

The build log is written to the file makeff.log in your ff directory. If the ./makeff.sh command doesn't complete successfully, check this file for error messages.

If you are using Linux x64 and makeff.sh fails with a message about libstdc++.so.6, run the command sudo apt-get install lib32stdc++6 and then rerun the ./makeff.sh command.

If you are using Linux x64 and makeff.sh fails with a message about libz.so.1, run the command sudo apt-get install lib32z1 and then rerun the ./makeff.sh command.

If you have any problems or questions, please post them here.
Find all posts by this user
Quote this message in a reply
23-04-2016, 15:37 (This post was last modified: 23-04-2016 15:38 by bubbleguuum.)
Post: #2
RE: [Tutorial] Building an FFmpeg static binary for ARMv7
BubbleUPnP Server has exactly the same problematic, where it needs a recent ffmpeg compiled with most codecs, and ideally SoX and https support (which are rarely available in stock binaries).

The cool news is that the Optware-ng project provides nice ffmpeg/ffprobe binaries with all of the above for many archs, including all ARM variants and MIPSEL.

These binaries are a breeze to install:

- install Optware-ng following its install instructions
- install the ffmpeg package:
ipkg install ffmpeg
- ffmpeg is in /opt/bin, ready to use

This can be used on Raspberry Pi, Synology (it has a usable default ffmpeg but no ffprobe), QNAP, MIPSEL based routers, i686 Linux, custom devices, etc.
Find all posts by this user
Quote this message in a reply
23-04-2016, 17:22
Post: #3
RE: [Tutorial] Building an FFmpeg static binary for ARMv7
(23-04-2016 15:37)bubbleguuum Wrote:  The cool news is that the Optware-ng project provides nice ffmpeg/ffprobe binaries with all of the above for many archs, including all ARM variants and MIPSEL.

Thanks for this pointer. I gave up on Optware some time ago because almost everything in the repository was too old to be of any interest. It's good to hear that it has a new lease of life now. Smile
Find all posts by this user
Quote this message in a reply
23-04-2016, 17:39 (This post was last modified: 23-04-2016 17:40 by bubbleguuum.)
Post: #4
RE: [Tutorial] Building an FFmpeg static binary for ARMv7
(23-04-2016 17:22)simoncn Wrote:  
(23-04-2016 15:37)bubbleguuum Wrote:  The cool news is that the Optware-ng project provides nice ffmpeg/ffprobe binaries with all of the above for many archs, including all ARM variants and MIPSEL.

Thanks for this pointer. I gave up on Optware some time ago because almost everything in the repository was too old to be of any interest. It's good to hear that it has a new lease of life now. Smile

Speaking of which, Optware-ng provides up to date OpenJDK 7 and 8 packages for these archs (including MIPSEL) that seems to work well (stable). It is of course slower than Oracle's JRE, but a usable alternative when Oracle is not available. It had a few issues with crypto (TLS) that affected BubbleUPnP Server but I could workaround the major issues. Making these OpenJDK packages has not exactly been a piece of cake for alllexx88 who made them.
Find all posts by this user
Quote this message in a reply
23-04-2016, 18:35
Post: #5
RE: [Tutorial] Building an FFmpeg static binary for ARMv7
(23-04-2016 17:39)bubbleguuum Wrote:  Speaking of which, Optware-ng provides up to date OpenJDK 7 and 8 packages for these archs (including MIPSEL) that seems to work well (stable). It is of course slower than Oracle's JRE, but a usable alternative when Oracle is not available. It had a few issues with crypto (TLS) that affected BubbleUPnP Server but I could workaround the major issues. Making these OpenJDK packages has not exactly been a piece of cake for alllexx88 who made them.

This is good to know. However, I have a different opinion on whether a 5x slowdown on ARM processors when scanning the MinimServer library or doing transcoding is usable. My recommendation is therefore that all MinimServer users should use Oracle Java when runnng MinimServer on an ARM processor. I haven't noticed any performance difference on Intel processors.
Find all posts by this user
Quote this message in a reply
09-08-2017, 19:55 (This post was last modified: 17-08-2017 18:01 by rdsu.)
Post: #6
Star RE: [Tutorial] Building an FFmpeg static binary for ARMv7
simoncn,

Do you know if we can use the ffmpeg package, from SynoCommunity, for this matter?

Thanks
Find all posts by this user
Quote this message in a reply
09-08-2017, 22:16
Post: #7
RE: [Tutorial] Building an FFmpeg static binary for ARMv7
(09-08-2017 19:55)rdsu Wrote:  simoncn,

Do you know if we can use the ffmpeg package, from SynoCommunity, for this matter?

Thanks

From a quick look, it seems that this isn't built with libsoxr (similar to the preinstalled ffmpeg in DSM).
Find all posts by this user
Quote this message in a reply
09-08-2017, 23:22
Post: #8
RE: [Tutorial] Building an FFmpeg static binary for ARMv7
I will request if they can add it...

Thanks
Find all posts by this user
Quote this message in a reply
17-08-2017, 18:05
Post: #9
RE: [Tutorial] Building an FFmpeg static binary for ARMv7
[Request] ffmpeg with libsoxr

Next version will have the libsox... Wink
Find all posts by this user
Quote this message in a reply
20-01-2019, 18:36
Post: #10
RE: [Tutorial] Building an FFmpeg static binary for ARMv7
I have updated the tutorial in this post to provide instructions for building the latest 4.1 release of FFmpeg. The updated build procedure also ensures that the FFmpeg static binary is fully compatible with the Melco N1/N100/N10.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)