A lightweight Docker container for running FFmpeg commands.
This container provides a ready-to-use FFmpeg environment for video and audio processing. It's built on Alpine Linux to maintain a small footprint while including common FFmpeg codecs and tools.
Pull and run the container:
docker pull onerahmet/ffmpeg
docker run --rm -v "$(pwd):/workspace" onerahmet/ffmpeg -i input.mp4 output.mp4
The -v "$(pwd):/workspace"
flag mounts your current directory to /workspace
inside the container, allowing FFmpeg to access your local files.
- Convert video format:
docker run --rm -v "$(pwd):/workspace" onerahmet/ffmpeg -i input.mp4 output.mkv
- Extract audio from video:
docker run --rm -v "$(pwd):/workspace" onerahmet/ffmpeg -i input.mp4 -vn -acodec libmp3lame output.mp3
- Compress video:
docker run --rm -v "$(pwd):/workspace" onerahmet/ffmpeg -i input.mp4 -c:v libx264 -crf 23 -preset medium -c:a aac output.mp4
- Create video thumbnail:
docker run --rm -v "$(pwd):/workspace" onerahmet/ffmpeg -i input.mp4 -ss 00:00:01 -vframes 1 -q:v 2 thumbnail.jpg
The container requires specifying an FFmpeg version during build:
docker build --build-arg FFMPEG_VERSION=n7.1 -t onerahmet/ffmpeg:7.1 .
Available versions can be found in FFmpeg's release tags. For example:
- n7.1
- n6.0
Note: The FFMPEG_VERSION
build argument is required. The build will fail if not provided.
- Based on Alpine Linux for minimal image size (~120MB)
- Includes common FFmpeg codecs and tools
- Simple volume mounting for file access
- Supports all standard FFmpeg commands and options
- All commands are run from the
/workspace
directory inside the container - Input and output files must be accessible in the mounted volume
- Use absolute paths or paths relative to the mounted directory
This project is licensed under the MIT License - see the LICENSE file for details.
This container packages FFmpeg, a complete, cross-platform solution to record, convert and stream audio and video. FFmpeg is licensed under the LGPL v2.1+ License.
FFmpeg is a trademark of Fabrice Bellard, originator of the FFmpeg project.