Simple web API for extracting images/audio from video and converting audio/video/image files with ffmpeg.
src | ||
.gitignore | ||
Dockerfile | ||
README.adoc |
= FFMPEG API A web service for converting audio/video/image files using FFMPEG. Based on: * https://github.com/surebert/docker-ffmpeg-service * https://github.com/jrottenberg/ffmpeg * https://github.com/fluent-ffmpeg/node-fluent-ffmpeg FFMPEG API is provided as Docker image for easy consumption. == Endpoints * `POST /convert/audio/to/mp3` - Convert audio file in request body to mp3 * `POST /convert/video/to/mp4` - Convert video file in request body to mp4 * `POST /convert/image/to/jpg` - Convert image file to jpg * `GET /` - API Readme == Usage === Convert Convert audio/video/image files using the API. * `curl -F "file=@input.wav" 127.0.0.1:3000/convert/audio/to/mp3 > output.mp3` * `curl -F "file=@input.m4a" 127.0.0.1:3000/convert/audio/to/mp3 > output.mp3` * `curl -F "file=@input.mov" 127.0.0.1:3000/convert/video/to/mp4 > output.mp4` * `curl -F "file=@input.mp4" 127.0.0.1:3000/convert/videp/to/mp4 > output.mp4` * `curl -F "file=@input.tiff" 127.0.0.1:3000/convert/image/to/jpg > output.jpg` * `curl -F "file=@input.png" 127.0.0.1:3000/convert/image/to/jpg > output.jpg` == Docker image === Build your own * Clone this repository. * Build Docker image: ** `docker build -t ffmpeg-api .` * Run image in foreground: ** `docker run -it --rm -p 3000:3000 ffmpeg-api` * Run image in background: ** `docker run -d -name ffmpeg-api -p 3000:3000 ffmpeg-api` === Use existing * Run image in foreground: ** `docker run -it --rm -p 3000:3000 kazhar/ffmpeg-api` * Run image in background: ** `docker run -d --name ffmpeg-api -p 3000:3000 kazhar/ffmpeg-api` === Environment variables Default log level is INFO. Set log level using environment variable, _LOG_LEVEL_. - Set log level to debug: - `docker run -it --rm -p 3000:3000 -e LOG_LEVEL=debug kazhar/ffmpeg-api` Default maximum file size of uploaded files is 512MB. Use environment variable _FILE_SIZE_LIMIT_BYTES_ to change it: - Set max file size to 1MB: - `docker run -it --rm -p 3000:3000 -e FILE_SIZE_LIMIT_BYTES=1048576 kazhar/ffmpeg-api` == Background Originally developed by https://github.com/surebert[Paul Visco]. Changes include updated Node.js version, Docker image based on Alpine, logging and others.