Resize Video
The resize recipe scales video to a target width and height. Specify one or both dimensions — if you only set one, the other scales proportionally to preserve aspect ratio.
Basic usage
Section titled “Basic usage”Resize to 1280×720 (HD):
curl -X POST https://api.xora.sh/v1/jobs \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "mode": "recipe", "input": { "url": "https://example.com/4k-video.mp4" }, "output": { "format": "mp4" }, "recipe": { "name": "resize", "width": 1280, "height": 720 } }'const response = await fetch('https://api.xora.sh/v1/jobs', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ mode: 'recipe', input: { url: 'https://example.com/4k-video.mp4' }, output: { format: 'mp4' }, recipe: { name: 'resize', width: 1280, height: 720 } })});const data = await response.json();console.log(data);import requests
response = requests.post( "https://api.xora.sh/v1/jobs", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json" }, json={ "mode": "recipe", "input": { "url": "https://example.com/4k-video.mp4" }, "output": { "format": "mp4" }, "recipe": { "name": "resize", "width": 1280, "height": 720 } })data = response.json()print(data)Response
Section titled “Response”{ "jobId": "01JXYZ1234ABCDEF56789000", "state": "queued"}Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Must be "resize" |
width | number | No* | Target width in pixels |
height | number | No* | Target height in pixels |
*At least one of width or height is needed to resize.
Aspect ratio behavior
Section titled “Aspect ratio behavior”| Provided | Behavior |
|---|---|
Both width and height | Scales to exact dimensions |
Only width | Height auto-calculated to preserve aspect ratio |
Only height | Width auto-calculated to preserve aspect ratio |
Common presets
Section titled “Common presets”| Name | Width | Height | Aspect |
|---|---|---|---|
| 4K UHD | 3840 | 2160 | 16:9 |
| 1080p Full HD | 1920 | 1080 | 16:9 |
| 720p HD | 1280 | 720 | 16:9 |
| 480p SD | 854 | 480 | 16:9 |
| Instagram Square | 1080 | 1080 | 1:1 |
| Instagram Story | 1080 | 1920 | 9:16 |
Examples
Section titled “Examples”Scale to width, auto height
Section titled “Scale to width, auto height”Only set width to scale proportionally:
{ "mode": "recipe", "input": { "url": "https://example.com/4k-video.mp4" }, "output": { "format": "mp4" }, "recipe": { "name": "resize", "width": 1280 }}A 3840×2160 input becomes 1280×720 (maintains 16:9).
Scale for Instagram Story (9:16 vertical)
Section titled “Scale for Instagram Story (9:16 vertical)”{ "mode": "recipe", "input": { "url": "https://example.com/landscape.mp4" }, "output": { "format": "mp4" }, "recipe": { "name": "resize", "width": 1080, "height": 1920 }}Output as WebM
Section titled “Output as WebM”{ "mode": "recipe", "input": { "url": "https://example.com/video.mp4" }, "output": { "format": "webm" }, "recipe": { "name": "resize", "width": 854, "height": 480 }}Supported output formats
Section titled “Supported output formats”| Format | Description |
|---|---|
mp4 | H.264 in MP4 container |
webm | VP8/VP9 in WebM container |
mov | H.264 in QuickTime container |