Lesson 6 of 7

From CLI to API

Transition from running FFmpeg on the command line to processing video through an API. Learn why hosted FFmpeg simplifies scaling.

The Problem with Running FFmpeg Yourself

Everything you have learned so far works beautifully on your local machine. You run a command, FFmpeg processes the file, you get the output. But when you need to process video as part of a product or automated workflow, running FFmpeg locally creates real problems:

  • CPU and memory pressure. Video encoding is one of the most CPU-intensive operations you can run. A single 4K transcode can max out all cores for minutes. Running this on your web server means your application slows to a crawl.
  • Installation and dependencies. FFmpeg needs to be installed with the right codecs compiled in. Managing this across environments (local, staging, production, CI) is a maintenance burden.
  • Scaling. Processing one video at a time is fine. Processing 100 videos uploaded by users simultaneously requires infrastructure — worker queues, auto-scaling, storage management, error handling.
  • Storage and bandwidth. Files need to be uploaded to where FFmpeg runs, processed, and the result stored or returned. Managing temp files, cleanup, and storage costs adds up.

What an FFmpeg API Does

An FFmpeg API is a hosted service that runs FFmpeg commands for you in the cloud. Instead of installing FFmpeg, managing servers, and building job queues, you send an HTTP request with your FFmpeg command and input file, and the API returns the processed output.

The concept is simple: every FFmpeg command you have learned in this course works the same way through an API. The difference is where it runs.

CLI vs. API — Same Command, Different Infrastructure

Running locally (CLI)

ffmpeg -i input.mp4 -vf "scale=1280:-2" -c:v libx264 -crf 23 output.mp4

Running via FFmpeg Micro API

curl -X POST https://api.ffmpeg-micro.com/v1/jobs \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "input": "https://storage.example.com/input.mp4", "command": "-vf scale=1280:-2 -c:v libx264 -crf 23", "output_format": "mp4" }'

The FFmpeg command string is the same — you already know how to write it. The API handles infrastructure: pulling the input, running FFmpeg on dedicated hardware, and storing the result.

Why Use FFmpeg Micro

No servers to manage

You do not need to install FFmpeg, manage dependencies, or provision compute. Send a request, get a result.

Parallel processing

Process hundreds of videos simultaneously. Each job runs on its own isolated instance — no resource contention.

Pay per use

Billing is based on compute minutes, not idle servers. Process one video or a thousand — you only pay for what you use.

Full FFmpeg command support

Every command you have learned in this course works through the API. Crop, scale, transcode, watermark, concatenate — all of it.

Your First API Job

Here is how to process a video using the FFmpeg Micro API. This example takes a video URL, transcodes it to H.264, and returns the output.

Step 1: Get your API key

Sign up at ffmpeg-micro.com and copy your API key from the dashboard. Your free tier includes 100 compute minutes.

Step 2: Submit a job

curl -X POST https://api.ffmpeg-micro.com/v1/jobs \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "input": "https://storage.example.com/input.mp4", "command": "-c:v libx264 -crf 23 -movflags +faststart -c:a aac", "output_format": "mp4" }'

The API returns a job ID immediately. The video processes asynchronously.

Step 3: Check status and download

curl https://api.ffmpeg-micro.com/v1/jobs/JOB_ID \ -H "Authorization: Bearer YOUR_API_KEY"

When the status is completed, the response includes a download URL for the output file.

Common API Patterns

Transcode for web

"command": "-c:v libx264 -crf 23 -preset fast -movflags +faststart -c:a aac"

Resize for social media

"command": "-vf crop=ih*9/16:ih,scale=1080:1920 -c:v libx264 -crf 23 -c:a aac"

Extract audio

"command": "-vn -c:a libmp3lame -b:a 192k", "output_format": "mp3"

Add watermark

"command": "-vf drawtext=text='yoursite.com':fontsize=24:fontcolor=white:box=1:boxcolor=black@0.5:boxborderw=10:x=w-text_w-20:y=h-text_h-20"

When to Use CLI vs. API

ScenarioUse CLIUse API
Quick one-off editYesOverkill
Batch processing 50+ videosSlow, ties up your machineYes — parallel processing
User-uploaded video in a web appRisky on a web serverYes — offload compute
Automated content pipelineRequires your own infraYes — trigger via HTTP
Learning / experimentingYes — instant feedbackGood for testing at scale

Key Takeaways

  • Every FFmpeg command you know works the same through an API — same flags, same filters
  • APIs eliminate infrastructure concerns: no installs, no scaling headaches, no temp file management
  • Use CLI for quick local edits, API for production workloads and automation
  • FFmpeg Micro processes jobs asynchronously — submit, poll, download
  • Free tier includes 100 compute minutes to get started

Try This With FFmpeg Micro

Instead of running FFmpeg locally, you can use FFmpeg Micro's API to process videos in the cloud. No installation required.