editly
editly copied to clipboard
dockerizing the editly
when I try to dockerize my app it builds successfully but in run it shows like this
ffmpeg version 4.1.8 ffprobe version 4.1.8 Extracting audio/silence from all clips Mixing clip audio with arbitrary audio Error: Command failed with exit code 1: ffmpeg -hide_banner -loglevel error -stream_loop 0 -i editly-tmp-apYwwWg60h1mgCyMJPphT/audio-concat.flac -stream_loop 0 -i ./music/sample.mp3 -filter_complex [0]atrim=start=0,adelay=delays=0:all=1[a0];[1]atrim=start=0,adelay=delays=0:all=1,apad[a1];[a0][a1]amix=inputs=2:duration=first:dropout_transition=0:weights=1 1 -c:a flac -y editly-tmp-apYwwWg60h1mgCyMJPphT/audio-mixed.flac [Parsed_adelay_1 @ 0x5576d66a7bc0] Option 'all' not found [AVFilterGraph @ 0x5576d667e140] Error initializing filter 'adelay' with args 'delays=0:all=1' Error initializing complex filters. Option not found at makeError (/home/node/app/node_modules/execa/lib/error.js:59:11) at handlePromise (/home/node/app/node_modules/execa/index.js:114:26) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async mixArbitraryAudio (/home/node/app/node_modules/editly/audio.js:196:5) at async editAudio (/home/node/app/node_modules/editly/audio.js:232:23) at async Editly (/home/node/app/node_modules/editly/index.js:73:34) at async todo (/home/node/app/server.js:38:4) { shortMessage: 'Command failed with exit code 1: ffmpeg -hide_banner -loglevel error -stream_loop 0 -i editly-tmp-apYwwWg60h1mgCyMJPphT/audio-concat.flac -stream_loop 0 -i ./music/sample.mp3 -filter_complex [0]atrim=start=0,adelay=delays=0:all=1[a0];[1]atrim=start=0,adelay=delays=0:all=1,apad[a1];[a0][a1]amix=inputs=2:duration=first:dropout_transition=0:weights=1 1 -c:a flac -y editly-tmp-apYwwWg60h1mgCyMJPphT/audio-mixed.flac', command: 'ffmpeg -hide_banner -loglevel error -stream_loop 0 -i editly-tmp-apYwwWg60h1mgCyMJPphT/audio-concat.flac -stream_loop 0 -i ./music/sample.mp3 -filter_complex [0]atrim=start=0,adelay=delays=0:all=1[a0];[1]atrim=start=0,adelay=delays=0:all=1,apad[a1];[a0][a1]amix=inputs=2:duration=first:dropout_transition=0:weights=1 1 -c:a flac -y editly-tmp-apYwwWg60h1mgCyMJPphT/audio-mixed.flac', exitCode: 1, signal: undefined, signalDescription: undefined, stdout: '', stderr: "[Parsed_adelay_1 @ 0x5576d66a7bc0] Option 'all' not found\n" + "[AVFilterGraph @ 0x5576d667e140] Error initializing filter 'adelay' with args 'delays=0:all=1'\n" + 'Error initializing complex filters.\n' + 'Option not found', failed: true, timedOut: false, isCanceled: false, killed: false }
this is my Dockerfile
RUN apt-get -y update RUN apt-get install -y ffmpeg RUN apt-get -y full-upgrade COPY . ./
RUN npm install
EXPOSE 3000
USER 1000
CMD ["node","server.js"]
During docker build it pulls only 4.1 version only
in my local it works fine (local ffmpeg version- ffmpeg version 4.4.1-essentials_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers ..On windows 10)
Is there any way can I upgrade to ffmpeg 4.4 in docker image to run editly? Help [Pardon my mistakes, English isn't my first language]
- [x] I have tried with the newest version of editly:
npm i -g editly
ornpm i editly@latest
- [x] I have tried ffmpeg newest stable version
- [x] I have searched for existing issues
please finish the checklist and you will find your answer
feel free to submit a pr with ffmpeg v4.4.1 upgrade for the Dockerfile
After some google search , added this FROM jrottenberg/ffmpeg:4.4-scratch AS ffmpeg to DockerFile to pull updated FFMPEG and the build also done successfully.
and now "gl returned null, this probably means that some dependencies are not installed. See README." is showing'. But I couldn't find a solution for this #154
ffmpeg version 4.4.1 ffprobe version 4.4.1 Extracting audio/silence from all clips Mixing clip audio with arbitrary audio 854x480 30fps Error: gl returned null, this probably means that some dependencies are not installed. See README. at module.exports (/home/node/app/node_modules/editly/glTransitions.js:12:11) at Editly (/home/node/app/node_modules/editly/index.js:172:60) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async todo (/home/node/app/server.js:38:4)
Could you help on this @mifi
Thanks.
please see other issues
#33
this solution should solve the FFMPEG version issue and transition dependencies issue.
##Pulling ffmpeg
FROM jrottenberg/ffmpeg:4.4-scratch AS ffmpeg
##Base Image
FROM node:17-stretch
COPY --from=ffmpeg / /
##Adding transitions tools
RUN apt-get update && apt-get install -y
libcairo2-dev
libpango1.0-dev
libjpeg-dev
libgif-dev
librsvg2-dev
libxi-dev
libglu1-mesa-dev
libglew-dev
python2.7
python-pip
xvfb
##Create app directory
RUN mkdir -p /usr/src/app WORKDIR /usr/src/app
##Install app dependencies
COPY package.json /usr/src/app/ RUN npm install
##Init system
ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 /usr/bin/dumb-init RUN chmod 0777 /usr/bin/dumb-init
##Bundle app source
COPY . /usr/src/app
EXPOSE 3000
ENTRYPOINT ["/usr/bin/dumb-init", "--", "xvfb-run", "-s", "-ac -screen 0 1280x1024x24"]
CMD [ "node", "server.js" ]
@mifi if this approach works add this as Dockerfile for running editly in Docker.
Sure, if someone wants to submit a PR to the dockerfile im happy to accept
This is how I got the node.js code to work. So you need th xcfb pre-lounch the screen and then run the editly and then stop the xvfb.
`const Xvfb = require('xvfb');
var xvfb = new Xvfb({ silent: true, xvfb_args: ["-screen", "0", '1280x720x24', "-ac"], });
xvfb.start((err)=>{if (err) console.error(err)})
await editly(editSpec).catch(console.error);
xvfb.stop();`
For anyone who wants to use editly in their nodejs application, and was running into issues while deploying on a server like AWS Lightsail using docker, here is my docker file which fixed it. Took a lot of research.
Basically we get version 5 of ffmpeg and put it into /usr/bin. This is important as the actual instructions on mwader say /usr/local/bin.
# Use the static-ffmpeg image to get ffmpeg and ffprobe binaries
FROM mwader/static-ffmpeg:5.1.2 AS ffmpeg
# Build the main application using the node image
FROM --platform=linux/amd64 node:16 AS build
WORKDIR /usr/src/app
COPY package*.json ./
# Copy ffmpeg and ffprobe binaries from the ffmpeg image
COPY --from=ffmpeg /ffmpeg /usr/bin/
COPY --from=ffmpeg /ffprobe /usr/bin/
RUN apt-get update && \
apt-get install -y pkg-config libpng-dev libjpeg-dev librsvg2-dev \
build-essential \
xserver-xorg-dev libxi-dev libxext-dev libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev \
libcairo2-dev \
libpango1.0-dev \
libjpeg-dev \
libgif-dev \
librsvg2-dev \
libxi-dev \
libglu1-mesa-dev \
libglew-dev \
python2.7 \
python-pip \
xvfb
RUN npm install -g canvas
RUN npm install -g gl
RUN npm install -g [email protected]
RUN npm ci
# Bundle app source
COPY . .
EXPOSE 4000
# Run the app in a virtual frame buffer
# This allows our video generation to run without a display
# Prevents all issues regarding deploying on server w/ docker
CMD ["xvfb-run", "-a", "--server-num=1", "-s", "-ac -screen 0 1080x1920x24", "node", "server.js"]
For all the people struggling (like i did) to install editly. I found a way using docker. Below is my environment
- WSL2
- Ubuntu 22.04
- Windows 10
- Docker Desktop
Rather than building the docker image, there is one already created on dockerhub. Follow the instructions to use. https://hub.docker.com/r/vimagick/editly
Note: The version of different packages may not be latest. I haven't checked what's inside the image