user3656901
user3656901

Reputation: 69

How do we determine the required dependencies for ffmpeg

I've installed ffmpeg on ubuntu. I am going to copy the compiled ffmpeg and required dependencies to a directory and copy that directory to another machine. This way we can run ffmpeg on another machine without installation. How do we determine the required dependencies to copy? Saw instruction on this page: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu, but it didn't explain the required dependencies for ffmpeg.

When I used ldd ffmpeg, I got something like:

    linux-vdso.so.1 (0x00007fffe20fd000)
    libavdevice.so.58 => /lib/x86_64-linux-gnu/libavdevice.so.58 (0x00007fc116e90000)
    libavfilter.so.7 => /lib/x86_64-linux-gnu/libavfilter.so.7 (0x00007fc116b10000)
    libavformat.so.58 => /lib/x86_64-linux-gnu/libavformat.so.58 (0x00007fc116890000)
    libavcodec.so.58 => /lib/x86_64-linux-gnu/libavcodec.so.58 (0x00007fc1152d0000)
    libavresample.so.4 => /lib/x86_64-linux-gnu/libavresample.so.4 (0x00007fc1152a0000)
    libpostproc.so.55 => /lib/x86_64-linux-gnu/libpostproc.so.55 (0x00007fc115270000)

Are those the required dependencies? It didn't list the files under bin, include or share folders.

Upvotes: 0

Views: 4447

Answers (2)

Emerson Gomes
Emerson Gomes

Reputation: 79

It seems that you just want to have some kind of offline file to move around between machines. Have you considered using snap?

You can download a snap in one machine using this command:

snap download ffmpeg

This will generate 2 files, to install in another machine, just copy them and then run:

  snap ack ffmpeg_1286.assert
  snap install ffmpeg_1286.snap

Upvotes: 2

Emerson Gomes
Emerson Gomes

Reputation: 79

It's probably not the best way to build a portable binary.

What you see are the library dependencies, but be aware that:

  • Each of this library will also have THEIR own dependencies which you also would need to track and copy;
  • They might conflict with the library version on the target machine, requiring you to use tricks (like setting LD_LIBRARY_PATH) to load the correct versions of libraries;
  • You will still be missing any non-lib dependency (like configuration files, for instance).

Also, just copying all these libraries to another machine does not guarantee they it will run there unless it is using the same distro version. They could have been built for a different glibc target, for instance.

Some better approaches are:

  1. Build a fully static binary instead: This normally can be achieved by adding "-static" as the first argument of your LDFLAGS environment variable while compiling. You will need to have or build static versions of all libraries that ffmpeg depend on. Some distros provide static library versions while others don't, so, be prepared to build all libraries yourself. The resulting binary will contain all of its dependencies bundled, and should run everywhere (1)

  2. Install/Build the software under a chroot: You can install a minimal chroot of some distro, and build all you need there. Then you can just move the chroot around other machines and it should work everywhere (1). Here are the instructions to get a minimal Gentoo chroot: https://wiki.gentoo.org/wiki/Chroot

  3. Attempt to use an ELF Statifier tool: These ones do not always work for all applications but could be worth a try. They will do the dirty job to find all the shared lib dependencies and bundle all of them into a single binary: http://statifier.sourceforge.net/

(1) - Everywhere meaning same arch and same or higher kernel version as your build machine. If you want to go further and create a static binary that is compatible with (much) older kernels, you will need also to build glibc setting the "--enable-kernel=version" configure switch.

Upvotes: 1

Related Questions