DEV Community

Cover image for I Got Tired of Writing FFmpeg Commands, So I Built a Small Go Helper
Farshid Rezaei
Farshid Rezaei

Posted on

I Got Tired of Writing FFmpeg Commands, So I Built a Small Go Helper

If you’ve worked with FFmpeg beyond one-liners, you know how quickly things get messy.

What starts as a reasonable command slowly turns into a fragile, unreadable blob — especially once adaptive bitrate outputs, multiple renditions, and different profiles enter the picture.

While building a video pipeline in Go, I hit this wall hard. So instead of copy-pasting yet another FFmpeg command, I wrote a small helper library to bring some structure back.

The Idea

The goal wasn’t to hide FFmpeg or replace it.

I wanted:

  • explicit, readable command generation
  • a way to define encoding ladders without magic
  • something testable and maintainable in a Go codebase

The result is a small, opinionated helper that still outputs plain FFmpeg commands — just assembled in a more predictable way.

What It Helps With

Right now, the focus is on ABR workflows:

  • HLS and DASH outputs using CMAF
  • basic ladder generation based on input resolution
  • bitrate caps and trimming redundant renditions
  • different presets for VOD vs live use cases

It’s intentionally narrow, but already useful in real projects.

What It’s Not

  • Not a wrapper that hides FFmpeg
  • Not a “perfect ladder” generator
  • Not a one-size-fits-all solution

If shell scripts work for you, that’s totally fine. This just fits better with how I like to structure Go services.

Source

The project is open source and here if you want to take a look:
https://github.com/farshidrezaei/mosaic

I’d love feedback — especially from people who’ve wrestled with FFmpeg pipelines or ABR setups before.

Top comments (0)