BtbN / FFmpeg-Builds

MIT License
7.76k stars 1.07k forks source link

Can these be used in Alpine docker? #405

Closed ghnp5 closed 2 months ago

ghnp5 commented 2 months ago

I'm getting a "not found", which usually would mean the binary is unreadable, I believe.

RUN mkdir -p /usr/local/src && cd /usr/local/src && \
    wget https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n7.0-latest-linux64-gpl-7.0.tar.xz && \
    tar -xvf ffmpeg-n7.0-latest-linux64-gpl-7.0.tar.xz "ffmpeg-n7.0-latest-linux64-gpl-7.0/bin/" && \
    chmod +x ffmpeg-n7.0-latest-linux64-gpl-7.0/bin/* && \
    mv ffmpeg-n7.0-latest-linux64-gpl-7.0/bin/* /usr/bin/ && \
    rm ffmpeg-n7.0-latest-linux64-gpl-7.0.tar.xz && \
    which ffmpeg && ls -la /usr/bin/ffmpeg && \
    /usr/bin/ffmpeg -version

Outputs (the last 3 commands):

/usr/bin/ffmpeg -rwxr-xr-x 1 1001 127 128186448 Sep 21 12:33 /usr/bin/ffmpeg /bin/sh: /usr/bin/ffmpeg: not found

Thanks!

BtbN commented 2 months ago

iirc alpine uses musl, so unless you can install glibc or some compat layer if that exists, they won't run.

ghnp5 commented 2 months ago

Thank you for your reply. That was very quick!

I wonder how they currently build a working ffmpeg, which is available in their repo. Just that unfortunately it's version 6, still...

(I had a look at the discussion at #105 and #165)

BtbN commented 2 months ago

You can build ffmpeg against musl just fine, but pre-built binaries that aren't fully static need to pick a libc. It's possible to make a fully static ffmpeg, but it breaks a lot of stuff that relies on runtime-loading libraries, like most hardware accelerations. So for musl-systems, you need ffmpeg that's built against musl or fully static.

ghnp5 commented 2 months ago

Thanks! That helps.

Looks like wader/static-ffmpeg works for me, because it's fully static:

COPY --from=mwader/static-ffmpeg:7.0.2 /ffmpeg /usr/bin/
COPY --from=mwader/static-ffmpeg:7.0.2 /ffprobe /usr/bin/
RUN ffmpeg -version

Thanks again!