# Resize video for social platforms

Export videos sized for different social media feeds

"Megaphone" (a social scheduling app like Buffer) needs to take one video and produce versions sized for different platforms.

## Standard sizes

| Platform                 | Dimensions | Aspect ratio |
| ------------------------ | ---------- | ------------ |
| YouTube / Web            | 1920x1080  | 16:9         |
| Instagram Feed           | 1080x1080  | 1:1          |
| Instagram Reels / TikTok | 1080x1920  | 9:16         |
| Twitter / X              | 1280x720   | 16:9         |

## API

1080p for YouTube:

<CodeGroup labels={["CLI", "TypeScript", "Python", "curl"]}>
```bash
ittybit video \
  -i https://megaphone-app.com/uploads/original.mov \
  --width 1920 \
  --height 1080 \
  --fit cover \
  --format mp4
```

```typescript
const task = {
  input: 'https://megaphone-app.com/uploads/original.mov',
  kind: 'video',
  options: {
    width: 1920,
    height: 1080,
    fit: 'cover',
    format: 'mp4',
  },
};

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();
```

```python

task = {
    "input": "https://megaphone-app.com/uploads/original.mov",
    "kind": "video",
    "options": {
        "width": 1920,
        "height": 1080,
        "fit": "cover",
        "format": "mp4",
    },
}

res = requests.post(
    "https://api.ittybit.com/jobs",
    headers={"Authorization": f"Bearer {api_key}"},
    json=task,
)
data = res.json()
```

```bash
TASK='{
  "input": "https://megaphone-app.com/uploads/original.mov",
  "kind": "video",
  "options": {
    "width": 1920,
    "height": 1080,
    "fit": "cover",
    "format": "mp4"
  }
}'

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

</CodeGroup>

Square for Instagram feed:

```json
{
  "input": "https://...",
  "kind": "video",
  "options": { "width": 1080, "height": 1080, "fit": "cover", "format": "mp4" }
}
```

Vertical for Reels/TikTok:

```json
{
  "input": "https://...",
  "kind": "video",
  "options": { "width": 1080, "height": 1920, "fit": "cover", "format": "mp4" }
}
```

## CLI

```bash
ittybit video \
  -i original.mov \
  -o youtube.mp4 \
  --width 1920 \
  --height 1080 \
  --fit cover

ittybit video \
  -i original.mov \
  -o square.mp4 \
  --width 1080 \
  --height 1080 \
  --fit cover

ittybit video \
  -i original.mov \
  -o reels.mp4 \
  --width 1080 \
  --height 1920 \
  --fit cover
```

## Fit modes

| Fit       | Behavior                              |
| --------- | ------------------------------------- |
| `contain` | Fits inside dimensions, may letterbox |
| `cover`   | Fills dimensions, may crop edges      |
| `fill`    | Stretches to exact dimensions         |

Use `cover` for social media -- it fills the frame cleanly.