ffmpeg
ffmpeg copied to clipboard
Multistage build with 4.1-nvidia and node-alpine
Hi Guys, I've been trying for few days now to get this to work and I'm almost at the finish line but unable to reach it!
I need a docker image which had ffmpeg with nvidia and nodejs in it. I thought to try the following method:
FROM jrottenberg/ffmpeg:4.1-nvidia as base
FROM node:10-alpine
# copy ffmpeg bins from first image
COPY --from=base / /
ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:/usr/lib:/usr/lib64:/lib:/lib64
# Create app directory
WORKDIR /app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
RUN npm install
# Copy source code
COPY . .
# Expose port
EXPOSE 3002
CMD ["node", "server.js"]
I get the node.js server running and also am able to run ffmpeg but the probem occurs when I try to use the Nvidia GPU acceleration. I use the 'h264_nvenc' option and get the following error in the console:
[h264_nvenc @ 0x564f994960c0] Cannot load libcuda.so.1"
And I check in the docker container by:
docker exec -ti vja find / -name 'libcuda.so.1'
It return nothing so I assume it can't access it even though I run using:
docker run --network=host -p 3002:3002 --runtime=nvidia --gpus all -d --name vja video-editing-api-custom:latest
I have no issues when running the jrottenberg/ffmpeg:4.1-nvidia image on it's own and using h264_nvenc.
Does anyone have any ideas on how I could fix this or perhaps suggest a better solution to run node with ffmpeg:4.1-nvidia ?
Thank you!
Did you find any solution? I am looking for a similar setup
Hello !
I would stick to the ffmpeg base, and install nodejs (8 via default repo, or 10 through nodesource) on top of it
Hi, my problem is that I require the nvidia build so that I can use hardware acceleration :/
On Sun, 29 Mar 2020, 19:07 Julien Rottenberg, [email protected] wrote:
Hello !
I would stick to the ffmpeg base, and install nodejs (8 via default repo, or 10 through nodesource) on top of it
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jrottenberg/ffmpeg/issues/226#issuecomment-605676354, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALFHJL5DGEXQTFYLMYDE4MDRJ6E5DANCNFSM4LQ4NDYA .
for sure, keep the nvidia build but install nodejs on top of it
Whenever I do this the entry point is set as ffmpeg and I cant get it to run the nodejs server. What do you suggest?
On Mon, 30 Mar 2020, 17:21 Julien Rottenberg, [email protected] wrote:
for sure, keep the nvidia build but install nodejs on top of it
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jrottenberg/ffmpeg/issues/226#issuecomment-606099921, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALFHJL46CNATKRNTUVKJ5VDRKDBIJANCNFSM4LQ4NDYA .
Whenever I do this the entry point is set as ffmpeg and I cant get it to run the nodejs server. What do you suggest? … On Mon, 30 Mar 2020, 17:21 Julien Rottenberg, @.***> wrote: for sure, keep the nvidia build but install nodejs on top of it — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#226 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALFHJL46CNATKRNTUVKJ5VDRKDBIJANCNFSM4LQ4NDYA .
You can probably use:
ENTRYPOINT [] CMD [ "node", "app.js" ]
at the the end of your dockerfile to override the default ffmpeg entrypoint.
I guess you found a solution @numman ? It might be useful for others to share it there :)