Tutorial · Python · ~10 min

Transcode a Short Drama Library

Forty episodes, one command: batch transcoding to H.264 with consistent quality across the catalog.

PythonShort DramaAPI

Why this matters

Short-drama platforms ingest thousands of episodes; consistency matters more than any single file. CRF-based encoding keeps visual quality uniform while sizes float naturally.

A batch queue with per-file status turns a weekend of manual encodes into an overnight run.

How it works

Point the API at the episode folder with codec=h264 and a CRF target; each episode returns size, average bitrate, and VMAF-style quality metrics.

Submit a job with an input URL (S3, GCS or HTTPS), poll the job URL, and download the rendered output. No GPU, no queues, no ffmpeg builds to babysit.

Code

Python
import requests, time

API = "https://api.mlslabs.io/v1/encode/jobs"
headers = {"X-API-Key": "YOUR_API_KEY"}
payload = {"input": "s3://bucket/episodes/", "codec": "h264", "crf": 23, "pattern": "*.mp4"}

resp = requests.post(API, json=payload, headers=headers)
job = resp.json()
while job["status"] not in ("succeeded", "failed"):
    time.sleep(3)
    job = requests.get(job["url"], headers=headers).json()

print("Output:", job["output_url"])

Pro tips

  • Smoke-test 3 episodes from different shows first — dark and fast scenes stress encoders differently.
  • CRF 23 is a solid H.264 default; go 21 for drama, 26 for talking-head content.
  • Archive the per-file metrics; they make capacity planning trivial.

Pricing note

Usage is metered per minute of media processed; the first tier is free each month. Volume discounts kick in automatically.

FAQ

Common questions

What quality metric is reported?

Each job reports VMAF estimate plus size and bitrate, so you can compare encodes objectively.

Can I target a maximum size instead?

Yes — use a target-bitrate mode instead of CRF.

Is the output compatible with all players?

H.264 + AAC in MP4 is the safest universal delivery format.