Skip to content

Colin Webb

FFmpeg via Docker

I have previously written about using FFmpeg to convert H264 into MP4, running in a Docker container.

Running desktop applications in Docker negates the need to install anything, and isolates processes more effectively than something like Brew would. I needed to use FFmpeg again this week, and so spent a little bit of time setting it up properly - using Docker. Jessie Frazelle wrote a post in 2015 named Containers on the Desktop that was the inspiration for doing this.

I hadn't realised until writing this post that I'd waited five years to try out something similar to the Containers on the Desktop post, but better late than never! Perhaps I'll get around to learning Nix someday too.

Here's the function is added to my shell to use ffmpeg. Usage from the terminal is simply as described by FFmpeg tutorials.

ffmpeg() {
  # https://hub.docker.com/r/jrottenberg/ffmpeg/
  docker run -it --rm \
    -v $(pwd):$(pwd) -w $(pwd) \
    --name ffmpeg \
    jrottenberg/ffmpeg:snapshot-alpine \
    $@
}