I'm trying to compile ffmpeg as a standalone binary (because I want to use it in AWS lambda)
I can get things to work fine on the server where I'm compiling, but if I copy the binary and run it from another server, I get:
./ffmpeg: error while loading shared libraries: libvdpau.so.1: cannot open shared object file: No such file or directory
So it sounds like something didn't made it into the binary. From what I've read, I've to compile ffmpeg with the flags --disable-shared and --enable-static, which I've done:
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
--prefix="$HOME/ffmpeg_build" \
--pkg-config-flags="--static" \
--extra-cflags="-I$HOME/ffmpeg_build/include" \
--extra-ldflags="-L$HOME/ffmpeg_build/lib" \
--bindir="$HOME/bin" \
--disable-shared \
--enable-static \
--enable-gpl \
--enable-libass \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libvpx \
--enable-libx264
PATH="$HOME/bin:$PATH" make
make install
make distclean
hash -r
Is there something I'm missing?
Even though I didn't succeed to compile everything in one binary, I've been able to upload the dependencies to AWS lambda by doing:
I wrote a python script to do that. The script relies on lld to list the dependencies.
#!/usr/bin/env python
import subprocess
import os
from shutil import copyfile
def copyLibraries(bin, destination):
if not os.path.exists(destination):
os.makedirs(destination)
output = subprocess.Popen(["ldd", bin], stdout=subprocess.PIPE).communicate()[0]
for l in output.split('\n'):
if len(l.split("=> ")) > 1:
lib_location = l.split("=> ")[1].split(" ")[0].strip()
if lib_location != "":
real_location = os.path.realpath(lib_location)
lib_name = real_location.split('/')[-1]
copyfile(real_location, destination + lib_name)
if os.path.islink(lib_location):
link_name = lib_location.split('/')[-1]
if link_name != lib_name:
os.symlink(real_location, destination + link_name)
copyLibraries("/home/ubuntu/bin/ffmpeg", "/home/ubuntu/libs/")
node.js this can be done as:.
process.env['PATH'] = process.env['PATH'] +
':' + process.env['LAMBDA_TASK_ROOT'] +
':' + process.env['LAMBDA_TASK_ROOT'] + '/bin' +
':' + process.env['LAMBDA_TASK_ROOT'] + '/lib';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With