DEV Community

Cover image for Using a newer version of FFmpeg with Docker.

Posted on


Using a newer version of FFmpeg with Docker.


Hello, I needed to use FFmpeg in a node application, however the problem was the default FFmpeg that can be installed with the node image was too old and didn't support what I was trying to do.

There were two ways to handle this either compile FFmpeg from source, which would take a while and I really didn't want to have a long Dockerfile, not to mention the cleanup afterwards.

So I decided to copy the FFmpeg bin from the "jrottenberg/ffmpeg:4.4-alpine" into the Nodejs image. Reason being it's simpler.

Using FFmpeg 4.4 with the node image

To use the FFmpeg bin with the node image I changed the head of my Dockerfile like so:

FROM jrottenberg/ffmpeg:4.4-alpine AS FFmpeg
FROM node:16-alpine

COPY --from=FFmpeg / /
Enter fullscreen mode Exit fullscreen mode

With this I was able to use FFmpeg 4.4 with the Node 16 image.
I also learned something new about Docker.

Hopefully this will help me in future projects, and hopefully be of use to you.

Latest comments (2)

unmanner profile image
Alexey Kryazhev

seems like copying just /usr/local should be enough:

ethand91 profile image

I see. Thanks for sharing :)