Tutorial · Python · ~10 min

Encode HEVC for Apple Devices

Apple devices have the best HEVC decoders in the world — if the file follows their rules.

PythonAppleAPI

Why this matters

Safari, iOS and tvOS play HEVC in hardware — but only with the right profile, level, and container metadata. A slightly-off profile means software decode, stutter, or black screens.

Main10 with faststart placement gives Apple's decoders what they expect: 10-bit depth, progressive frames, and the moov atom up front.

How it works

Submit with codec=hevc, profile=main10, and faststart=true; the API applies Apple-compatible defaults and returns a ready-to-serve file.

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/video.mov", "codec": "hevc", "profile": "main10", "faststart": true}

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

  • Use main10 even for 8-bit sources — Apple devices handle it cleanly and it future-proofs HDR.
  • Check the reported level vs. device limits (Level 4.1 covers most 1080p; 5.1+ for 4K).
  • Test on a real iPhone/Safari session, not just QuickTime on a Mac.

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 makes a file 'Apple-compatible'?

HEVC Main10, progressive scan, faststart metadata placement, and standard HLS packaging.

Does it include HDR metadata?

Yes — HDR10 metadata is written when the source carries it.

Can it produce HLS for Apple platforms?

Yes — request HLS output with fMP4 segments; AirPlay and tvOS are happy with it.