An web service for converting audio/video files using Nodejs, Express and FFMPEG
Based off of jrottenberg/ffmpeg container
POST /mp3 - Convert audio file in request body to mp3
POST /mp4 - Convert video file in request body to mp4
POST /jpg - Convert image file to jpg
GET /, /readme - Web Service Readme
Curl Ex:
curl -F "[email protected]" 127.0.0.1:3000/mp3 > output.mp3
curl -F "[email protected]" 127.0.0.1:3000/mp3 > output.mp3
curl -F "[email protected]" 127.0.0.1:3000/mp4 > output.mp4
curl -F "[email protected]" 127.0.0.1:3000/mp4 > output.mp4
curl -F "[email protected]" 127.0.0.1:3000/jpg > output.jpg
curl -F "[email protected]" 127.0.0.1:3000/jpg > output.jpg
You can change the ffmpeg conversion settings or add new endpoints by editing the /app/endpoints.js file
Requires local Node and FFMPEG installation.
-
Install FFMPEG https://ffmpeg.org/download.html
-
Install node https://nodejs.org/en/download/ Using homebrew:
$ brew install node
Navigate to project directory and:
Install dependencies:
$ npm install
Start app:
$ node app.js
Check for errors with ESLint:
$ ./node_modules/.bin/eslint .
Build Docker Image from Dockerfile with a set image tag. ex: docker-ffpmeg
$ docker build -t surebert/docker-ffpmeg .
Launch Docker Container from Docker Image, exposing port 9025 on localhost only
docker run -d
--name ffmpeg-service
--restart=always
-v /storage/tmpfs:/usr/src/app/uploads
-p 127.0.0.1:9025:3000
surebert/docker-ffpmeg
Launch Docker Container from Docker Image, exposing port 9026 on all IPs
docker run -p 9025:3000 -d surebert/docker-ffpmeg