Encode video for Apple devices

View Markdown

Apple devices have hardware h265 decode since iPhone 7 and Apple TV 4K. For streaming, HLS is the native protocol โ€” AVPlayer handles it without third-party libraries.

โ€œFitLoopโ€ (a fitness app like Peloton) streams workout videos to iPhones, iPads, and Apple TVs.

h265 for direct playback

For downloaded or cached videos in a native app:

API

ittybit video \
  -i https://fitloop-app.com/uploads/hiit-30.mov \
  --codec h265 \
  --format mp4 \
  --quality high
const task = {
  input: 'https://fitloop-app.com/uploads/hiit-30.mov',
  kind: 'video',
  options: {
    codec: 'h265',
    format: 'mp4',
    quality: 'high',
  },
};

const res = await fetch('https://api.ittybit.com/jobs', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.ITTYBIT_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(task),
});
const data = await res.json();
import requests

task = {
    "input": "https://fitloop-app.com/uploads/hiit-30.mov",
    "kind": "video",
    "options": {
        "codec": "h265",
        "format": "mp4",
        "quality": "high",
    },
}

res = requests.post(
    "https://api.ittybit.com/jobs",
    headers={"Authorization": f"Bearer {api_key}"},
    json=task,
)
data = res.json()
TASK='{
  "input": "https://fitloop-app.com/uploads/hiit-30.mov",
  "kind": "video",
  "options": {
    "codec": "h265",
    "format": "mp4",
    "quality": "high"
  }
}'

curl -X POST https://api.ittybit.com/jobs \
  -H "Authorization: Bearer $ITTYBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d "$TASK"

HLS for adaptive streaming

For streaming over variable connections (cellular, home wifi):

API

ittybit adaptive \
  -i https://fitloop-app.com/uploads/hiit-30.mov \
  --format hls
const task = {
  input: 'https://fitloop-app.com/uploads/hiit-30.mov',
  kind: 'adaptive_video',
  options: {
    format: 'hls',
  },
};

const res = await fetch('https://api.ittybit.com/jobs', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.ITTYBIT_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(task),
});
const data = await res.json();
import requests

task = {
    "input": "https://fitloop-app.com/uploads/hiit-30.mov",
    "kind": "adaptive_video",
    "options": {
        "format": "hls",
    },
}

res = requests.post(
    "https://api.ittybit.com/jobs",
    headers={"Authorization": f"Bearer {api_key}"},
    json=task,
)
data = res.json()
TASK='{
  "input": "https://fitloop-app.com/uploads/hiit-30.mov",
  "kind": "adaptive_video",
  "options": {
    "format": "hls"
  }
}'

curl -X POST https://api.ittybit.com/jobs \
  -H "Authorization: Bearer $ITTYBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d "$TASK"

CLI

# h265 for offline/cached playback
ittybit video \
  -i hiit-30.mov \
  -o hiit-30-h265.mp4 \
  --codec h265 \
  --quality high

# HLS for streaming
ittybit adaptive \
  -i hiit-30.mov \
  -o hiit-30.m3u8

When to use which

Delivery methodFormatBest for
Download / offlineh265 mp4Cached content, offline mode
Stream over networkHLSLive or on-demand, variable bandwidth
Bothh265 mp4 + HLSApps that support download and stream

Apple device h265 support

Deviceh265 hardware decode
iPhone 7+Yes
iPad (2017)+Yes
Apple TV 4KYes
Mac (Apple Silicon)Yes
Mac (Intel, 2017+)Yes

Resolution guidelines for Apple devices

TargetResolutionNotes
iPhone (standard)1080pFull screen on iPhone 15
iPhone (Pro Max)1290pNative for Pro Max displays
iPad1620pMatches iPad 10th gen
Apple TV 4K2160pFull 4K output

For HLS, you do not need to set resolution โ€” adaptive streaming generates multiple quality variants automatically.

Pair with web fallback

If you also serve video on the web, encode an h264 version alongside h265:

# Apple devices
ittybit video \
  -i hiit-30.mov \
  -o hiit-30-h265.mp4 \
  --codec h265 \
  --quality high

# Web browsers
ittybit video \
  -i hiit-30.mov \
  -o hiit-30-h264.mp4 \
  --codec h264 \
  --quality high

Serve h265 to native apps via AVPlayer. Serve h264 to browsers via <video> tag.