Lesson 7 of 9

From CLI to API

Transition from command-line FFmpeg to API-driven video processing. Integrate FFmpeg into your applications.

Skip the install. Run this lesson's commands via the FFmpeg Micro API in 30 seconds.

Get free API key

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/transcodes \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "inputs": [{"url": "https://storage.example.com/input.mp4"}], "outputFormat": "mp4", "options": [ {"option": "-vf", "argument": "scale=1280:-2"}, {"option": "-c:v", "argument": "libx264"}, {"option": "-crf", "argument": "23"} ] }'

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, with 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/transcodes \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "inputs": [{"url": "https://storage.example.com/input.mp4"}], "outputFormat": "mp4", "options": [ {"option": "-c:v", "argument": "libx264"}, {"option": "-crf", "argument": "23"}, {"option": "-movflags", "argument": "+faststart"}, {"option": "-c:a", "argument": "aac"} ] }'

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

Step 3: Check status and download

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

When the status is completed, use GET /v1/transcodes/JOB_ID/download to get a signed 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, with the same flags and 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

Run this transcode via API. No install

Once your file is uploaded, one call kicks off the job. No local FFmpeg, no servers to run.

curl -X POST https://api.ffmpeg-micro.com/v1/transcodes \
  -H "Authorization: Bearer $FFMPEG_MICRO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"inputs":[{"url":"gs://your-bucket/input.mp4"}],"outputFormat":"mp4"}'

See the full flow in the quickstart.