# Abort a Multipart Upload Source: https://rendi.dev/docs/api-reference/endpoint/abort-upload POST /v1/files/{file_id}/abort-upload Cancel a direct upload started via `POST /v1/files/init-upload`. Discards any parts already uploaded to storage and marks the file as failed. See the [direct upload guide](https://docs.rendi.dev/direct-upload) for the full flow. > [!NOTE] > > Cancels an in-progress upload started via [`init-upload`](/docs/api-reference/endpoint/init-upload). Any parts already uploaded are discarded. See the [direct upload guide](/docs/direct-upload) for the full flow. > > Abandoned uploads that are never completed or aborted are cleaned up automatically after 7 days. # Complete a Multipart Upload Source: https://rendi.dev/docs/api-reference/endpoint/complete-upload POST /v1/files/{file_id}/complete-upload Finalize a direct upload started via `POST /v1/files/init-upload`. The file then goes through FFprobe for media metadata; `status` changes as `UPLOADED` and becomes `STORED` when analysis completes. See the [direct upload guide](https://docs.rendi.dev/direct-upload) for the full flow. > [!NOTE] > > Step 3 of 3 in the direct-upload flow. See the [direct upload guide](/docs/direct-upload) for the full flow. > > After this call succeeds, Rendi analyzes the file with FFprobe to extract media metadata. The response returns `status: UPLOADED` immediately; poll [`GET /v1/files/{file_id}`](/docs/api-reference/endpoint/get-file) — `status` becomes `STORED` when analysis completes and metadata (duration, dimensions, codec, mime type, bitrate, etc.) is populated. # Delete Command Files Source: https://rendi.dev/docs/api-reference/endpoint/delete-command-files DELETE /v1/commands/{command_id}/files Delete all stored output files associated with a command # Delete File Source: https://rendi.dev/docs/api-reference/endpoint/delete-file DELETE /v1/files/{file_id} Delete a stored file in Rendi # Delete Files in Bulk Source: https://rendi.dev/docs/api-reference/endpoint/delete-files POST /v1/files/bulk-delete Delete multiple stored files in a single request # Get File Source: https://rendi.dev/docs/api-reference/endpoint/get-file GET /v1/files/{file_id} Get a stored file and its FFprobe metadata by its ID. Can return a command output file or a stored file. File can be deleted, in which case will still return its properties, but storage_url will be null. Will not return input files. # Initiate a Multipart Upload Source: https://rendi.dev/docs/api-reference/endpoint/init-upload POST /v1/files/init-upload Start uploading a local file directly to Rendi's storage. Returns a per-part list of presigned PUT URLs that you upload chunks to. See the [direct upload guide](https://docs.rendi.dev/direct-upload) for the full flow and code samples. > [!NOTE] > > Step 1 of 3 in the direct-upload flow. See the [direct upload guide](/docs/direct-upload) for the full flow and code samples. > > Bytes go directly to Rendi's storage. Files up to 5 TB are supported. # List FFmpeg Commands Source: https://rendi.dev/docs/api-reference/endpoint/list-commands GET /v1/commands Get the statuses of a previously submitted FFmpeg commands, ordered by creation time - descending. # List Stored Files Source: https://rendi.dev/docs/api-reference/endpoint/list-files GET /v1/files Get the list of all stored files for an account, ordered by creation time - descending. Can return command output files or stored files. Will not return deleted files or input files. # Poll FFmpeg Command Source: https://rendi.dev/docs/api-reference/endpoint/poll-command GET /v1/commands/{command_id} Get the status of a previously submitted FFmpeg command. Works for regular commands and chained commands. # Run Chained FFmpeg Commands Source: https://rendi.dev/docs/api-reference/endpoint/run-chained-ffmpeg-commands POST /v1/run-chained-ffmpeg-commands Submit multiple FFmpeg commands where following commands can depend on output of previous commands. Running chained FFmpeg commands is faster than running each command separately because we re-use system and network resources between the multiple ffmpeg commands. Processing quota is shared between the commands, and is more efficient than running each command separately. > [!NOTE] > > Prefer chained commands over multiple separate `run-ffmpeg-command` calls for multi-step pipelines — one round-trip, lower latency, and outputs from earlier commands can feed later ones. # Run FFmpeg Command Source: https://rendi.dev/docs/api-reference/endpoint/run-ffmpeg-command POST /v1/run-ffmpeg-command Submit an FFmpeg command for processing with input and output file specifications. > [!NOTE] > > **Key naming rules**: input keys in `input_files` must start with `in_` (e.g. `in_1`, `in_video`); output keys in `output_files` must start with `out_` (e.g. `out_1`, `out_gif`). Reference them as `{{in_1}}` / `{{out_1}}` placeholders inside `ffmpeg_command`. > > **Runtime cap**: `max_command_run_seconds` defaults to 300s (5 minutes). It's a safety cap that aborts runaway FFmpeg jobs — set it explicitly on longer jobs to match the expected runtime. Maximum depends on your plan. > > **Input URLs**: any publicly accessible HTTP/HTTPS URL works — Google Drive share links, Dropbox, public/signed S3/GCS, CDNs. # FFprobe and store a file Source: https://rendi.dev/docs/api-reference/endpoint/store-file POST /v1/files/store-file Submit a file to be analyzed with FFprobe and stored in Rendi's storage. You can use this endpoint both to get metadata about a file and to store it. If you delete the file, you will still have access to its metadata. Get the file's storage url and metadata using the GET /files/{file_id} endpoint. If you require other data extracted from FFprobe - message us at support@rendi.dev. > [!NOTE] > > Async job: returns `file_id` immediately; poll [`get-file`](/docs/api-reference/endpoint/get-file) until `status` is `STORED`. > > Rendi already stores your FFmpeg output files (see `storage_url` in the response from `run-ffmpeg-command`). Use this endpoint to persist intermediate assets or pre-probe input files for FFprobe metadata. # API Reference Source: https://rendi.dev/docs/api-reference/introduction Rendi FFmpeg API reference — authentication, endpoints, request/response formats. # Command Structure > [!NOTE] > > Authenticate every request with the `X-API-KEY` header. Keep your API key server-side — never ship it in browser code or commit it to a public repo. We use a simple JSON format to send commands. > [!NOTE] > > You don't need to write the *ffmpeg* word in your commands, because we handle this internally ## vCPUs You control how many vCPUs each command uses, up to your account's maximum. Multiple commands can run in parallel as long as their total vCPU usage doesn't exceed your quota. ## File naming When sending commands you will notice that you will need to use `{{alias}}` for file placeholders for input and output files. Input files will need to be sent in the `input_files` dictionary, with each key starting with `in_` prefix, and the value should be an online accessible storage endpoint for Rendi to pull files from. The `in_` prefix is mandatory for Rendi to consider this as a valid input fille. Output files will similarly be in `output_files` dictionary, with each key starting with `out_` prefix, and the value is the required output file name, without any folder or path structure. Output files will be places in a Rendi hosted storage and their name will be as you specified. The `out_` prefix is mandatory for Rendi to consider this as a valid input fille. Only alpha-numeric characters and underscores are allowed for output file names, for the file extension a period character is also allowed (e.g. `output_1.mp4`). > [!NOTE] > > If you're using an automation platform where curly brackets are used as characters (like make, zapier, or other) add backslashes before the curly brackets, for example, replace `{{in_1}}` with backslashes and brackets `\{\{in_1\}\}`. ## Reasons for aliasing files instead of providing them directly within the command * The command itself and its files are separate entities. For example - you can use the same input files for several commands, or reuse the same command with different inputs and outputs. * We validate file names and their locations. * In the future we will allow you to integrate Rendi with your own private storage repositories, and Rendi will need to pull and put files using specific integrations. # Output file storage Output files are stored indefinitely until you choose to delete them using our deletion endpoints. # Authentication All API endpoints are authenticated using an API Key which you get when you activate your account. The API Key needs to be provided as the value of HTTP Header `X-API-KEY` as ```http theme={null} --header 'X-API-KEY: ' ``` # Coding agents Source: https://rendi.dev/docs/coding-agents Wire Rendi's docs MCP server into Claude Code, Cursor, VS Code Copilot, Codex, Grok, or Gemini CLI so your coding agent can search and read Rendi docs natively while writing code. Once connected, ask your agent things like *"add thumbnail extraction to my Express app using Rendi"* and it will pull the right docs and produce working calls. ## Install The docs MCP server lives at [https://www.rendi.dev/docs/mcp](https://www.rendi.dev/docs/mcp). Pick your agent below. > [tab] Cursor > > Add to `~/.cursor/mcp.json` (or project-local `.cursor/mcp.json`): > > ```json theme={null} > { > "mcpServers": { > "rendi": { > "url": "https://www.rendi.dev/docs/mcp" > } > } > } > ``` > > Or click this button: [![Install MCP Server in Cursor](https://mintcdn.com/rendi/vQ30vQFM3FFwjFAy/images/cursor-mcp-install-light.svg?fit=max\&auto=format\&n=vQ30vQFM3FFwjFAy\&q=85\&s=1fb5173ec81a787708289b0e7f4243d2)](https://cursor.com/en-US/install-mcp?name=rendi\&config=eyJ1cmwiOiJodHRwczovL3d3dy5yZW5kaS5kZXYvZG9jcy9tY3AifQ%3D%3D) > [tab] Claude Code > > ```bash theme={null} > claude mcp add --transport http rendi https://www.rendi.dev/docs/mcp > ``` > [tab] VS Code > > ```bash theme={null} > code --add-mcp '{"name":"rendi","type":"http","url":"https://www.rendi.dev/docs/mcp"}' > ``` > > Or add to `.vscode/mcp.json`: > > ```json theme={null} > { > "servers": { > "rendi": { > "type": "http", > "url": "https://www.rendi.dev/docs/mcp" > } > } > } > ``` > [tab] Codex > > Add to `~/.codex/config.toml`: > > ```toml theme={null} > [mcp_servers.rendi] > url = "https://www.rendi.dev/docs/mcp" > ``` > [tab] Grok > > ```bash theme={null} > grok mcp add --transport http rendi https://www.rendi.dev/docs/mcp > ``` > > Or add to `~/.grok/config.toml`: > > ```toml theme={null} > [mcp_servers.rendi] > url = "https://www.rendi.dev/docs/mcp" > ``` > [tab] Gemini CLI > > ```bash theme={null} > gemini mcp add rendi --transport http https://www.rendi.dev/docs/mcp > ``` ## Claude Code: FFmpeg plugin The `ffmpeg-llm` plugin adds an FFmpeg skill, a `/ffmpeg` slash command, and an `ffmpeg-expert` subagent — making Claude Code more reliable when generating the FFmpeg commands. ``` /plugin marketplace add rendi-api/ffmpeg-llm /plugin install ffmpeg-llm@rendi-official ``` The plugin and the MCP server are complementary: the MCP server teaches your agent how to call Rendi; the plugin teaches it how to write better FFmpeg commands. See [rendi-api/ffmpeg-llm](https://github.com/rendi-api/ffmpeg-llm) for details. ## `AGENTS.md` snippet Drop this into your own project's `AGENTS.md` or `CLAUDE.md` so future agent sessions know to reach for Rendi: ```md theme={null} This project uses Rendi for running FFmpeg commands. Rendi evolves, always check the latest documentation at www.rendi.dev/docs. For FFmpeg command patterns: https://raw.githubusercontent.com/rendi-api/ffmpeg-cheatsheet/refs/heads/main/README.md — and for an FFmpeg authoring skill: https://raw.githubusercontent.com/rendi-api/ffmpeg-cheatsheet/refs/heads/main/skills/ffmpeg/SKILL.md ``` ## Other ways to access Rendi docs Rendi docs are also available as structured or raw content, for any agent to fetch directly: * OpenAPI spec — **canonical request and response schema for every endpoint** — [https://www.rendi.dev/docs/api-reference/openapi.json](https://www.rendi.dev/docs/api-reference/openapi.json) * `llms.txt` (page index) — [https://www.rendi.dev/docs/llms.txt](https://www.rendi.dev/docs/llms.txt) * `llms-full.txt` (full docs concatenated) — [https://www.rendi.dev/docs/llms-full.txt](https://www.rendi.dev/docs/llms-full.txt) * `skill.md` (condensed summary of how Rendi works, auto-generated) — [https://www.rendi.dev/docs/skill.md](https://www.rendi.dev/docs/skill.md) * Portable FFmpeg skill — drop-in `SKILL.md` for any skill-aware agent — [https://raw.githubusercontent.com/rendi-api/ffmpeg-cheatsheet/refs/heads/main/skills/ffmpeg/SKILL.md](https://raw.githubusercontent.com/rendi-api/ffmpeg-cheatsheet/refs/heads/main/skills/ffmpeg/SKILL.md) * Raw markdown of any page — append `.md` to any docs URL (e.g., [/docs/coding-agents.md](/docs/coding-agents.md)) ## Best practices for agents using Rendi Follow these rules so your agent generates working Rendi calls on the first try. 1. **Use `in_*` / `out_*` key names** — keys in [`input_files`](/docs/api-reference/endpoint/run-ffmpeg-command) (e.g. `in_1`, `in_video`) and `output_files` (e.g. `out_1`, `out_gif`) must use these prefixes. The same keys are referenced as `{{in_1}}` / `{{out_1}}` placeholders inside `ffmpeg_command`. 2. **Pass any publicly accessible HTTP/HTTPS URL as an input** — Google Drive share links, Dropbox, public or signed S3/GCS, and CDN URLs all work as-is. If it loads in an incognito browser, Rendi can fetch it. 3. **Set [`max_command_run_seconds`](/docs/api-reference/endpoint/run-ffmpeg-command) to match the command's expected runtime** — it's a safety cap that aborts runaway FFmpeg jobs (defaults to 5 minutes). Pick a value that covers legitimate cases but still catches hangs. 4. **Rendi stores your output files for you** — use the `storage_url` returned in the response directly, and use [`store-file`](/docs/api-reference/endpoint/store-file) / [`get-file`](/docs/api-reference/endpoint/get-file) for persisting intermediate assets. You don't need to store output files in another S3/GCS unless your app specifically requires it. 5. **Use [`run-chained-ffmpeg-commands`](/docs/api-reference/endpoint/run-chained-ffmpeg-commands) for multi-step pipelines** — single round-trip, lower latency than chaining separate calls. 6. **Use [webhooks](/docs/webhooks) for jobs over \~30 seconds**; [poll](/docs/api-reference/endpoint/poll-command) for shorter ones. 7. **Use [`dynamic-files`](/docs/dynamic-files)** when the same command runs across many inputs. 8. **Authentication is the `X-API-KEY` header** — keep keys server-side, never in browser code. See [API introduction](/docs/api-reference/introduction). 9. **For FFmpeg commands not covered by an example page**, fetch the Rendi cheatsheet: [https://raw.githubusercontent.com/rendi-api/ffmpeg-cheatsheet/refs/heads/main/README.md](https://raw.githubusercontent.com/rendi-api/ffmpeg-cheatsheet/refs/heads/main/README.md) — it lists canonical commands for common operations including audio mixing, crossfades, jump cuts, social-media cropping, frame-rate changes, and storyboards. ## Suggested prompts Try these in your agent once the MCP server is installed: * *"Add a Rendi-based thumbnail extractor to my Express route handler."* * *"Build a video compression pipeline using Rendi with webhook callbacks."* * *"Extract audio from this MP4 using Rendi and save as MP3."* * *"Use Rendi to burn SRT subtitles into a video, then compress the result to under 5MB."* * *"Generate 10 thumbnails evenly spaced across a video using Rendi, in one chained call."* # Direct File Upload Source: https://rendi.dev/docs/direct-upload Upload local files directly to Rendi storage using multipart upload. # Direct File Upload Upload local files directly to Rendi's storage and run them through FFprobe. Bytes stream from your client straight to Rendi's storage. Files up to **5 TB** are supported. Use direct upload for local files. If your file is already at a publicly accessible URL, use [`/files/store-file`](/docs/api-reference/endpoint/store-file) instead — it will fetch and store the file from that URL. ## Flow **1. Initialize** Call [`POST /v1/files/init-upload`](/docs/api-reference/endpoint/init-upload) with `filename` and `size_bytes`. You get back a `file_id`, a `part_size`, and a list of `upload_urls` (one per part). **2. Upload parts** Split your file into chunks of exactly `part_size` bytes (the last chunk can be smaller). PUT each chunk directly to its corresponding URL in `upload_urls`. Collect the `ETag` response header from each PUT. Parts can be uploaded in parallel and retried independently. **3. Complete** Call [`POST /v1/files/{file_id}/complete-upload`](/docs/api-reference/endpoint/complete-upload) with the `{part_number, etag}` list. The uploaded bytes are now assembled into a single stored file. **4. FFprobe (automatic)** After completion, Rendi analyzes the file with FFprobe to extract media metadata (duration, dimensions, codec, mime type, bitrate, frame rate, etc.). The file's `status` transitions from `UPLOADED` to `STORED` when analysis completes. Poll [`GET /v1/files/{file_id}`](/docs/api-reference/endpoint/get-file) to observe the transition. If something goes wrong mid-upload, call [`POST /v1/files/{file_id}/abort-upload`](/docs/api-reference/endpoint/abort-upload) to discard the partial data. ## Code Examples ```python Python theme={null} import os, requests API = "https://api.rendi.dev/v1" API_KEY = "YOUR_API_KEY" FILE = "./my_video.mp4" # 1. Init init = requests.post(f"{API}/files/init-upload", headers={"X-API-Key": API_KEY}, json={"filename": os.path.basename(FILE), "size_bytes": os.path.getsize(FILE)}, ).json() file_id, part_size, upload_urls = init["file_id"], init["part_size"], init["upload_urls"] # 2. Upload each part parts = [] with open(FILE, "rb") as f: for i, url in enumerate(upload_urls): chunk = f.read(part_size) r = requests.put(url, data=chunk) r.raise_for_status() parts.append({"part_number": i + 1, "etag": r.headers["ETag"]}) # 3. Complete resp = requests.post(f"{API}/files/{file_id}/complete-upload", headers={"X-API-Key": API_KEY}, json={"parts": parts}, ).json() print("Uploaded:", resp["file_id"], "status:", resp["status"]) ``` ```typescript TypeScript theme={null} import { readFile, stat } from "node:fs/promises"; import { basename } from "node:path"; const API = "https://api.rendi.dev/v1"; const API_KEY = "YOUR_API_KEY"; const FILE = "./my_video.mp4"; const size = (await stat(FILE)).size; // 1. Init const init = await fetch(`${API}/files/init-upload`, { method: "POST", headers: { "X-API-Key": API_KEY, "Content-Type": "application/json" }, body: JSON.stringify({ filename: basename(FILE), size_bytes: size }), }).then(r => r.json()); const { file_id, part_size, upload_urls } = init as { file_id: string; part_size: number; upload_urls: string[]; }; // 2. Upload each part const buf = await readFile(FILE); const parts: { part_number: number; etag: string }[] = []; for (let i = 0; i < upload_urls.length; i++) { const start = i * part_size; const chunk = buf.subarray(start, start + part_size); const r = await fetch(upload_urls[i], { method: "PUT", body: chunk }); if (!r.ok) throw new Error(`part ${i + 1} failed: ${r.status}`); parts.push({ part_number: i + 1, etag: r.headers.get("ETag")! }); } // 3. Complete const done = await fetch(`${API}/files/${file_id}/complete-upload`, { method: "POST", headers: { "X-API-Key": API_KEY, "Content-Type": "application/json" }, body: JSON.stringify({ parts }), }).then(r => r.json()); console.log("Uploaded:", done.file_id, "status:", done.status); ``` ```javascript JavaScript (Node.js) theme={null} const fs = require("node:fs/promises"); const path = require("node:path"); const API = "https://api.rendi.dev/v1"; const API_KEY = "YOUR_API_KEY"; const FILE = "./my_video.mp4"; (async () => { const size = (await fs.stat(FILE)).size; // 1. Init const init = await fetch(`${API}/files/init-upload`, { method: "POST", headers: { "X-API-Key": API_KEY, "Content-Type": "application/json" }, body: JSON.stringify({ filename: path.basename(FILE), size_bytes: size }), }).then(r => r.json()); const { file_id, part_size, upload_urls } = init; // 2. Upload each part const buf = await fs.readFile(FILE); const parts = []; for (let i = 0; i < upload_urls.length; i++) { const chunk = buf.subarray(i * part_size, (i + 1) * part_size); const r = await fetch(upload_urls[i], { method: "PUT", body: chunk }); if (!r.ok) throw new Error(`part ${i + 1} failed: ${r.status}`); parts.push({ part_number: i + 1, etag: r.headers.get("ETag") }); } // 3. Complete const done = await fetch(`${API}/files/${file_id}/complete-upload`, { method: "POST", headers: { "X-API-Key": API_KEY, "Content-Type": "application/json" }, body: JSON.stringify({ parts }), }).then(r => r.json()); console.log("Uploaded:", done.file_id, "status:", done.status); })(); ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" "os" "path/filepath" ) const API = "https://api.rendi.dev/v1" const APIKey = "YOUR_API_KEY" const File = "./my_video.mp4" type initResp struct { FileID string `json:"file_id"` PartSize int64 `json:"part_size"` UploadURLs []string `json:"upload_urls"` } type part struct { PartNumber int `json:"part_number"` ETag string `json:"etag"` } func main() { fi, _ := os.Stat(File) // 1. Init body, _ := json.Marshal(map[string]any{"filename": filepath.Base(File), "size_bytes": fi.Size()}) req, _ := http.NewRequest("POST", API+"/files/init-upload", bytes.NewReader(body)) req.Header.Set("X-API-Key", APIKey) req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) var init initResp json.NewDecoder(resp.Body).Decode(&init) resp.Body.Close() // 2. Upload each part f, _ := os.Open(File) defer f.Close() parts := []part{} for i, url := range init.UploadURLs { chunk := make([]byte, init.PartSize) n, _ := io.ReadFull(f, chunk) putReq, _ := http.NewRequest("PUT", url, bytes.NewReader(chunk[:n])) putResp, err := http.DefaultClient.Do(putReq) if err != nil || putResp.StatusCode >= 300 { panic(fmt.Sprintf("part %d failed", i+1)) } parts = append(parts, part{PartNumber: i + 1, ETag: putResp.Header.Get("ETag")}) putResp.Body.Close() } // 3. Complete body, _ = json.Marshal(map[string]any{"parts": parts}) req, _ = http.NewRequest("POST", API+"/files/"+init.FileID+"/complete-upload", bytes.NewReader(body)) req.Header.Set("X-API-Key", APIKey) req.Header.Set("Content-Type", "application/json") resp, _ = http.DefaultClient.Do(req) var done map[string]any json.NewDecoder(resp.Body).Decode(&done) resp.Body.Close() fmt.Println("Uploaded:", done["file_id"], "status:", done["status"]) } ``` ```bash cURL theme={null} # 1. Init — save file_id, part_size, upload_urls from the response curl -sX POST https://api.rendi.dev/v1/files/init-upload \ -H "X-API-Key: $RENDI_API_KEY" \ -H "Content-Type: application/json" \ -d '{"filename": "my_video.mp4", "size_bytes": 104857600}' # 2. Upload each part (part 1 shown; repeat for each URL in upload_urls) # Split your file first: `split -b my_video.mp4 chunk_` curl -sX PUT "" --data-binary @chunk_aa -D headers.txt # The ETag header from headers.txt goes into the parts array below # 3. Complete curl -sX POST https://api.rendi.dev/v1/files//complete-upload \ -H "X-API-Key: $RENDI_API_KEY" \ -H "Content-Type: application/json" \ -d '{"parts": [{"part_number": 1, "etag": ""}, ...]}' ``` ## Optional Parameters on init-upload * `is_private: true` — file lands in [private storage](/docs/private-files). Requires downloading via presigned URL. * `part_size: ` — override the default part size. The server clamps to the valid range (5 MB minimum, 5 GB maximum) and to whatever's needed to fit within 10,000 parts. The actually-used value is returned in `part_size` on the response. ## Constraints | Limit | Value | | - | - | | Max file size | 5 TB | | Min part size | 5 MB (last part exempt) | | Max part size | 5 GB | | Max parts | 10,000 | | Presigned upload-URL TTL | 6 hours | ## Errors * **`400` on complete-upload**: the upload session has expired or was aborted. Start a new upload with `init-upload`. * **`400` on complete-upload / abort-upload**: file is not in an upload-in-progress state (already completed, aborted, or the row is a different kind of file). * **`403` on init-upload**: your account plan does not support uploads (trial), or private storage was requested on a trial plan. * **`403` on init-upload**: `size_bytes` would exceed your storage quota. # Dynamic Files Source: https://rendi.dev/docs/dynamic-files Flexible handling of compressed folders, sequence patterns, and multi-output commands. Rendi supports FFmpeg commands that work with **dynamic inputs and outputs** - cases where the number of files isn't known ahead of time or is determined by the command itself. ### Supported Dynamic Patterns | Pattern | Type | Description | | - | - | - | | `%0d` / `%03d` | Input/Output | Sequence patterns for numbered files (e.g., `frame_%03d.png`) | | `tee` | Output | Write to multiple outputs simultaneously | | `segment` | Output | Split output into multiple segment files | | `image2` | Input | Read image sequences with glob patterns | | `concat` | Input | Concatenate multiple files from a list | | `HLS/DASH` | Input/Output | Streaming manifests with multiple segments | To use these patterns with Rendi, you'll typically need **compressed folders** for input or the **OUTPUT\_FOLDER** flag for output. *** ## Dynamic Inputs Rendi supports using a **compressed .zip folder** as an FFmpeg input source. This enables commands that require multiple input files, such as image sequences (`%0d` patterns), HLS playlists, or concat demuxer lists. Use the field `input_compressed_folder` to supply a URL pointing to a `.zip` file. Rendi automatically downloads and **decompresses** the archive before running your FFmpeg command. > **Important:** Command run time includes the time required to decompress the `.zip` file. ### Using custom fonts To use custom fonts or auxiliary files (e.g., subtitles, watermarks), bundle everything together in a `.zip` and use `input_compressed_folder`. > **Important:** When using `input_compressed_folder`, **all** input files must be inside the ZIP — do not use the `input_files` field alongside it. For example, to add subtitles with a custom font to a video, create a ZIP containing: * `sample_popeye_meets_sinbad.mp4` - your video file * `sample_popeye_meets_sinbad.srt` - your subtitle file * `Poppins-Regular.ttf` - a font that supports your target script ```bash theme={null} curl --location 'https://api.rendi.dev/v1/run-ffmpeg-command' \ --header 'X-API-KEY: ' \ --header 'Content-Type: application/json; charset=utf-8' \ --data '{ "input_compressed_folder": "https://storage.rendi.dev/sample/popeye_meets_sinbad_custom_font.zip", "output_files": { "out_1": "sample_popeye_meets_sinbad_subtitled.mp4" }, "ffmpeg_command": "-i sample_popeye_meets_sinbad.mp4 -vf \"subtitles=sample_popeye_meets_sinbad.srt:fontsdir=.:force_style='\''FontName=Poppins,FontSize=24,PrimaryColour=&HFFFFFF,OutlineColour=&H4066B66B,Outline=1,BorderStyle=3'\''\" -c:v libx264 -c:a copy {{out_1}}" }' ``` The FFmpeg command uses: * `-i sample_popeye_meets_sinbad.mp4` - Reads the video file from the decompressed ZIP * `subtitles=sample_popeye_meets_sinbad.srt` - References the subtitle file from the same decompressed ZIP * `fontsdir=.` - Tells FFmpeg to look for fonts in the current (decompressed) directory * `force_style='FontName=Poppins,...'` - Applies the custom font and styling. Use the font's **FontName** (found by opening the font file), not the filename This approach works for any use case where FFmpeg needs to reference auxiliary files like fonts, text files, subtitle files, or watermark images — bundle everything into a single ZIP. > **Tip:** For text overlays with custom fonts, use `drawtext=fontfile=MyFont.ttf:text='Hello':fontcolor=white:fontsize=60`. See the [FFmpeg Cheatsheet](https://github.com/rendi-api/ffmpeg-cheatsheet?tab=readme-ov-file#overlay-text-on-video) for more details. ### Using HLS recording as input stored in a ZIP folder This example demonstrates processing an HLS recording stored in a ZIP archive. The sample ZIP at [playlist\_sample.zip](https://storage.rendi.dev/sample/playlist_sample.zip) contains: * `playlist.m3u8` - the HLS playlist file * `output0.ts`, `output1.ts`, `output2.ts` - the video segments ```bash theme={null} curl --location 'https://api.rendi.dev/v1/run-ffmpeg-command' \ --header 'X-API-KEY: ' \ --header 'Content-Type: application/json; charset=utf-8' \ --data '{ "input_compressed_folder": "https://storage.rendi.dev/sample/playlist_sample.zip", "output_files": { "out_1": "recording.mp4" }, "ffmpeg_command": "-i playlist.m3u8 -c:v libx264 -crf 23 -c:a aac -b:a 128k {{out_1}}", "vcpu_count": 8 }' ``` The FFmpeg command reads the HLS playlist, re-encodes the video to H.264 (CRF 23 for balanced quality/size) and audio to AAC, then outputs a single MP4 file. > **Tip:** For faster processing without re-encoding, use `-c copy -bsf:a aac_adtstoasc` instead. ### Using indexed image frames to create a video This example demonstrates creating a video from a sequence of numbered image frames stored in a ZIP archive. The ZIP should contain files like `frame_001.png`, `frame_002.png`, etc. ```bash theme={null} curl --location 'https://api.rendi.dev/v1/run-ffmpeg-command' \ --header 'X-API-KEY: ' \ --header 'Content-Type: application/json; charset=utf-8' \ --data '{ "input_compressed_folder": "https://storage.rendi.dev/sample/big_buck_bunny_720p_5sec_30fps_frames.zip", "output_files": { "out_1": "video.mp4" }, "ffmpeg_command": "-framerate 30 -i frame_%03d.png -c:v libx264 -pix_fmt yuv420p {{out_1}}", "vcpu_count": 8 }' ``` The FFmpeg command uses: * `-framerate 30` - Sets the input frame rate to 30 FPS * `-i frame_%03d.png` - Reads sequentially numbered frames (frame\_001.png, frame\_002.png, ...) * `-c:v libx264` - Encodes output as H.264 video * `-pix_fmt yuv420p` - Ensures compatibility with most video players > **Tip:** Adjust the pattern to match your file naming (e.g., `img_%04d.jpg` for img\_0001.jpg, img\_0002.jpg, etc.). ## Dynamic Outputs Rendi also supports **compressed output folders**. To enable this, set the `output_files` field to the special flag: ``` OUTPUT_FOLDER ``` When this flag is used, Rendi creates a `.zip` archive containing **only the output files** produced by your FFmpeg command. > **Important:** Command runtime includes the time required to compress the output folder. ### Extracting frames from an input video and storing them in a zip This example extracts individual frames from a video and packages them into a ZIP archive. The output can be used as input for the "Using indexed image frames to create a video" example above. ```bash theme={null} curl --location 'https://api.rendi.dev/v1/run-ffmpeg-command' \ --header 'X-API-KEY: ' \ --header 'Content-Type: application/json; charset=utf-8' \ --data '{ "input_files": { "in_1": "https://storage.rendi.dev/sample/big_buck_bunny_720p_5sec.mp4" }, "output_files": "OUTPUT_FOLDER", "ffmpeg_command": "-i {{in_1}} -vf fps=30 frame_%03d.png" }' ``` The FFmpeg command uses: * `-i {{in_1}}` - Reads the input video file * `-vf fps=30` - Extracts frames at 30 frames per second * `frame_%03d.png` - Outputs frames as `frame_001.png`, `frame_002.png`, etc. The resulting ZIP contains all extracted frames, ready to be used with `input_compressed_folder` for video reconstruction or other processing. > **Tip:** Adjust the `fps` value to control frame extraction density. Use `fps=1` for 1 frame per second, or omit `-vf fps=30` entirely to extract every frame at the video's native framerate. ### Generating an HLS output folder and storing it as a ZIP ```bash theme={null} curl --location 'https://api.rendi.dev/v1/run-ffmpeg-command' \ --header 'X-API-KEY: ' \ --header 'Content-Type: application/json; charset=utf-8' \ --data '{ "input_files": { "in_1": "https://storage.rendi.dev/sample/sample.avi" }, "output_files": "OUTPUT_FOLDER", "ffmpeg_command": "-i {{in_1}} -t 25 -c:v h264 -c:a aac -b:v 2000k -b:a 128k -hls_time 5 -hls_list_size 0 -f hls playlist.m3u8" }' ``` ## Response Format for Compressed Output Folders In addition to the usual fields, the response includes extra metadata describing the generated `.zip` archive: ```json theme={null} { "command_id": "41938bd7-3550-46d8-87c3-9d0b3200e7fb", "status": "SUCCESS", "command_type": "FFMPEG_COMMAND", "total_processing_seconds": 31.964526, "ffmpeg_command_run_seconds": 3.218038558959961, "vcpu_count": 8, "output_files": { "OUTPUT_FOLDER": { "file_id": "8d9ebcfb-f560-4858-af5c-bd5bf426d874", "storage_url": "https://storage.rendi.dev/files/.../41938bd7-3550-46d8-87c3-9d0b3200e7fb.zip", "status": "STORED", "rendi_store_type": "OUTPUT", "is_deleted": false, "size_mbytes": 6.900238990783691, "file_type": "zip", "file_format": "zip", "file_count": 6, "size_compressed_mbytes": 5.120238990783691 } } } ``` ### Field Descriptions * **file\_count** - Number of files contained inside the output `.zip` folder. * **size\_mbytes** - Total size (MB) of all files *before* compression. * **size\_compressed\_mbytes** - Final compressed `.zip` size stored in Rendi. * **file\_format** - Always `zip`. * **storage\_url** - The download URL of the compressed output folder. > The compressed output file name is: **`.zip`** *** ## Processing & Storage Quota 1. **Processing quota for inputs** is calculated based on the size of the files **after decompression**. 2. **Processing quota for OUTPUT\_FOLDER** uses the size of files **before compression**. 3. **Storage usage** is based on the size of the **compressed .zip file**. # Overview Source: https://rendi.dev/docs/examples Common FFmpeg tasks with Rendi — thumbnails, trimming, merging, extracting audio, subtitles. Each example is a canonical recipe for a specific task. Pick the one that matches what you need to do. ## Generate > [card] [Generate a thumbnail](/docs/examples/generate-thumbnail) > > Capture a single frame at a specific timestamp. > [card] [Generate multiple thumbnails](/docs/examples/generate-multiple-thumbnails) > > Extract several frames in one call. > [card] [Slideshow from images + audio](/docs/examples/slideshow-from-images-and-audio) > > Turn a set of images and an audio track into a video. > [card] [Thumbnail + GIF (chained)](/docs/examples/thumbnail-and-gif-chained) > > Produce a thumbnail and a preview GIF in one chained request. ## Convert > [card] [Transcode](/docs/examples/transcode) > > Convert between video formats (MP4, MOV, AVI, WebM). > [card] [Compress video](/docs/examples/compress-video) > > Reduce file size while keeping acceptable quality. > [card] [Resize video](/docs/examples/resize-video) > > Change resolution, aspect ratio, or add letterbox. ## Edit > [card] [Trim a clip](/docs/examples/trim-clip) > > Cut a segment between two timestamps. > [card] [Merge videos](/docs/examples/merge-videos) > > Concatenate two or more clips into one. > [card] [Multi-resolution trim](/docs/examples/multi-resolution-trim) > > Trim and produce multiple resolutions in one call. ## Audio > [card] [Extract audio](/docs/examples/extract-audio) > > Pull the audio track from a video as MP3, WAV, or AAC. ## Subtitles > [card] [Burn-in SRT subtitles](/docs/examples/burn-in-srt-subtitles) > > Render SRT captions permanently into a video. ## Overlay > [card] [Overlay watermark](/docs/examples/overlay-watermark) > > Add a logo or image overlay to a video. # Burn SRT subtitles into a video Source: https://rendi.dev/docs/examples/burn-in-srt-subtitles Render an SRT subtitle file permanently onto a video using Rendi's FFmpeg API. Node.js, Python, and cURL examples. Render an SRT subtitle file permanently onto a video (burned-in captions). Useful when the target player doesn't support subtitle tracks or you need guaranteed rendering. ## Code > [tab] Node.js > > ```js theme={null} > const API_KEY = process.env.RENDI_API_KEY; > > const submit = await fetch("https://api.rendi.dev/v1/run-ffmpeg-command", { > method: "POST", > headers: { > "Content-Type": "application/json", > "X-API-KEY": API_KEY, > }, > body: JSON.stringify({ > input_files: { > in_video: "https://storage.rendi.dev/sample/sample.avi", > in_srt: "https://storage.rendi.dev/sample/subtitles.srt", > }, > output_files: { > out_1: "subtitled.mp4", > }, > ffmpeg_command: > "-i {{in_video}} -ss 00:00 -to 01:00 -vf subtitles={{in_srt}} -c:v libx264 -crf 20 -c:a aac -b:a 192k {{out_1}}", > }), > }); > const { command_id } = await submit.json(); > > while (true) { > const res = await fetch(`https://api.rendi.dev/v1/commands/${command_id}`, { > headers: { "X-API-KEY": API_KEY }, > }); > const data = await res.json(); > if (data.status === "SUCCESS") { > console.log("Subtitled URL:", data.output_files.out_1.storage_url); > break; > } > if (data.status === "FAILED") throw new Error("Command failed"); > await new Promise((r) => setTimeout(r, 2000)); > } > ``` > [tab] Python > > ```python theme={null} > import os > import time > import requests > > API_KEY = os.environ["RENDI_API_KEY"] > BASE = "https://api.rendi.dev/v1" > headers = {"X-API-KEY": API_KEY} > > submit = requests.post( > f"{BASE}/run-ffmpeg-command", > headers=headers, > json={ > "input_files": { > "in_video": "https://storage.rendi.dev/sample/sample.avi", > "in_srt": "https://storage.rendi.dev/sample/subtitles.srt", > }, > "output_files": {"out_1": "subtitled.mp4"}, > "ffmpeg_command": "-i {{in_video}} -ss 00:00 -to 01:00 -vf subtitles={{in_srt}} -c:v libx264 -crf 20 -c:a aac -b:a 192k {{out_1}}", > }, > ) > command_id = submit.json()["command_id"] > > while True: > res = requests.get(f"{BASE}/commands/{command_id}", headers=headers).json() > if res["status"] == "SUCCESS": > print("Subtitled URL:", res["output_files"]["out_1"]["storage_url"]) > break > if res["status"] == "FAILED": > raise RuntimeError("Command failed") > time.sleep(2) > ``` > [tab] cURL > > ```bash theme={null} > curl --request POST \ > --url https://api.rendi.dev/v1/run-ffmpeg-command \ > --header 'Content-Type: application/json' \ > --header 'X-API-KEY: ' \ > --data '{ > "input_files": { > "in_video": "https://storage.rendi.dev/sample/sample.avi", > "in_srt": "https://storage.rendi.dev/sample/subtitles.srt" > }, > "output_files": {"out_1": "subtitled.mp4"}, > "ffmpeg_command": "-i {{in_video}} -ss 00:00 -to 01:00 -vf subtitles={{in_srt}} -c:v libx264 -crf 20 -c:a aac -b:a 192k {{out_1}}" > }' > > curl --request GET \ > --url https://api.rendi.dev/v1/commands/ \ > --header 'X-API-KEY: ' > ``` ## How the FFmpeg command works * `-i {{in_video}}` — input video * `-ss 00:00 -to 01:00` — only burn subtitles into the first minute (drop this to process the full video) * `-vf subtitles={{in_srt}}` — subtitles video filter reads the SRT file * `-c:v libx264 -crf 20` — re-encode video (required, since the filter modifies frames) * `-c:a aac -b:a 192k` — re-encode audio * `{{out_1}}` — output file For soft subtitles (a separate subtitle track that can be toggled off), use `-c:s mov_text` with an MP4 container and skip the `-vf` filter. ## Response ```json theme={null} { "output_files": { "out_1": { "file_id": "cb5b9186-...", "size_mbytes": 13.95, "duration": 60.0, "file_type": "video", "file_format": "mp4", "storage_url": "https://storage.rendi.dev/temp_files/.../subtitled.mp4", "width": 854, "height": 480, "codec": "h264" } }, "status": "SUCCESS", "command_type": "FFMPEG_COMMAND" } ``` ## Related * [Overlay watermark](/docs/examples/overlay-watermark) * [Transcode](/docs/examples/transcode) * [Cheatsheet — Add subtitles to a video](https://github.com/rendi-api/ffmpeg-cheatsheet#-add-subtitles-to-a-video) # Compress a video Source: https://rendi.dev/docs/examples/compress-video Reduce video file size with H.264 encoding, a higher CRF value, and a lower audio bitrate using Rendi's FFmpeg API. Node.js, Python, and cURL examples. Reduce video file size by re-encoding at a higher CRF value and lower audio bitrate. Useful for faster uploads, email-friendly sizes, or bandwidth-limited playback. ## Code > [tab] Node.js > > ```js theme={null} > const API_KEY = process.env.RENDI_API_KEY; > > const submit = await fetch("https://api.rendi.dev/v1/run-ffmpeg-command", { > method: "POST", > headers: { > "Content-Type": "application/json", > "X-API-KEY": API_KEY, > }, > body: JSON.stringify({ > input_files: { > in_1: "https://storage.rendi.dev/sample/sample.avi", > }, > output_files: { > out_1: "compressed.mp4", > }, > ffmpeg_command: > "-i {{in_1}} -c:v libx264 -preset slow -crf 28 -c:a aac -b:a 96k {{out_1}}", > }), > }); > const { command_id } = await submit.json(); > > while (true) { > const res = await fetch(`https://api.rendi.dev/v1/commands/${command_id}`, { > headers: { "X-API-KEY": API_KEY }, > }); > const data = await res.json(); > if (data.status === "SUCCESS") { > console.log("Compressed URL:", data.output_files.out_1.storage_url); > break; > } > if (data.status === "FAILED") throw new Error("Command failed"); > await new Promise((r) => setTimeout(r, 2000)); > } > ``` > [tab] Python > > ```python theme={null} > import os > import time > import requests > > API_KEY = os.environ["RENDI_API_KEY"] > BASE = "https://api.rendi.dev/v1" > headers = {"X-API-KEY": API_KEY} > > submit = requests.post( > f"{BASE}/run-ffmpeg-command", > headers=headers, > json={ > "input_files": {"in_1": "https://storage.rendi.dev/sample/sample.avi"}, > "output_files": {"out_1": "compressed.mp4"}, > "ffmpeg_command": "-i {{in_1}} -c:v libx264 -preset slow -crf 28 -c:a aac -b:a 96k {{out_1}}", > }, > ) > command_id = submit.json()["command_id"] > > while True: > res = requests.get(f"{BASE}/commands/{command_id}", headers=headers).json() > if res["status"] == "SUCCESS": > print("Compressed URL:", res["output_files"]["out_1"]["storage_url"]) > break > if res["status"] == "FAILED": > raise RuntimeError("Command failed") > time.sleep(2) > ``` > [tab] cURL > > ```bash theme={null} > curl --request POST \ > --url https://api.rendi.dev/v1/run-ffmpeg-command \ > --header 'Content-Type: application/json' \ > --header 'X-API-KEY: ' \ > --data '{ > "input_files": {"in_1": "https://storage.rendi.dev/sample/sample.avi"}, > "output_files": {"out_1": "compressed.mp4"}, > "ffmpeg_command": "-i {{in_1}} -c:v libx264 -preset slow -crf 28 -c:a aac -b:a 96k {{out_1}}" > }' > > curl --request GET \ > --url https://api.rendi.dev/v1/commands/ \ > --header 'X-API-KEY: ' > ``` ## How the FFmpeg command works * `-crf 28` — higher CRF = smaller file (23 is default, 28 is visibly compressed but acceptable; push to 30–32 for aggressive size reduction) * `-preset slow` — slower encoder uses more analysis and produces a smaller file at the same quality * `-c:a aac -b:a 96k` — AAC audio at 96 kbps (down from 192 kbps) * `{{out_1}}` — output file Tune `-crf` first; only drop the audio bitrate further if size is still too high. ## Response ```json theme={null} { "output_files": { "out_1": { "file_id": "c1a4e3f7-...", "size_mbytes": 5.8, "duration": 596.459, "file_type": "video", "file_format": "mp4", "storage_url": "https://storage.rendi.dev/temp_files/.../compressed.mp4", "width": 854, "height": 480, "codec": "h264", "bitrate_video_kb": 72.3, "bitrate_audio_kb": 96.0 } }, "status": "SUCCESS", "command_type": "FFMPEG_COMMAND" } ``` ## Related * [Transcode](/docs/examples/transcode) * [Resize video](/docs/examples/resize-video) * [Cheatsheet — Video/Audio encoding, codecs and bitrate](https://github.com/rendi-api/ffmpeg-cheatsheet#-videoaudio-encoding-codecs-and-bitrate) # Extract audio from a video Source: https://rendi.dev/docs/examples/extract-audio Extract the audio track from MP4/MOV/AVI to MP3, WAV, or AAC using Rendi's FFmpeg API. Node.js, Python, and curl examples. Extract the audio track from a video and save it as MP3. Useful when you want to strip audio out for transcription, podcast generation, or separate audio processing. ## Code > [tab] Node.js > > ```js theme={null} > const API_KEY = process.env.RENDI_API_KEY; > > // Submit the FFmpeg command > const submit = await fetch("https://api.rendi.dev/v1/run-ffmpeg-command", { > method: "POST", > headers: { > "Content-Type": "application/json", > "X-API-KEY": API_KEY, > }, > body: JSON.stringify({ > input_files: { > in_1: "https://storage.rendi.dev/sample/sample.avi", > }, > output_files: { > out_1: "audio.mp3", > }, > ffmpeg_command: "-i {{in_1}} -vn -c:a libmp3lame -q:a 2 {{out_1}}", > }), > }); > const { command_id } = await submit.json(); > > // Poll until complete > while (true) { > const res = await fetch(`https://api.rendi.dev/v1/commands/${command_id}`, { > headers: { "X-API-KEY": API_KEY }, > }); > const data = await res.json(); > if (data.status === "SUCCESS") { > console.log("Audio URL:", data.output_files.out_1.storage_url); > break; > } > if (data.status === "FAILED") throw new Error("Command failed"); > await new Promise((r) => setTimeout(r, 2000)); > } > ``` > [tab] Python > > ```python theme={null} > import os > import time > import requests > > API_KEY = os.environ["RENDI_API_KEY"] > BASE = "https://api.rendi.dev/v1" > headers = {"X-API-KEY": API_KEY} > > # Submit the FFmpeg command > submit = requests.post( > f"{BASE}/run-ffmpeg-command", > headers=headers, > json={ > "input_files": {"in_1": "https://storage.rendi.dev/sample/sample.avi"}, > "output_files": {"out_1": "audio.mp3"}, > "ffmpeg_command": "-i {{in_1}} -vn -c:a libmp3lame -q:a 2 {{out_1}}", > }, > ) > command_id = submit.json()["command_id"] > > # Poll until complete > while True: > res = requests.get(f"{BASE}/commands/{command_id}", headers=headers).json() > if res["status"] == "SUCCESS": > print("Audio URL:", res["output_files"]["out_1"]["storage_url"]) > break > if res["status"] == "FAILED": > raise RuntimeError("Command failed") > time.sleep(2) > ``` > [tab] cURL > > ```bash theme={null} > # Submit the FFmpeg command > curl --request POST \ > --url https://api.rendi.dev/v1/run-ffmpeg-command \ > --header 'Content-Type: application/json' \ > --header 'X-API-KEY: ' \ > --data '{ > "input_files": {"in_1": "https://storage.rendi.dev/sample/sample.avi"}, > "output_files": {"out_1": "audio.mp3"}, > "ffmpeg_command": "-i {{in_1}} -vn -c:a libmp3lame -q:a 2 {{out_1}}" > }' > > # Response: { "command_id": "..." } > > # Poll until complete > curl --request GET \ > --url https://api.rendi.dev/v1/commands/ \ > --header 'X-API-KEY: ' > ``` ## How the FFmpeg command works * `-i {{in_1}}` — input video URL * `-vn` — discard the video stream (audio only) * `-c:a libmp3lame` — encode audio as MP3 * `-q:a 2` — variable-bitrate quality (0 = best, 9 = worst; 2 is a good balance) * `{{out_1}}` — output file (`audio.mp3`) To export as WAV, rename `out_1` to `audio.wav` and drop the `-c:a libmp3lame -q:a 2` flags — FFmpeg picks the codec from the extension. ## Response ```json theme={null} { "output_files": { "out_1": { "file_id": "eba1a713-4631-4ccb-9ef8-b727a9f7f274", "size_mbytes": 4.62, "duration": 596.459, "file_type": "audio", "file_format": "mp3", "storage_url": "https://storage.rendi.dev/temp_files/.../audio.mp3", "bitrate_audio_kb": 128.0 } }, "status": "SUCCESS", "command_type": "FFMPEG_COMMAND" } ``` ## Related * [Compress video](/docs/examples/compress-video) * [Cheatsheet — Extract audio from video](https://github.com/rendi-api/ffmpeg-cheatsheet#extract-audio-from-video) * [run-ffmpeg-command API reference](/docs/api-reference/endpoint/run-ffmpeg-command) # Generate multiple thumbnails from a video Source: https://rendi.dev/docs/examples/generate-multiple-thumbnails Extract several frames at different timestamps in one FFmpeg call using Rendi. Node.js, Python, and cURL examples. Extract multiple frames from a video in a single call, each at its own timestamp. Cheaper than N separate calls since the input is decoded once. ## Code > [tab] Node.js > > ```js theme={null} > const API_KEY = process.env.RENDI_API_KEY; > > const submit = await fetch("https://api.rendi.dev/v1/run-ffmpeg-command", { > method: "POST", > headers: { > "Content-Type": "application/json", > "X-API-KEY": API_KEY, > }, > body: JSON.stringify({ > input_files: { > in_1: "https://storage.rendi.dev/sample/sample.avi", > }, > output_files: { > out_1: "thumbnail1.jpg", > out_2: "thumbnail2.jpg", > }, > ffmpeg_command: > "-i {{in_1}} -filter_complex \"[0:v]split=2[first][second];[first]select='gte(t,10)'[thumb1];[second]select='gte(t,20)'[thumb2]\" -map [thumb1] -frames:v 1 {{out_1}} -map [thumb2] -frames:v 1 {{out_2}}", > }), > }); > const { command_id } = await submit.json(); > > while (true) { > const res = await fetch(`https://api.rendi.dev/v1/commands/${command_id}`, { > headers: { "X-API-KEY": API_KEY }, > }); > const data = await res.json(); > if (data.status === "SUCCESS") { > console.log("Thumb 1:", data.output_files.out_1.storage_url); > console.log("Thumb 2:", data.output_files.out_2.storage_url); > break; > } > if (data.status === "FAILED") throw new Error("Command failed"); > await new Promise((r) => setTimeout(r, 2000)); > } > ``` > [tab] Python > > ```python theme={null} > import os > import time > import requests > > API_KEY = os.environ["RENDI_API_KEY"] > BASE = "https://api.rendi.dev/v1" > headers = {"X-API-KEY": API_KEY} > > submit = requests.post( > f"{BASE}/run-ffmpeg-command", > headers=headers, > json={ > "input_files": {"in_1": "https://storage.rendi.dev/sample/sample.avi"}, > "output_files": {"out_1": "thumbnail1.jpg", "out_2": "thumbnail2.jpg"}, > "ffmpeg_command": "-i {{in_1}} -filter_complex \"[0:v]split=2[first][second];[first]select='gte(t,10)'[thumb1];[second]select='gte(t,20)'[thumb2]\" -map [thumb1] -frames:v 1 {{out_1}} -map [thumb2] -frames:v 1 {{out_2}}", > }, > ) > command_id = submit.json()["command_id"] > > while True: > res = requests.get(f"{BASE}/commands/{command_id}", headers=headers).json() > if res["status"] == "SUCCESS": > print("Thumb 1:", res["output_files"]["out_1"]["storage_url"]) > print("Thumb 2:", res["output_files"]["out_2"]["storage_url"]) > break > if res["status"] == "FAILED": > raise RuntimeError("Command failed") > time.sleep(2) > ``` > [tab] cURL > > ```bash theme={null} > curl --request POST \ > --url https://api.rendi.dev/v1/run-ffmpeg-command \ > --header 'Content-Type: application/json' \ > --header 'X-API-KEY: ' \ > --data '{ > "input_files": {"in_1": "https://storage.rendi.dev/sample/sample.avi"}, > "output_files": {"out_1": "thumbnail1.jpg", "out_2": "thumbnail2.jpg"}, > "ffmpeg_command": "-i {{in_1}} -filter_complex \"[0:v]split=2[first][second];[first]select='\''gte(t,10)'\''[thumb1];[second]select='\''gte(t,20)'\''[thumb2]\" -map [thumb1] -frames:v 1 {{out_1}} -map [thumb2] -frames:v 1 {{out_2}}" > }' > > curl --request GET \ > --url https://api.rendi.dev/v1/commands/ \ > --header 'X-API-KEY: ' > ``` ## How the FFmpeg command works * `split=2[first][second]` — duplicate the video stream so we can select frames at two different times * `select='gte(t,10)'[thumb1]` — pick the first frame at or after 10 s * `select='gte(t,20)'[thumb2]` — pick the first frame at or after 20 s * `-map [thumb1] -frames:v 1 {{out_1}}` — write one frame to `thumbnail1.jpg` * `-map [thumb2] -frames:v 1 {{out_2}}` — write one frame to `thumbnail2.jpg` For N thumbnails, extend the split count and add another `select` + `-map` pair per output. ## Response ```json theme={null} { "output_files": { "out_1": { "file_id": "eba1a713-...", "size_mbytes": 0.085, "file_type": "image", "file_format": "jpg", "storage_url": "https://storage.rendi.dev/temp_files/.../thumbnail1.jpg", "width": 1280, "height": 720 }, "out_2": { "file_id": "d8278ca9-...", "size_mbytes": 0.039, "file_type": "image", "file_format": "jpg", "storage_url": "https://storage.rendi.dev/temp_files/.../thumbnail2.jpg", "width": 1280, "height": 720 } }, "status": "SUCCESS", "command_type": "FFMPEG_COMMAND" } ``` ## Related * [Generate a thumbnail](/docs/examples/generate-thumbnail) * [Thumbnail + GIF (chained)](/docs/examples/thumbnail-and-gif-chained) * [Cheatsheet — Create thumbnails from video](https://github.com/rendi-api/ffmpeg-cheatsheet#create-thumbnails-from-video) # Generate a thumbnail from a video Source: https://rendi.dev/docs/examples/generate-thumbnail Capture a single frame at a specific timestamp and save it as JPG or PNG using Rendi's FFmpeg API. Node.js, Python, and cURL examples. Capture a single frame from a video at a specific timestamp. Useful for video previews, poster frames, or social card images. ## Code > [tab] Node.js > > ```js theme={null} > const API_KEY = process.env.RENDI_API_KEY; > > const submit = await fetch("https://api.rendi.dev/v1/run-ffmpeg-command", { > method: "POST", > headers: { > "Content-Type": "application/json", > "X-API-KEY": API_KEY, > }, > body: JSON.stringify({ > input_files: { > in_1: "https://storage.rendi.dev/sample/sample.avi", > }, > output_files: { > out_1: "thumbnail.jpg", > }, > ffmpeg_command: "-i {{in_1}} -ss 00:00:17 -vframes 1 {{out_1}}", > }), > }); > const { command_id } = await submit.json(); > > while (true) { > const res = await fetch(`https://api.rendi.dev/v1/commands/${command_id}`, { > headers: { "X-API-KEY": API_KEY }, > }); > const data = await res.json(); > if (data.status === "SUCCESS") { > console.log("Thumbnail URL:", data.output_files.out_1.storage_url); > break; > } > if (data.status === "FAILED") throw new Error("Command failed"); > await new Promise((r) => setTimeout(r, 2000)); > } > ``` > [tab] Python > > ```python theme={null} > import os > import time > import requests > > API_KEY = os.environ["RENDI_API_KEY"] > BASE = "https://api.rendi.dev/v1" > headers = {"X-API-KEY": API_KEY} > > submit = requests.post( > f"{BASE}/run-ffmpeg-command", > headers=headers, > json={ > "input_files": {"in_1": "https://storage.rendi.dev/sample/sample.avi"}, > "output_files": {"out_1": "thumbnail.jpg"}, > "ffmpeg_command": "-i {{in_1}} -ss 00:00:17 -vframes 1 {{out_1}}", > }, > ) > command_id = submit.json()["command_id"] > > while True: > res = requests.get(f"{BASE}/commands/{command_id}", headers=headers).json() > if res["status"] == "SUCCESS": > print("Thumbnail URL:", res["output_files"]["out_1"]["storage_url"]) > break > if res["status"] == "FAILED": > raise RuntimeError("Command failed") > time.sleep(2) > ``` > [tab] cURL > > ```bash theme={null} > curl --request POST \ > --url https://api.rendi.dev/v1/run-ffmpeg-command \ > --header 'Content-Type: application/json' \ > --header 'X-API-KEY: ' \ > --data '{ > "input_files": {"in_1": "https://storage.rendi.dev/sample/sample.avi"}, > "output_files": {"out_1": "thumbnail.jpg"}, > "ffmpeg_command": "-i {{in_1}} -ss 00:00:17 -vframes 1 {{out_1}}" > }' > > curl --request GET \ > --url https://api.rendi.dev/v1/commands/ \ > --header 'X-API-KEY: ' > ``` ## How the FFmpeg command works * `-i {{in_1}}` — input video URL * `-ss 00:00:17` — seek to 17 seconds (format: `HH:MM:SS` or raw seconds) * `-vframes 1` — capture exactly one frame * `{{out_1}}` — output file (`thumbnail.jpg`). Use `.png` for lossless output. ## Response ```json theme={null} { "output_files": { "out_1": { "file_id": "5a978607-8c20-4b3b-91db-b67516e7f274", "size_mbytes": 0.024, "file_type": "image", "file_format": "jpg", "storage_url": "https://storage.rendi.dev/temp_files/.../thumbnail.jpg", "width": 854, "height": 480 } }, "status": "SUCCESS", "command_type": "FFMPEG_COMMAND" } ``` ## Related * [Generate multiple thumbnails](/docs/examples/generate-multiple-thumbnails) * [Thumbnail + GIF (chained)](/docs/examples/thumbnail-and-gif-chained) * [Cheatsheet — Create thumbnails from video](https://github.com/rendi-api/ffmpeg-cheatsheet#create-thumbnails-from-video) # Merge (concatenate) videos Source: https://rendi.dev/docs/examples/merge-videos Concatenate two or more video clips into a single output using Rendi's FFmpeg API. Node.js, Python, and cURL examples. Concatenate two or more video clips into a single output. The `concat` filter re-encodes on the fly so it works even when the clips have different codecs, resolutions, or frame rates. ## Code > [tab] Node.js > > ```js theme={null} > const API_KEY = process.env.RENDI_API_KEY; > > const submit = await fetch("https://api.rendi.dev/v1/run-ffmpeg-command", { > method: "POST", > headers: { > "Content-Type": "application/json", > "X-API-KEY": API_KEY, > }, > body: JSON.stringify({ > input_files: { > in_1: "https://storage.rendi.dev/sample/sample.avi", > in_2: "https://storage.rendi.dev/sample/sample.avi", > }, > output_files: { > out_1: "merged.mp4", > }, > ffmpeg_command: > '-i {{in_1}} -i {{in_2}} -filter_complex "[0:v][0:a][1:v][1:a]concat=n=2:v=1:a=1[v][a]" -map "[v]" -map "[a]" -c:v libx264 -c:a aac {{out_1}}', > }), > }); > const { command_id } = await submit.json(); > > while (true) { > const res = await fetch(`https://api.rendi.dev/v1/commands/${command_id}`, { > headers: { "X-API-KEY": API_KEY }, > }); > const data = await res.json(); > if (data.status === "SUCCESS") { > console.log("Merged URL:", data.output_files.out_1.storage_url); > break; > } > if (data.status === "FAILED") throw new Error("Command failed"); > await new Promise((r) => setTimeout(r, 2000)); > } > ``` > [tab] Python > > ```python theme={null} > import os > import time > import requests > > API_KEY = os.environ["RENDI_API_KEY"] > BASE = "https://api.rendi.dev/v1" > headers = {"X-API-KEY": API_KEY} > > submit = requests.post( > f"{BASE}/run-ffmpeg-command", > headers=headers, > json={ > "input_files": { > "in_1": "https://storage.rendi.dev/sample/sample.avi", > "in_2": "https://storage.rendi.dev/sample/sample.avi", > }, > "output_files": {"out_1": "merged.mp4"}, > "ffmpeg_command": '-i {{in_1}} -i {{in_2}} -filter_complex "[0:v][0:a][1:v][1:a]concat=n=2:v=1:a=1[v][a]" -map "[v]" -map "[a]" -c:v libx264 -c:a aac {{out_1}}', > }, > ) > command_id = submit.json()["command_id"] > > while True: > res = requests.get(f"{BASE}/commands/{command_id}", headers=headers).json() > if res["status"] == "SUCCESS": > print("Merged URL:", res["output_files"]["out_1"]["storage_url"]) > break > if res["status"] == "FAILED": > raise RuntimeError("Command failed") > time.sleep(2) > ``` > [tab] cURL > > ```bash theme={null} > curl --request POST \ > --url https://api.rendi.dev/v1/run-ffmpeg-command \ > --header 'Content-Type: application/json' \ > --header 'X-API-KEY: ' \ > --data '{ > "input_files": { > "in_1": "https://storage.rendi.dev/sample/sample.avi", > "in_2": "https://storage.rendi.dev/sample/sample.avi" > }, > "output_files": {"out_1": "merged.mp4"}, > "ffmpeg_command": "-i {{in_1}} -i {{in_2}} -filter_complex \"[0:v][0:a][1:v][1:a]concat=n=2:v=1:a=1[v][a]\" -map \"[v]\" -map \"[a]\" -c:v libx264 -c:a aac {{out_1}}" > }' > > curl --request GET \ > --url https://api.rendi.dev/v1/commands/ \ > --header 'X-API-KEY: ' > ``` ## How the FFmpeg command works * `-i {{in_1}} -i {{in_2}}` — two input videos (add more with `in_3`, `in_4`, etc.) * `concat=n=2:v=1:a=1` — concatenate 2 inputs, each contributing 1 video stream + 1 audio stream * `[v][a]` — named outputs for the concatenated streams * `-map "[v]" -map "[a]"` — route concatenated streams to the output * `-c:v libx264 -c:a aac` — re-encode (required by the concat filter) * `{{out_1}}` — output file For N videos, add `-i {{in_N}}` per input, update `n=N`, and extend the stream-selection list: `[0:v][0:a][1:v][1:a]...[N-1:v][N-1:a]`. If all clips share the same codec/resolution/framerate, the demuxer approach (`concat` as a protocol, no re-encode) is faster — but requires a concat list file. ## Response ```json theme={null} { "output_files": { "out_1": { "file_id": "d4c5b6a7-...", "size_mbytes": 58.3, "duration": 1192.918, "file_type": "video", "file_format": "mp4", "storage_url": "https://storage.rendi.dev/temp_files/.../merged.mp4", "width": 854, "height": 480, "codec": "h264" } }, "status": "SUCCESS", "command_type": "FFMPEG_COMMAND" } ``` ## Related * [Trim a clip](/docs/examples/trim-clip) * [Slideshow from images + audio](/docs/examples/slideshow-from-images-and-audio) * [Cheatsheet — Combine media assets](https://github.com/rendi-api/ffmpeg-cheatsheet#combine-media-assets) # Trim a video into multiple resolutions in one call Source: https://rendi.dev/docs/examples/multi-resolution-trim Trim a video to a time range and simultaneously produce multiple resolutions in one FFmpeg call using Rendi. Node.js, Python, and cURL examples. Trim a video to a time range and simultaneously output multiple resolutions from the same input. One command instead of several — cheaper and faster because the input is decoded once. ## Code > [tab] Node.js > > ```js theme={null} > const API_KEY = process.env.RENDI_API_KEY; > > const submit = await fetch("https://api.rendi.dev/v1/run-ffmpeg-command", { > method: "POST", > headers: { > "Content-Type": "application/json", > "X-API-KEY": API_KEY, > }, > body: JSON.stringify({ > input_files: { > in_1: "https://storage.rendi.dev/sample/sample.avi", > }, > output_files: { > out_1: "output_320p.mp4", > out_2: "output_180p.mp4", > }, > ffmpeg_command: > '-i {{in_1}} -ss 00:00 -to 00:30 -filter_complex "[0:v]split=2[vid1][vid2];[vid1]scale=trunc(oh*a/2)*2:320:force_original_aspect_ratio=decrease,pad=trunc(oh*a/2)*2:320:-1:-1[320p];[vid2]scale=trunc(oh*a/2)*2:180:force_original_aspect_ratio=decrease,pad=trunc(oh*a/2)*2:180:-1:-1[180p]" -map [320p] -map 0:a -c:a copy -c:v libx264 -preset medium {{out_1}} -map [180p] -map 0:a -c:a copy -c:v libx264 -preset medium {{out_2}}', > }), > }); > const { command_id } = await submit.json(); > > while (true) { > const res = await fetch(`https://api.rendi.dev/v1/commands/${command_id}`, { > headers: { "X-API-KEY": API_KEY }, > }); > const data = await res.json(); > if (data.status === "SUCCESS") { > console.log("320p:", data.output_files.out_1.storage_url); > console.log("180p:", data.output_files.out_2.storage_url); > break; > } > if (data.status === "FAILED") throw new Error("Command failed"); > await new Promise((r) => setTimeout(r, 2000)); > } > ``` > [tab] Python > > ```python theme={null} > import os > import time > import requests > > API_KEY = os.environ["RENDI_API_KEY"] > BASE = "https://api.rendi.dev/v1" > headers = {"X-API-KEY": API_KEY} > > submit = requests.post( > f"{BASE}/run-ffmpeg-command", > headers=headers, > json={ > "input_files": {"in_1": "https://storage.rendi.dev/sample/sample.avi"}, > "output_files": { > "out_1": "output_320p.mp4", > "out_2": "output_180p.mp4", > }, > "ffmpeg_command": '-i {{in_1}} -ss 00:00 -to 00:30 -filter_complex "[0:v]split=2[vid1][vid2];[vid1]scale=trunc(oh*a/2)*2:320:force_original_aspect_ratio=decrease,pad=trunc(oh*a/2)*2:320:-1:-1[320p];[vid2]scale=trunc(oh*a/2)*2:180:force_original_aspect_ratio=decrease,pad=trunc(oh*a/2)*2:180:-1:-1[180p]" -map [320p] -map 0:a -c:a copy -c:v libx264 -preset medium {{out_1}} -map [180p] -map 0:a -c:a copy -c:v libx264 -preset medium {{out_2}}', > }, > ) > command_id = submit.json()["command_id"] > > while True: > res = requests.get(f"{BASE}/commands/{command_id}", headers=headers).json() > if res["status"] == "SUCCESS": > print("320p:", res["output_files"]["out_1"]["storage_url"]) > print("180p:", res["output_files"]["out_2"]["storage_url"]) > break > if res["status"] == "FAILED": > raise RuntimeError("Command failed") > time.sleep(2) > ``` > [tab] cURL > > ```bash theme={null} > curl --request POST \ > --url https://api.rendi.dev/v1/run-ffmpeg-command \ > --header 'Content-Type: application/json' \ > --header 'X-API-KEY: ' \ > --data '{ > "input_files": {"in_1": "https://storage.rendi.dev/sample/sample.avi"}, > "output_files": {"out_1": "output_320p.mp4", "out_2": "output_180p.mp4"}, > "ffmpeg_command": "-i {{in_1}} -ss 00:00 -to 00:30 -filter_complex \"[0:v]split=2[vid1][vid2];[vid1]scale=trunc(oh*a/2)*2:320:force_original_aspect_ratio=decrease,pad=trunc(oh*a/2)*2:320:-1:-1[320p];[vid2]scale=trunc(oh*a/2)*2:180:force_original_aspect_ratio=decrease,pad=trunc(oh*a/2)*2:180:-1:-1[180p]\" -map [320p] -map 0:a -c:a copy -c:v libx264 -preset medium {{out_1}} -map [180p] -map 0:a -c:a copy -c:v libx264 -preset medium {{out_2}}" > }' > > curl --request GET \ > --url https://api.rendi.dev/v1/commands/ \ > --header 'X-API-KEY: ' > ``` ## How the FFmpeg command works * `-ss 00:00 -to 00:30` — trim the video to the first 30 seconds * `split=2[vid1][vid2]` — duplicate the video stream so each copy can be scaled independently * `scale=...:320:...,pad=...:320:-1:-1[320p]` — scale first copy to 320 px tall, letterbox to maintain aspect * `scale=...:180:...,pad=...:180:-1:-1[180p]` — scale second copy to 180 px tall * `-map [320p] -map 0:a ... {{out_1}}` — first output: 320p video + original audio * `-map [180p] -map 0:a ... {{out_2}}` — second output: 180p video + original audio * `-c:a copy` — pass audio through unchanged for both outputs * `-c:v libx264 -preset medium` — re-encode each video with H.264 For N resolutions, extend the `split=N` and add another `scale...pad...[NNp]` stage plus output mapping. ## Response ```json theme={null} { "output_files": { "out_1": { "file_id": "f775b15d-...", "size_mbytes": 2.27, "duration": 30.0, "file_type": "video", "file_format": "mp4", "storage_url": "https://storage.rendi.dev/temp_files/.../output_320p.mp4", "width": 568, "height": 320, "codec": "h264" }, "out_2": { "file_id": "9df00eca-...", "size_mbytes": 1.05, "duration": 30.0, "file_type": "video", "file_format": "mp4", "storage_url": "https://storage.rendi.dev/temp_files/.../output_180p.mp4", "width": 320, "height": 180, "codec": "h264" } }, "status": "SUCCESS", "command_type": "FFMPEG_COMMAND" } ``` ## Related * [Trim a clip](/docs/examples/trim-clip) * [Resize video](/docs/examples/resize-video) * [Cheatsheet — Resizing and padding](https://github.com/rendi-api/ffmpeg-cheatsheet#resizing-and-padding) # Overlay a watermark on a video Source: https://rendi.dev/docs/examples/overlay-watermark Overlay a logo or image watermark onto a video at a fixed position using Rendi's FFmpeg API. Node.js, Python, and cURL examples. Overlay a logo or image watermark onto a video at a fixed position (corner, center, or custom coordinates). ## Code > [tab] Node.js > > ```js theme={null} > const API_KEY = process.env.RENDI_API_KEY; > > const submit = await fetch("https://api.rendi.dev/v1/run-ffmpeg-command", { > method: "POST", > headers: { > "Content-Type": "application/json", > "X-API-KEY": API_KEY, > }, > body: JSON.stringify({ > input_files: { > in_1: "https://storage.rendi.dev/sample/sample.avi", > in_logo: "https://storage.rendi.dev/sample/rendi_banner_white_transparent.png", > }, > output_files: { > out_1: "watermarked.mp4", > }, > ffmpeg_command: > '-i {{in_1}} -i {{in_logo}} -ss 00:00:00 -to 00:00:10 -filter_complex "[0:v][1:v]overlay=W-w-10:10" -c:v libx264 -c:a copy {{out_1}}', > }), > }); > const { command_id } = await submit.json(); > > while (true) { > const res = await fetch(`https://api.rendi.dev/v1/commands/${command_id}`, { > headers: { "X-API-KEY": API_KEY }, > }); > const data = await res.json(); > if (data.status === "SUCCESS") { > console.log("Watermarked URL:", data.output_files.out_1.storage_url); > break; > } > if (data.status === "FAILED") throw new Error("Command failed"); > await new Promise((r) => setTimeout(r, 2000)); > } > ``` > [tab] Python > > ```python theme={null} > import os > import time > import requests > > API_KEY = os.environ["RENDI_API_KEY"] > BASE = "https://api.rendi.dev/v1" > headers = {"X-API-KEY": API_KEY} > > submit = requests.post( > f"{BASE}/run-ffmpeg-command", > headers=headers, > json={ > "input_files": { > "in_1": "https://storage.rendi.dev/sample/sample.avi", > "in_logo": "https://storage.rendi.dev/sample/bbb-splash.png", > }, > "output_files": {"out_1": "watermarked.mp4"}, > "ffmpeg_command": '-i {{in_1}} -i {{in_logo}} -filter_complex "[0:v][1:v]overlay=W-w-10:10" -c:v libx264 -c:a copy {{out_1}}', > }, > ) > command_id = submit.json()["command_id"] > > while True: > res = requests.get(f"{BASE}/commands/{command_id}", headers=headers).json() > if res["status"] == "SUCCESS": > print("Watermarked URL:", res["output_files"]["out_1"]["storage_url"]) > break > if res["status"] == "FAILED": > raise RuntimeError("Command failed") > time.sleep(2) > ``` > [tab] cURL > > ```bash theme={null} > curl --request POST \ > --url https://api.rendi.dev/v1/run-ffmpeg-command \ > --header 'Content-Type: application/json' \ > --header 'X-API-KEY: ' \ > --data '{ > "input_files": { > "in_1": "https://storage.rendi.dev/sample/sample.avi", > "in_logo": "https://storage.rendi.dev/sample/bbb-splash.png" > }, > "output_files": {"out_1": "watermarked.mp4"}, > "ffmpeg_command": "-i {{in_1}} -i {{in_logo}} -filter_complex \"[0:v][1:v]overlay=W-w-10:10\" -c:v libx264 -c:a copy {{out_1}}" > }' > > curl --request GET \ > --url https://api.rendi.dev/v1/commands/ \ > --header 'X-API-KEY: ' > ``` ## How the FFmpeg command works * `-i {{in_1}}` — input video * `-i {{in_logo}}` — second input: logo PNG (with transparency if desired) * `-filter_complex "[0:v][1:v]overlay=W-w-10:10"` — place logo 10 px from the top-right corner * `W-w-10` = video width − logo width − 10 px padding * `10` = 10 px from the top * `-c:v libx264 -c:a copy` — re-encode video (needed after filter), pass audio through Position shortcuts: * Top-left: `overlay=10:10` * Top-right: `overlay=W-w-10:10` * Bottom-left: `overlay=10:H-h-10` * Bottom-right: `overlay=W-w-10:H-h-10` * Center: `overlay=(W-w)/2:(H-h)/2` ## Response ```json theme={null} { "output_files": { "out_1": { "file_id": "e7f8a9b0-...", "size_mbytes": 28.1, "duration": 596.459, "file_type": "video", "file_format": "mp4", "storage_url": "https://storage.rendi.dev/temp_files/.../watermarked.mp4", "width": 854, "height": 480, "codec": "h264" } }, "status": "SUCCESS", "command_type": "FFMPEG_COMMAND" } ``` ## Related * [Transcode](/docs/examples/transcode) * [Burn-in SRT subtitles](/docs/examples/burn-in-srt-subtitles) * [Cheatsheet — Overlay text on video](https://github.com/rendi-api/ffmpeg-cheatsheet#overlay-text-on-video) # Resize a video Source: https://rendi.dev/docs/examples/resize-video Scale a video to a target resolution with letterbox padding to preserve aspect ratio using Rendi's FFmpeg API. Node.js, Python, and cURL examples. Scale a video to a target resolution (e.g., 1280×720 or 1920×1080) and letterbox where needed to preserve the source aspect ratio. ## Code > [tab] Node.js > > ```js theme={null} > const API_KEY = process.env.RENDI_API_KEY; > > const submit = await fetch("https://api.rendi.dev/v1/run-ffmpeg-command", { > method: "POST", > headers: { > "Content-Type": "application/json", > "X-API-KEY": API_KEY, > }, > body: JSON.stringify({ > input_files: { > in_1: "https://storage.rendi.dev/sample/sample.avi", > }, > output_files: { > out_1: "resized-720p.mp4", > }, > ffmpeg_command: > '-i {{in_1}} -vf "scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:(ow-iw)/2:(oh-ih)/2" -c:v libx264 -c:a copy {{out_1}}', > }), > }); > const { command_id } = await submit.json(); > > while (true) { > const res = await fetch(`https://api.rendi.dev/v1/commands/${command_id}`, { > headers: { "X-API-KEY": API_KEY }, > }); > const data = await res.json(); > if (data.status === "SUCCESS") { > console.log("Resized URL:", data.output_files.out_1.storage_url); > break; > } > if (data.status === "FAILED") throw new Error("Command failed"); > await new Promise((r) => setTimeout(r, 2000)); > } > ``` > [tab] Python > > ```python theme={null} > import os > import time > import requests > > API_KEY = os.environ["RENDI_API_KEY"] > BASE = "https://api.rendi.dev/v1" > headers = {"X-API-KEY": API_KEY} > > submit = requests.post( > f"{BASE}/run-ffmpeg-command", > headers=headers, > json={ > "input_files": {"in_1": "https://storage.rendi.dev/sample/sample.avi"}, > "output_files": {"out_1": "resized-720p.mp4"}, > "ffmpeg_command": '-i {{in_1}} -vf "scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:(ow-iw)/2:(oh-ih)/2" -c:v libx264 -c:a copy {{out_1}}', > }, > ) > command_id = submit.json()["command_id"] > > while True: > res = requests.get(f"{BASE}/commands/{command_id}", headers=headers).json() > if res["status"] == "SUCCESS": > print("Resized URL:", res["output_files"]["out_1"]["storage_url"]) > break > if res["status"] == "FAILED": > raise RuntimeError("Command failed") > time.sleep(2) > ``` > [tab] cURL > > ```bash theme={null} > curl --request POST \ > --url https://api.rendi.dev/v1/run-ffmpeg-command \ > --header 'Content-Type: application/json' \ > --header 'X-API-KEY: ' \ > --data '{ > "input_files": {"in_1": "https://storage.rendi.dev/sample/sample.avi"}, > "output_files": {"out_1": "resized-720p.mp4"}, > "ffmpeg_command": "-i {{in_1}} -vf \"scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:(ow-iw)/2:(oh-ih)/2\" -c:v libx264 -c:a copy {{out_1}}" > }' > > curl --request GET \ > --url https://api.rendi.dev/v1/commands/ \ > --header 'X-API-KEY: ' > ``` ## How the FFmpeg command works * `scale=1280:720:force_original_aspect_ratio=decrease` — fit inside 1280×720, keep aspect ratio * `pad=1280:720:(ow-iw)/2:(oh-ih)/2` — letterbox with black bars centered * `-c:v libx264` — re-encode video with H.264 (required after scaling) * `-c:a copy` — pass audio through unchanged (faster than re-encoding) * `{{out_1}}` — output file For stretch-to-fit without letterbox, drop the `pad` filter. For crop-to-fit, change `decrease` to `increase` and add `crop=1280:720`. ## Response ```json theme={null} { "output_files": { "out_1": { "file_id": "a8b2f3c4-...", "size_mbytes": 22.4, "duration": 596.459, "file_type": "video", "file_format": "mp4", "storage_url": "https://storage.rendi.dev/temp_files/.../resized-720p.mp4", "width": 1280, "height": 720, "codec": "h264" } }, "status": "SUCCESS", "command_type": "FFMPEG_COMMAND" } ``` ## Related * [Transcode](/docs/examples/transcode) * [Multi-resolution trim](/docs/examples/multi-resolution-trim) * [Cheatsheet — Resizing and padding](https://github.com/rendi-api/ffmpeg-cheatsheet#resizing-and-padding) # Build a video from images and audio (slideshow) Source: https://rendi.dev/docs/examples/slideshow-from-images-and-audio Combine images and an audio track into a video using Rendi's FFmpeg API. Node.js, Python, and cURL examples. Combine a set of images and an audio track into a single video. Each image displays for a fixed duration and the audio plays over the top — finishing when the audio ends. ## Code > [tab] Node.js > > ```js theme={null} > const API_KEY = process.env.RENDI_API_KEY; > > const submit = await fetch("https://api.rendi.dev/v1/run-ffmpeg-command", { > method: "POST", > headers: { > "Content-Type": "application/json", > "X-API-KEY": API_KEY, > }, > body: JSON.stringify({ > input_files: { > in_img_1: "https://storage.rendi.dev/sample/bbb-splash.png", > in_img_2: "https://storage.rendi.dev/sample/rodents.png", > in_img_3: "https://storage.rendi.dev/sample/evil-frank.png", > in_audio_1: "https://storage.rendi.dev/sample/Neon%20Lights.mp3", > }, > output_files: { > out_1: "slideshow.mp4", > }, > ffmpeg_command: > '-loop 1 -t 5 -i {{in_img_1}} -loop 1 -t 5 -i {{in_img_2}} -loop 1 -t 5 -i {{in_img_3}} -i {{in_audio_1}} -filter_complex "[0:v][1:v][2:v]concat=n=3:v=1:a=0,format=yuv420p[v]" -map [v] -map 3:a -c:v libx264 -c:a aac -shortest {{out_1}}', > }), > }); > const { command_id } = await submit.json(); > > while (true) { > const res = await fetch(`https://api.rendi.dev/v1/commands/${command_id}`, { > headers: { "X-API-KEY": API_KEY }, > }); > const data = await res.json(); > if (data.status === "SUCCESS") { > console.log("Slideshow URL:", data.output_files.out_1.storage_url); > break; > } > if (data.status === "FAILED") throw new Error("Command failed"); > await new Promise((r) => setTimeout(r, 2000)); > } > ``` > [tab] Python > > ```python theme={null} > import os > import time > import requests > > API_KEY = os.environ["RENDI_API_KEY"] > BASE = "https://api.rendi.dev/v1" > headers = {"X-API-KEY": API_KEY} > > submit = requests.post( > f"{BASE}/run-ffmpeg-command", > headers=headers, > json={ > "input_files": { > "in_img_1": "https://storage.rendi.dev/sample/bbb-splash.png", > "in_img_2": "https://storage.rendi.dev/sample/rodents.png", > "in_img_3": "https://storage.rendi.dev/sample/evil-frank.png", > "in_audio_1": "https://storage.rendi.dev/sample/Neon%20Lights.mp3", > }, > "output_files": {"out_1": "slideshow.mp4"}, > "ffmpeg_command": '-loop 1 -t 5 -i {{in_img_1}} -loop 1 -t 5 -i {{in_img_2}} -loop 1 -t 5 -i {{in_img_3}} -i {{in_audio_1}} -filter_complex "[0:v][1:v][2:v]concat=n=3:v=1:a=0,format=yuv420p[v]" -map [v] -map 3:a -c:v libx264 -c:a aac -shortest {{out_1}}', > }, > ) > command_id = submit.json()["command_id"] > > while True: > res = requests.get(f"{BASE}/commands/{command_id}", headers=headers).json() > if res["status"] == "SUCCESS": > print("Slideshow URL:", res["output_files"]["out_1"]["storage_url"]) > break > if res["status"] == "FAILED": > raise RuntimeError("Command failed") > time.sleep(2) > ``` > [tab] cURL > > ```bash theme={null} > curl --request POST \ > --url https://api.rendi.dev/v1/run-ffmpeg-command \ > --header 'Content-Type: application/json' \ > --header 'X-API-KEY: ' \ > --data '{ > "input_files": { > "in_img_1": "https://storage.rendi.dev/sample/bbb-splash.png", > "in_img_2": "https://storage.rendi.dev/sample/rodents.png", > "in_img_3": "https://storage.rendi.dev/sample/evil-frank.png", > "in_audio_1": "https://storage.rendi.dev/sample/Neon%20Lights.mp3" > }, > "output_files": {"out_1": "slideshow.mp4"}, > "ffmpeg_command": "-loop 1 -t 5 -i {{in_img_1}} -loop 1 -t 5 -i {{in_img_2}} -loop 1 -t 5 -i {{in_img_3}} -i {{in_audio_1}} -filter_complex \"[0:v][1:v][2:v]concat=n=3:v=1:a=0,format=yuv420p[v]\" -map [v] -map 3:a -c:v libx264 -c:a aac -shortest {{out_1}}" > }' > > curl --request GET \ > --url https://api.rendi.dev/v1/commands/ \ > --header 'X-API-KEY: ' > ``` ## How the FFmpeg command works * `-loop 1 -t 5 -i {{in_img_1}}` — loop each image for 5 seconds (repeat per image) * `-i {{in_audio_1}}` — audio track as the last input * `concat=n=3:v=1:a=0` — concatenate the 3 video streams, 1 video, 0 audio * `format=yuv420p` — pixel format compatible with most players * `-map [v] -map 3:a` — pick the concatenated video + audio from input index 3 * `-shortest` — stop when the shortest stream ends (typically when video runs out) * `{{out_1}}` — output file For longer images, increase `-t 5` per input. For crossfades between images, replace `concat` with `xfade`. ## Response ```json theme={null} { "output_files": { "out_1": { "file_id": "10cfed0c-...", "size_mbytes": 1.09, "duration": 15.001, "file_type": "video", "file_format": "mp4", "storage_url": "https://storage.rendi.dev/temp_files/.../slideshow.mp4", "width": 1920, "height": 1080, "codec": "h264", "frame_rate": 25.0, "bitrate_video_kb": 453.5, "bitrate_audio_kb": 132.6 } }, "status": "SUCCESS", "command_type": "FFMPEG_COMMAND" } ``` ## Related * [Merge videos](/docs/examples/merge-videos) * [Overlay watermark](/docs/examples/overlay-watermark) * [Cheatsheet — Image to video](https://github.com/rendi-api/ffmpeg-cheatsheet#image-to-video) # Generate a thumbnail and a GIF in one chained request Source: https://rendi.dev/docs/examples/thumbnail-and-gif-chained Produce a thumbnail JPG and a preview GIF from the same video in a single chained request using Rendi's FFmpeg API. Node.js, Python, and cURL examples. Produce a thumbnail and a short preview GIF in a single chained request. Chained commands run sequentially on the same input, and outputs from earlier commands can feed later ones — cheaper than two separate calls. ## Code > [tab] Node.js > > ```js theme={null} > const API_KEY = process.env.RENDI_API_KEY; > > const submit = await fetch( > "https://api.rendi.dev/v1/run-chained-ffmpeg-commands", > { > method: "POST", > headers: { > "Content-Type": "application/json", > "X-API-KEY": API_KEY, > }, > body: JSON.stringify({ > input_files: { > in_1: "https://storage.rendi.dev/sample/sample.avi", > }, > output_files: { > out_1: "thumbnail.jpg", > out_2: "preview.gif", > }, > ffmpeg_commands: [ > "-i {{in_1}} -ss 00:17 -vframes 1 {{out_1}}", > "-i {{in_1}} -vf \"select='lte(t,60)*gt(trunc(t/10),trunc(prev_t/10))',setpts='PTS*0.1',scale=trunc(oh*a/2)*2:80:force_original_aspect_ratio=decrease,pad=trunc(oh*a/2)*2:80:-1:-1\" -an -fps_mode vfr {{out_2}}", > ], > }), > }, > ); > const { command_id } = await submit.json(); > > while (true) { > const res = await fetch( > `https://api.rendi.dev/v1/commands/${command_id}`, > { > headers: { "X-API-KEY": API_KEY }, > }, > ); > const data = await res.json(); > if (data.status === "SUCCESS") { > console.log("Thumbnail:", data.output_files.out_1.storage_url); > console.log("GIF:", data.output_files.out_2.storage_url); > break; > } > if (data.status === "FAILED") throw new Error("Command failed"); > await new Promise((r) => setTimeout(r, 2000)); > } > ``` > [tab] Python > > ```python theme={null} > import os > import time > import requests > > API_KEY = os.environ["RENDI_API_KEY"] > BASE = "https://api.rendi.dev/v1" > headers = {"X-API-KEY": API_KEY} > > submit = requests.post( > f"{BASE}/run-chained-ffmpeg-commands", > headers=headers, > json={ > "input_files": {"in_1": "https://storage.rendi.dev/sample/sample.avi"}, > "output_files": {"out_1": "thumbnail.jpg", "out_2": "preview.gif"}, > "ffmpeg_commands": [ > "-i {{in_1}} -ss 00:17 -vframes 1 {{out_1}}", > "-i {{in_1}} -vf \"select='lte(t,60)*gt(trunc(t/10),trunc(prev_t/10))',setpts='PTS*0.1',scale=trunc(oh*a/2)*2:80:force_original_aspect_ratio=decrease,pad=trunc(oh*a/2)*2:80:-1:-1\" -an -fps_mode vfr {{out_2}}", > ], > }, > ) > command_id = submit.json()["command_id"] > > while True: > res = requests.get(f"{BASE}/commands/{command_id}", headers=headers).json() > if res["status"] == "SUCCESS": > print("Thumbnail:", res["output_files"]["out_1"]["storage_url"]) > print("GIF:", res["output_files"]["out_2"]["storage_url"]) > break > if res["status"] == "FAILED": > raise RuntimeError("Command failed") > time.sleep(2) > ``` > [tab] cURL > > ```bash theme={null} > curl --request POST \ > --url https://api.rendi.dev/v1/run-chained-ffmpeg-commands \ > --header 'Content-Type: application/json' \ > --header 'X-API-KEY: ' \ > --data '{ > "input_files": {"in_1": "https://storage.rendi.dev/sample/sample.avi"}, > "output_files": {"out_1": "thumbnail.jpg", "out_2": "preview.gif"}, > "ffmpeg_commands": [ > "-i {{in_1}} -ss 00:17 -vframes 1 {{out_1}}", > "-i {{in_1}} -vf \"select='\''lte(t,60)*gt(trunc(t/10),trunc(prev_t/10))'\'',setpts='\''PTS*0.1'\'',scale=trunc(oh*a/2)*2:80:force_original_aspect_ratio=decrease,pad=trunc(oh*a/2)*2:80:-1:-1\" -an -fps_mode vfr {{out_2}}" > ] > }' > > curl --request GET \ > --url https://api.rendi.dev/v1/commands/ \ > --header 'X-API-KEY: ' > ``` ## How the FFmpeg commands work **Command 1 (thumbnail):** `-i {{in_1}} -ss 00:17 -vframes 1 {{out_1}}` — grab a single frame at 17 s. **Command 2 (GIF):** * `select='lte(t,60)*gt(trunc(t/10),trunc(prev_t/10))'` — keep one frame every 10 s, up to the 60 s mark (6 frames total) * `setpts='PTS*0.1'` — speed up playback by 10× so the GIF plays fast * `scale=...:80:force_original_aspect_ratio=decrease,pad=...:80:-1:-1` — scale to 80 px tall, letterbox width * `-an` — drop audio * `-fps_mode vfr` — variable frame rate: output only the selected frames, without duplicates to fill the gaps ## Response ```json theme={null} { "command_id": "963b85e1-...", "status": "SUCCESS", "output_files": { "out_1": { "file_id": "5a978607-...", "size_mbytes": 0.024, "file_type": "image", "file_format": "jpg", "storage_url": "https://storage.rendi.dev/files/.../thumbnail.jpg", "width": 854, "height": 480 }, "out_2": { "file_id": "3f51e56e-...", "size_mbytes": 0.300, "file_type": "image", "file_format": "gif", "storage_url": "https://storage.rendi.dev/files/.../preview.gif", "width": 142, "height": 80 } }, "command_type": "FFMPEG_CHAINED_COMMANDS" } ``` ## Related * [Generate a thumbnail](/docs/examples/generate-thumbnail) * [Generate multiple thumbnails](/docs/examples/generate-multiple-thumbnails) * [run-chained-ffmpeg-commands API reference](/docs/api-reference/endpoint/run-chained-ffmpeg-commands) * [Cheatsheet — Create GIFs](https://github.com/rendi-api/ffmpeg-cheatsheet#create-gifs) # Transcode a video (change format) Source: https://rendi.dev/docs/examples/transcode Convert a video between container formats (MP4, MOV, AVI, WebM) and codecs using Rendi's FFmpeg API. Node.js, Python, and cURL examples. Convert a video between container formats and codecs — e.g., AVI to MP4, MOV to WebM, or re-encode an existing MP4 with H.264/AAC. ## Code > [tab] Node.js > > ```js theme={null} > const API_KEY = process.env.RENDI_API_KEY; > > const submit = await fetch("https://api.rendi.dev/v1/run-ffmpeg-command", { > method: "POST", > headers: { > "Content-Type": "application/json", > "X-API-KEY": API_KEY, > }, > body: JSON.stringify({ > input_files: { > in_1: "https://storage.rendi.dev/sample/sample.avi", > }, > output_files: { > out_1: "output.mp4", > }, > ffmpeg_command: > "-i {{in_1}} -c:v libx264 -preset medium -crf 23 -c:a aac -b:a 192k {{out_1}}", > }), > }); > const { command_id } = await submit.json(); > > while (true) { > const res = await fetch(`https://api.rendi.dev/v1/commands/${command_id}`, { > headers: { "X-API-KEY": API_KEY }, > }); > const data = await res.json(); > if (data.status === "SUCCESS") { > console.log("Output URL:", data.output_files.out_1.storage_url); > break; > } > if (data.status === "FAILED") throw new Error("Command failed"); > await new Promise((r) => setTimeout(r, 2000)); > } > ``` > [tab] Python > > ```python theme={null} > import os > import time > import requests > > API_KEY = os.environ["RENDI_API_KEY"] > BASE = "https://api.rendi.dev/v1" > headers = {"X-API-KEY": API_KEY} > > submit = requests.post( > f"{BASE}/run-ffmpeg-command", > headers=headers, > json={ > "input_files": {"in_1": "https://storage.rendi.dev/sample/sample.avi"}, > "output_files": {"out_1": "output.mp4"}, > "ffmpeg_command": "-i {{in_1}} -c:v libx264 -preset medium -crf 23 -c:a aac -b:a 192k {{out_1}}", > }, > ) > command_id = submit.json()["command_id"] > > while True: > res = requests.get(f"{BASE}/commands/{command_id}", headers=headers).json() > if res["status"] == "SUCCESS": > print("Output URL:", res["output_files"]["out_1"]["storage_url"]) > break > if res["status"] == "FAILED": > raise RuntimeError("Command failed") > time.sleep(2) > ``` > [tab] cURL > > ```bash theme={null} > curl --request POST \ > --url https://api.rendi.dev/v1/run-ffmpeg-command \ > --header 'Content-Type: application/json' \ > --header 'X-API-KEY: ' \ > --data '{ > "input_files": {"in_1": "https://storage.rendi.dev/sample/sample.avi"}, > "output_files": {"out_1": "output.mp4"}, > "ffmpeg_command": "-i {{in_1}} -c:v libx264 -preset medium -crf 23 -c:a aac -b:a 192k {{out_1}}" > }' > > curl --request GET \ > --url https://api.rendi.dev/v1/commands/ \ > --header 'X-API-KEY: ' > ``` ## How the FFmpeg command works * `-i {{in_1}}` — input video URL * `-c:v libx264` — encode video with H.264 * `-preset medium` — encoder speed/size tradeoff (`ultrafast` → `veryslow`) * `-crf 23` — quality (lower = better; 18 = near-lossless, 23 = default, 28 = compressed) * `-c:a aac -b:a 192k` — AAC audio at 192 kbps * `{{out_1}}` — output file; extension picks the container (`.mp4`, `.webm`, `.mov`) ## Response ```json theme={null} { "output_files": { "out_1": { "file_id": "f775b15d-67e9-4235-b89f-4bb33c0a5f57", "size_mbytes": 12.5, "duration": 596.459, "file_type": "video", "file_format": "mp4", "storage_url": "https://storage.rendi.dev/temp_files/.../output.mp4", "width": 854, "height": 480, "codec": "h264", "frame_rate": 24.0, "bitrate_video_kb": 180.5, "bitrate_audio_kb": 192.0 } }, "status": "SUCCESS", "command_type": "FFMPEG_COMMAND" } ``` ## Related * [Compress video](/docs/examples/compress-video) * [Resize video](/docs/examples/resize-video) * [Cheatsheet — Converting formats](https://github.com/rendi-api/ffmpeg-cheatsheet#converting-formats) # Trim a clip from a video Source: https://rendi.dev/docs/examples/trim-clip Cut a segment between two timestamps using stream copy for fast trimming with Rendi's FFmpeg API. Node.js, Python, and cURL examples. Cut a segment of a video between two timestamps. ## Code > [tab] Node.js > > ```js theme={null} > const API_KEY = process.env.RENDI_API_KEY; > > const submit = await fetch("https://api.rendi.dev/v1/run-ffmpeg-command", { > method: "POST", > headers: { > "Content-Type": "application/json", > "X-API-KEY": API_KEY, > }, > body: JSON.stringify({ > input_files: { > in_1: "https://storage.rendi.dev/sample/sample.avi", > }, > output_files: { > out_1: "clip.mp4", > }, > ffmpeg_command: > "-i {{in_1}} -ss 00:00:10 -to 00:00:30 {{out_1}}", > }), > }); > const { command_id } = await submit.json(); > > while (true) { > const res = await fetch(`https://api.rendi.dev/v1/commands/${command_id}`, { > headers: { "X-API-KEY": API_KEY }, > }); > const data = await res.json(); > if (data.status === "SUCCESS") { > console.log("Clip URL:", data.output_files.out_1.storage_url); > break; > } > if (data.status === "FAILED") throw new Error("Command failed"); > await new Promise((r) => setTimeout(r, 2000)); > } > ``` > [tab] Python > > ```python theme={null} > import os > import time > import requests > > API_KEY = os.environ["RENDI_API_KEY"] > BASE = "https://api.rendi.dev/v1" > headers = {"X-API-KEY": API_KEY} > > submit = requests.post( > f"{BASE}/run-ffmpeg-command", > headers=headers, > json={ > "input_files": {"in_1": "https://storage.rendi.dev/sample/sample.avi"}, > "output_files": {"out_1": "clip.mp4"}, > "ffmpeg_command": "-i {{in_1}} -ss 00:00:10 -to 00:00:30 {{out_1}}", > }, > ) > command_id = submit.json()["command_id"] > > while True: > res = requests.get(f"{BASE}/commands/{command_id}", headers=headers).json() > if res["status"] == "SUCCESS": > print("Clip URL:", res["output_files"]["out_1"]["storage_url"]) > break > if res["status"] == "FAILED": > raise RuntimeError("Command failed") > time.sleep(2) > ``` > [tab] cURL > > ```bash theme={null} > curl --request POST \ > --url https://api.rendi.dev/v1/run-ffmpeg-command \ > --header 'Content-Type: application/json' \ > --header 'X-API-KEY: ' \ > --data '{ > "input_files": {"in_1": "https://storage.rendi.dev/sample/sample.avi"}, > "output_files": {"out_1": "clip.mp4"}, > "ffmpeg_command": "-i {{in_1}} -ss 00:00:10 -to 00:00:30 {{out_1}}" > }' > > curl --request GET \ > --url https://api.rendi.dev/v1/commands/ \ > --header 'X-API-KEY: ' > ``` ## How the FFmpeg command works * `-i {{in_1}}` — input video URL * `-ss 00:00:10` — start at 10 seconds * `-to 00:00:30` — end at 30 seconds (absolute timestamp, not duration) * `{{out_1}}` — output file ## Response ```json theme={null} { "output_files": { "out_1": { "file_id": "b1d2e3f4-...", "size_mbytes": 1.8, "duration": 20.0, "file_type": "video", "file_format": "mp4", "storage_url": "https://storage.rendi.dev/temp_files/.../clip.mp4", "width": 854, "height": 480, "codec": "h264" } }, "status": "SUCCESS", "command_type": "FFMPEG_COMMAND" } ``` ## Related * [Multi-resolution trim](/docs/examples/multi-resolution-trim) * [Merge videos](/docs/examples/merge-videos) * [Cheatsheet — Trim by time](https://github.com/rendi-api/ffmpeg-cheatsheet#trim-by-time) # Introduction Source: https://rendi.dev/docs/introduction Fast, scalable, reliable FFmpeg as a Service. No installation, just run FFmpeg online on Rendi's cloud infrastructure. Rendi is a simple API for running **FFmpeg online** without worrying about installation, server management or scaling. We have invested heavily in running and maintaining FFmpeg swarms so that you don’t have to. You’ll find that using **Rendi** at scale is as simple as using FFmpeg locally, without having to install anything. **RESTful HTTP** requests do all the work. > *"Rendi made it simple, cost-effective and easy to cut, edit, and merge video clips at scale for our clients."* *Carl Taylor, CEO, automationagency.com* *** Want to dive right in? Check out the tutorial in our dashboard to run your first FFmpeg command online: > [card] [Create a GIF with FFmpeg in Rendi in just 3 clicks - free and no strings attached](https://app.rendi.dev/sign-up?loc=doc-introduction) ## How It Works Rendi operates through batch processing: submit your FFmpeg command, Rendi processes it in the cloud, and returns the results to you. Here is how a typical FFmpeg command is executed in rendi: 1. Send your FFmpeg command via an **HTTP POST** 2. Rendi **processes** it on its servers and stores the output files 3. Receive a **notification** upon completion, either through HTTP Polling or Webhook 4. **Download** the output files ## With Rendi you get * **99.9% uptime** commitment * **Easy integration** — just use HTTP REST in an environment of your choice: Python, NodeJS, Zapier, make, n8n, etc * **No lock-in** with custom interfaces — pure FFmpeg with all its expressivity * **No learning curve** (well, after you’ve mastered FFmpeg syntax...) * **Optimized FFmpeg execution** run time * **No boot time** — our servers are always up and auto-scaling with load balancing * **No video length limit** — videos over 45 min not a problem * **No processing length limit** — long-running process not a problem > [!NOTE] > > All the examples on our site use curl commands for straightforward HTTP > requests. You can run the same requests in the environment of your choice - > Python, NodeJS, n8n, etc. ## How to use Rendi? > [card] [Building with a coding agent](/docs/coding-agents) > > MCP server for any agent, plus a Claude Code plugin > [card] [Rendi in action](/docs/examples) > > Check out a few common use case examples > [card] [Youtube tutorial](https://www.youtube.com/watch?v=D1T4rR3Z9yg) > > Demonstrating how to run FFmpeg Commands in Rendi using Postman with files > from Google Drive > [card] [n8n integration](/docs/n8n.mdx) > > FFmpeg commands online in n8n workflows with no installation > [card] [Make integration](/docs/make-com) > > Automate FFmpeg video processing in Make.com workflows without code > [card] [Chained FFmpeg Commands](/docs/api-reference/endpoint/run-chained-ffmpeg-commands) > > API documentation for running multiple FFmpeg commands together - shortening > overall processing time > [card] [Run FFprobe](/docs/api-reference/endpoint/store-file) > > API documentation for analyzing media files with FFprobe online and storing them in Rendi ## Ready to integrate? The best way to understand Rendi is to send it an FFmpeg command. Start with our 2-minute quickstart to generate your first GIF with FFmpeg online: > [card] [Quickstart](/docs/quick-start) > > Run your first FFmpeg command in Rendi ## Check more > [card] [Rendi GitHub repo](https://github.com/rendi-api/ffmpeg-cheatsheet) > > Use our exhaustive cheatsheet for FFmpeg automation commands. > [card] [System Status Page](https://status.rendi.dev) > > Check our historic 99.98%+ uptime and register for system updates. # Make Integration Source: https://rendi.dev/docs/make-com Run FFmpeg commands in Make.com workflows using Rendi — no code, native Make module. # Rendi and Make Integration Rendi's integration with Make enables seamless automation of video processing workflows by combining Rendi's FFmpeg capabilities with Make's robust automation platform. ## Tutorial - Running FFmpeg Commands in Make using Rendi The tutorial below shows how to create a make scenario that tracks a google drive folder, when a new video file is uploaded to it, make it publicly available and send the video file to a command in Rendi that turns it into a GIF, then it saves the stored GIF URL in a google sheet. The tutorial also shows how to use Rendi's webhooks feature in Make and how to delete stored files in Rendi. [YouTube video player](https://youtube.com/embed/Mr5hHr7vlF8?start=58) ## Integration Details You can find our official integration on Make's marketplace: [Make - Rendi - FFmepg API](https://www.make.com/en/integrations/rendi?utm_source=rendi-app\&utm_medium=partner\&utm_campaign=rendi-app-partner-program) To establish the integration between Make and Rendi: 1. Obtain your API key from the Rendi dashboard 2. Create a new connection in Make 3. Use your Rendi API key to authenticate the connection ## Available Actions Rendi provides two native actions within Make: 1. **Run FFmpeg Command**: The primary action for triggering video processing tasks. The full documentation for this action can be found in [API reference - run FFmpeg command endpoint](/docs/api-reference/endpoint/run-ffmpeg-command) 2. **Make API Call**: For additional API interactions These actions are accessible through Make's module search widget when building your automation scenarios. ## Handling Curly Brackets `{{}}` Make uses curly brackets `{{}}` as special characters for its stored variables. When using these brackets in Rendi FFmpeg commands, you need to escape them with backslashes, like this: `\{\{\}\}`. Here's an example of a configured FFmpeg command in Make: ![Make Run Command Example](https://mintcdn.com/rendi/1OKYW2ScK83N9NWR/makecom_run_command.png?fit=max\&auto=format\&n=1OKYW2ScK83N9NWR\&q=85\&s=c858f54a150821f2309cc83a1a3c45a5) ## Processing Workflow After submitting a command to Rendi, you have two options to track the processing status: 1. **Polling Method**: Monitor the job status using our [API reference - poll command endpoint](/docs/api-reference/endpoint/poll-command) 2. **Webhook Integration**: Configure webhooks to automatically trigger Make workflows upon job completion. See our [webhooks documentation](/docs/webhooks) for details. # n8n Integration Source: https://rendi.dev/docs/n8n Run FFmpeg commands in n8n workflows using Rendi — native node, no installation. # Rendi and n8n Integration Rendi's integration with n8n enables seamless automation of video processing workflows by combining Rendi's FFmpeg capabilities with n8n's powerful workflow automation platform. ## Tutorial - Running FFmpeg Commands in n8n using Rendi The tutorial below demonstrates how to create an n8n workflow that reads video URLs from Google Sheets, processes them with FFmpeg commands via Rendi, and stores the output back in the spreadsheet. [YouTube video player](https://youtube.com/embed/Zikf4lLHWO0) ## Integration Setup To integrate Rendi with n8n workflows: 1. Obtain your API key from the Rendi dashboard 2. Add an HTTP Request node in your n8n workflow 3. Configure the node to send requests to Rendi's API endpoints 4. Include your API key in the request headers ## Workflow Configuration ### Input Requirements Your input video files must be accessible via public URLs or signed S3 URLs. Rendi downloads files from these URLs for processing. For testing, ensure URLs are accessible in an incognito browser. ## Running FFmpeg Commands Configure an HTTP Request node as a POST to Rendi's [run FFmpeg command](/docs/api-reference/endpoint/run-ffmpeg-command) endpoint. The request body must include: * `input_files`: Object mapping input identifiers to URLs * `output_files`: Object mapping output identifiers to filenames * `ffmpeg_command`: The FFmpeg command string with placeholders ### Handling Curly Brackets `{{}}` n8n uses curly brackets `{{}}` for variable interpolation. When using these brackets in Rendi FFmpeg commands, you need to escape them with double backslashes, like this: `\\{\\{input_0\\}\\}`. The double escaping ensures both the JSON parser and n8n's expression engine treat the brackets as literal characters. ![Rendi API request structure showing input\_files, output\_files and ffmpeg\_command](https://storage.rendi.dev/blog/n8n%20ffmpeg%20rendi%20command.png) ## Processing Workflow After submitting a command to Rendi, you have two options to track the processing status: ### Polling Method Use an HTTP Request node configured as GET to Rendi's [poll command endpoint](/docs/api-reference/endpoint/poll-command). Add a Wait node between the command submission and polling to allow sufficient processing time. ![n8n HTTP Request polling Rendi showing storage\_url and file\_id in output](https://storage.rendi.dev/blog/n8n%20ffmpeg%20rendi%20poll%20command.png) ### Webhook Integration Configure a Webhook trigger node in n8n and register that URL in the Rendi dashboard. Rendi will POST the processing results directly to your workflow upon completion. See our [webhooks documentation](/docs/webhooks) for details. ## Working with Output Files The poll response or webhook payload contains: * `storage_url`: Direct link to download the processed file * `file_id`: Identifier for file management operations Use these values to update your data sources or trigger downstream processes. ## File Management To delete temporary files from Rendi storage, use an HTTP Request node configured as DELETE to the [delete file endpoint](/docs/api-reference/endpoint/delete-file). Include the file ID and your API key in the request headers. A successful deletion returns HTTP status 204 with an empty response body. Set the response format to text in n8n to prevent parse errors. ## Best Practices * Use public URLs or signed S3 URLs for reliable file access * Escape curly braces correctly in FFmpeg command strings * Implement appropriate wait times when polling or use webhooks for instant notifications * Store file IDs for cleanup operations to manage storage costs * Reference Rendi's FFmpeg cheat sheet for ready-made command examples ## FAQ ### How do I run FFmpeg in n8n without installing FFmpeg locally? Use Rendi's FFmpeg API by sending an HTTP POST to the [run FFmpeg command endpoint](/docs/api-reference/endpoint/run-ffmpeg-command) from n8n with your input URL, desired output filename, and the FFmpeg command string. Rendi executes FFmpeg on the server side, eliminating the need for local installation. ### What permissions does my input video URL need? The input URL must be publicly accessible for Rendi to download it (accessible in an incognito browser). Alternatively, use an S3 signed URL or any link that temporarily allows anonymous downloads. ### Why are there curly braces in the FFmpeg command and how do I handle them? Rendi uses placeholders like `{{input_0}}` and `{{output_0}}` to map files. Since n8n also treats curly braces as variable indicators, you must escape them inside JSON (with double backslashes) so the placeholders are sent literally to Rendi. ### Should I poll or use webhooks to get results? Use polling for simple, low-frequency jobs or when webhooks are not an option. For immediate responses and scalable workflows, register an n8n webhook in Rendi's dashboard and listen for completion events. ### How do I delete files stored in Rendi? Call the [delete file endpoint](/docs/api-reference/endpoint/delete-file) with the file ID returned by the poll or webhook response. Send your API key in the request headers. A successful deletion returns HTTP 204 with an empty body. ## Further Reading * [Run FFmpeg Command endpoint](/docs/api-reference/endpoint/run-ffmpeg-command) - Rendi API reference * [Poll Command endpoint](/docs/api-reference/endpoint/poll-command) - Rendi API reference * [Delete File endpoint](/docs/api-reference/endpoint/delete-file) - Rendi API reference * [Webhooks](/docs/webhooks) - Rendi documentation * [FFmpeg Cheatsheet](https://github.com/rendi-api/ffmpeg-cheatsheet) - Ready-made FFmpeg commands and filters # Playlist Outputs Source: https://rendi.dev/docs/playlist-outputs Generate HLS or DASH playlist outputs from FFmpeg in Rendi — segmented streaming-ready files. FFmpeg can generate playlist-based streaming formats like HLS and MPEG-DASH, which split media into multiple segment files plus a manifest. Rendi fully supports these outputs—automatically storing all generated files and providing you with a streamable manifest URL. ## Overview When your FFmpeg command outputs a playlist manifest (e.g., `playlist.m3u8` or `manifest.mpd`), Rendi will: * Store all generated playlist files (manifest + segments). * Return back an **accessible URL** for the manifest file. * Allow you to **stream directly** from your Rendi storage using that manifest URL. Alternatively, you can request the output using [**dynamic\_files**](/docs/dynamic-files#dynamic-outputs), which returns a zipped package containing the manifest and all segment files. > **Playlist output files should start with `out_playlist_` prefix** ## Supported Formats Rendi now supports FFmpeg jobs that generate playlist-based outputs. ### HLS (`.m3u8`): #### FFmpeg Command to generate hls playlist This command takes the first 20 secondes of the video, and creates 4 segments, 5 seconds each. Outputs to `playlist.m3u8` manifest file. Notice you must use the `out_playlist_` prefix. ```bash theme={null} ffmpeg -i https://storage.rendi.dev/sample/sample.avi -t 20 -c:v h264 -c:a aac -b:v 2000k -b:a 128k -hls_time 5 -hls_list_size 0 -f hls playlist.m3u8 ``` #### Generate hls playlist using Rendi To run this command in Rendi, you need to use the `/v1/run-ffmpeg-command` endpoint: ```bash theme={null} curl --location 'https://api.rendi.dev/v1/run-ffmpeg-command' \ --header 'X-API-KEY: ' \ --header 'Content-Type: application/json; charset=utf-8' \ --data '{ "input_files": { "in_1": "https://storage.rendi.dev/sample/sample.avi" }, "output_files": { "out_playlist_1": "playlist.m3u8" }, "ffmpeg_command": "-i {{in_1}} -t 20 -c:v h264 -c:a aac -b:v 2000k -b:a 128k -hls_time 5 -hls_list_size 0 -f hls {{out_playlist_1}}" }' ``` ### MPEG-DASH (`.mpd`): #### FFmpeg Command to generate dash playlist This command takes the first 20 secondes of the video, and creates 4 segments, 5 seconds each. Additionally generates two init files. One for video and one for audio. Outputs to `manifest.mpd` manifest file. Notice you must use the `out_playlist_` prefix. ```bash theme={null} ffmpeg -i https://storage.rendi.dev/sample/sample.avi -t 20 -map 0:v -map 0:a -c:v libx264 -b:v 2000k -c:a aac -b:a 128k -use_timeline 1 -use_template 1 -seg_duration 5 -init_seg_name init-$RepresentationID$.mp4 -media_seg_name chunk-stream$RepresentationID$-$Number%05d$.m4s -adaptation_sets \"id=0,streams=v id=1,streams=a\" -f dash manifest.mpd ``` #### Generate dash playlist using Rendi To run this command in Rendi, you need to use the `/v1/run-ffmpeg-command` endpoint: ```bash theme={null} curl --location 'https://api.rendi.dev/v1/run-ffmpeg-command' \ --header 'X-API-KEY: ' \ --header 'Content-Type: application/json; charset=utf-8' \ --data '{ "input_files": { "in_1": "https://storage.rendi.dev/sample/sample.avi" }, "output_files": { "out_playlist_1": "manifest.mpd" }, "ffmpeg_command": "-i {{in_1}} -t 20 -map 0:v -map 0:a -c:v libx264 -b:v 2000k -c:a aac -b:a 128k -use_timeline 1 -use_template 1 -seg_duration 5 -init_seg_name init-$RepresentationID$.mp4 -media_seg_name chunk-stream$RepresentationID$-$Number%05d$.m4s -adaptation_sets \"id=0,streams=v id=1,streams=a\" -f dash {{out_playlist_1}}" }' ``` ## Using your playlist output When commands' `status` reaches `SUCCESS`, you'll get the manifest file in the response: ```json theme={null} { "command_id": "6197c8db-65f5-4e22-aa90-92d79378a336", "status": "SUCCESS", "command_type": "FFMPEG_COMMAND", "total_processing_seconds": 29.8374, "ffmpeg_command_run_seconds": 2.252912998199463, "vcpu_count": 8, "output_files": { "out_1": { "file_id": "4ed6573f-00be-44d0-b14b-928204670375", "storage_url": "https://storage.rendi.dev/files/.../playlist.m3u8", "status": "STORED", "rendi_store_type": "OUTPUT", "is_deleted": false, "size_mbytes": 5.415143966674805, "file_type": "output_manifest", "file_format": "m3u8", "file_count": 5 } }, "original_request": { "input_files": { "in_1": "https://storage.rendi.dev/sample/sample.avi" }, "output_files": { "out_playlist_1": "playlist.m3u8" }, "ffmpeg_command": "-i {{in_1}} -t 20 -c:v h264 -c:a aac -b:v 2000k -b:a 128k -hls_time 5 -hls_list_size 0 -f hls {{out_1}}" } } ``` ##### `size_mbytes` Contains the total size of the complete playlist, including: * The manifest file * All segment/chunk files * Any associated sub-playlists (for multi-bitrate HLS) ##### `file_count` The number of files that compose the full playlist output (e.g., 1 manifest + 4 segments = 5). ## Related Resources * [Run FFmpeg Command](/docs/api-reference/endpoint/run-ffmpeg-command) - API documentation * [Dynamic Files Output](/docs/dynamic-files#dynamic-outputs) - Output your playlist as dynamic output * [Delete Command Files](/docs/api-reference/endpoint/delete-command-files) - Delete your playlists # Private Files & Presigned URLs Source: https://rendi.dev/docs/private-files Store files privately and download them via time-limited presigned URLs. # Private Files By default, files stored in Rendi are served from a public storage domain — the `storage_url` in poll and get responses is directly downloadable by anyone who has the link. For workloads with stricter access requirements, Rendi supports **private storage**: files placed there have no public URL and can only be downloaded via a short-lived presigned URL that you request on demand. > [!NOTE] > > Private storage is not available on trial plans. ## Marking a File as Private Pass `is_private: true` on any endpoint that produces a stored file: * [`POST /v1/run-ffmpeg-command`](/docs/api-reference/endpoint/run-ffmpeg-command) — command's output files land in private storage * [`POST /v1/run-chained-ffmpeg-commands`](/docs/api-reference/endpoint/run-chained-ffmpeg-commands) — same for chained outputs * [`POST /v1/files/store-file`](/docs/api-reference/endpoint/store-file) — the file you're storing lands in private storage * [`POST /v1/files/init-upload`](/docs/api-reference/endpoint/init-upload) — direct upload lands in private storage The file's row reflects this via `is_private: true` in every response that returns it. ## Downloading a Private File The `storage_url` field on a private file is `null` — the file has no public location. To download it, ask the poll endpoint for a **presigned URL**: a signed, time-limited URL that grants read access for a duration you choose. Pass `presigned_ttl_seconds` as a query parameter: * [`GET /v1/files/{file_id}?presigned_ttl_seconds=3600`](/docs/api-reference/endpoint/get-file) * [`GET /v1/commands/{command_id}?presigned_ttl_seconds=3600`](/docs/api-reference/endpoint/poll-command) The response's `storage_url` is replaced with a presigned URL valid for the requested number of seconds. Maximum TTL is 7 days. > [!NOTE] > > If the file is public (or hasn't finished processing yet), the parameter is ignored and the response's `storage_url` is unchanged. ## Reusing Private Files as Command Inputs To use a private file as an input to another `run-ffmpeg-command`, request a presigned URL for it first, then pass that URL in `input_files` as you would any other. Set a `presigned_ttl_seconds` value comfortably larger than your expected queue-wait + processing time so the URL is still valid when the backend downloads it. # Quickstart Source: https://rendi.dev/docs/quick-start Get a Rendi API key and run your first FFmpeg command in under 2 minutes. > [!NOTE] > > Using a coding agent like Claude Code, Cursor, VS Code Copilot, Codex, Grok, or Gemini CLI? Wire up Rendi's MCP server first — see [/coding-agents](/docs/coding-agents). ## Get your free API key > [card] [Register to Rendi, activate your account and get your API key](https://app.rendi.dev/sign-up?loc=doc-quickstart) ## Run a command to generate a gif from the first minute of a video We will want to run the following FFmpeg command: ```bash theme={null} ffmpeg -i https://storage.rendi.dev/sample/sample.avi -vf "select='lte(t,60)*gt(trunc(t/10),trunc(prev_t/10))',setpts='PTS*0.025',scale=trunc(oh*a/2)*2:320:force_original_aspect_ratio=decrease,pad=trunc(oh*a/2)*2:320:-1:-1" -an -fps_mode vfr output1.gif ``` ### Use the same command in Rendi > [tab] Node.js > > ```js theme={null} > const API_KEY = process.env.RENDI_API_KEY; > > const submit = await fetch("https://api.rendi.dev/v1/run-ffmpeg-command", { > method: "POST", > headers: { > "Content-Type": "application/json", > "X-API-KEY": API_KEY, > }, > body: JSON.stringify({ > input_files: { > in_1: "https://storage.rendi.dev/sample/sample.avi", > }, > output_files: { > out_1: "output1.gif", > }, > ffmpeg_command: > "-i {{in_1}} -vf \"select='lte(t,60)*gt(trunc(t/10),trunc(prev_t/10))',setpts='PTS*0.025',scale=trunc(oh*a/2)*2:320:force_original_aspect_ratio=decrease,pad=trunc(oh*a/2)*2:320:-1:-1\" -an -fps_mode vfr {{out_1}}", > }), > }); > const { command_id } = await submit.json(); > console.log("Command ID:", command_id); > ``` > [tab] Python > > ```python theme={null} > import os > import requests > > API_KEY = os.environ["RENDI_API_KEY"] > > submit = requests.post( > "https://api.rendi.dev/v1/run-ffmpeg-command", > headers={"X-API-KEY": API_KEY}, > json={ > "input_files": {"in_1": "https://storage.rendi.dev/sample/sample.avi"}, > "output_files": {"out_1": "output1.gif"}, > "ffmpeg_command": "-i {{in_1}} -vf \"select='lte(t,60)*gt(trunc(t/10),trunc(prev_t/10))',setpts='PTS*0.025',scale=trunc(oh*a/2)*2:320:force_original_aspect_ratio=decrease,pad=trunc(oh*a/2)*2:320:-1:-1\" -an -fps_mode vfr {{out_1}}", > }, > ) > print("Command ID:", submit.json()["command_id"]) > ``` > [tab] cURL > > ```bash theme={null} > curl --location 'https://api.rendi.dev/v1/run-ffmpeg-command' \ > --header 'X-API-KEY: ' \ > --header 'Content-Type: application/json; charset=utf-8' \ > --data '{ > "input_files": { > "in_1": "https://storage.rendi.dev/sample/sample.avi" > }, > "output_files": { > "out_1": "output1.gif" > }, > "ffmpeg_command": "-i {{in_1}} -vf \"select='\''lte(t,60)*gt(trunc(t/10),trunc(prev_t/10))'\'',setpts='\''PTS*0.025'\'',scale=trunc(oh*a/2)*2:320:force_original_aspect_ratio=decrease,pad=trunc(oh*a/2)*2:320:-1:-1\" -an -fps_mode vfr {{out_1}}" > }' > ``` > [!NOTE] > > [Documentation for /run-ffmpeg-command ](/docs/api-reference/endpoint/run-ffmpeg-command) Running this command will return the command\_id: ```json theme={null} { "command_id": "089dd36c-723c-4a0a-b68a-8e8cbcc1afd2" } ``` The command now runs in Rendi and you can check its status: ## Poll the command\_id until it reaches status SUCCESS > [tab] Node.js > > ```js theme={null} > const res = await fetch(`https://api.rendi.dev/v1/commands/${command_id}`, { > headers: { "X-API-KEY": API_KEY }, > }); > const data = await res.json(); > console.log("Status:", data.status); > ``` > [tab] Python > > ```python theme={null} > res = requests.get( > f"https://api.rendi.dev/v1/commands/{command_id}", > headers={"X-API-KEY": API_KEY}, > ).json() > print("Status:", res["status"]) > ``` > [tab] cURL > > ```bash theme={null} > curl --request GET \ > --url https://api.rendi.dev/v1/commands/{command_id} \ > --header 'X-API-KEY: ' > ``` While processing the command will pass from status `QUEUED ` to `PROCESSING` to `SUCCESS` ```json theme={null} { "command_id": "089dd36c-723c-4a0a-b68a-8e8cbcc1afd2", "status": "SUCCESS", "command_type": "FFMPEG_COMMAND", "total_processing_seconds": 8.333879, "ffmpeg_command_run_seconds": 5.734427452087402, "vcpu_count": 8, "output_files": { "out_1": { "file_id": "da09eaa7-904f-45e2-a727-74760b2696f6", "storage_url": "https://storage.rendi.dev/files/bb0e5c57-2721-4cc5-9453-ceeb2fa60e33/089dd36c-723c-4a0a-b68a-8e8cbcc1afd2/output1.gif", "status": "STORED", "rendi_store_type": "OUTPUT", "is_deleted": false, "size_mbytes": 0.3879680633544922, "file_type": "image", "file_format": "gif", "width": 568, "height": 320 } }, "original_request": { "input_files": { "in_1": "https://storage.rendi.dev/sample/sample.avi" }, "output_files": { "out_1": "output1.gif" }, "ffmpeg_command": "-i {{in_1}} -vf \"select='lte(t,60)*gt(trunc(t/10),trunc(prev_t/10))',setpts='PTS*0.025',scale=trunc(oh*a/2)*2:320:force_original_aspect_ratio=decrease,pad=trunc(oh*a/2)*2:320:-1:-1\" -an -fps_mode vfr {{out_1}}" } } ``` When the status reaches `SUCCESS` Rendi will return the stored output file with it. ## Get your output files The result is hosted on Rendi's storage, with a CDN - you can download it and you can serve it as is to your users # Silence Detection and Removal Source: https://rendi.dev/docs/silence-detection-removal Detect and remove silences from audio and video files using FFmpeg in Rendi ## Overview FFmpeg can be used for silence detection and removal in audio and video processing. This guide shows you how to: * Detect silence in media files and export metadata * Remove silence from media files automatically ## Silence Detection with Metadata Export The `silencedetect` filter identifies silent segments in audio based on noise threshold and duration. By combining it with `ametadata`, you can export detailed metadata about when silence occurs in your media files. ### FFmpeg Command for Silence Detection ```bash theme={null} ffmpeg -i https://storage.rendi.dev/sample/popeye_talking.mp4 -af "silencedetect=noise=-20dB:d=0.5,ametadata=mode=print:file=silence_metadata.txt" -f null - ``` #### Command Breakdown: * `-i input.mp4` - Input video or audio file * `-af` - Audio filter * `silencedetect=noise=-20dB:d=0.5` - Detects silence below -20dB lasting at least 0.5 seconds * `noise=-20dB` - Threshold for silence (adjust based on your audio; -20dB is moderate, -30dB is more sensitive) * `d=0.5` - Minimum duration of silence in seconds * `ametadata=mode=print:file=silence_metadata.txt` - Exports metadata to a file * `mode=print` - Prints metadata for each frame * `file=silence_metadata.txt` - Output file for metadata * `-f null -` - No video output (we're only analyzing) ### Run Silence Detection in Rendi To run this command in Rendi, you need to use the `/v1/run-ffmpeg-command` endpoint: ```bash theme={null} curl --location 'https://api.rendi.dev/v1/run-ffmpeg-command' \ --header 'X-API-KEY: ' \ --header 'Content-Type: application/json; charset=utf-8' \ --data '{ "input_files": { "in_1": "https://storage.rendi.dev/sample/popeye_talking.mp4" }, "output_files": { "out_1": "silence_metadata.txt" }, "ffmpeg_command": "-i {{in_1}} -af \"silencedetect=noise=-20dB:d=0.5,ametadata=mode=print:file={{out_1}}\" -f null -" }' ``` When commands' `status` reaches `SUCCESS`, you'll get the metadata file in the response: ```json theme={null} { "command_id": "089dd36c-723c-4a0a-b68a-8e8cbcc1afd2", "status": "SUCCESS", "output_files": { "out_1": { "file_id": "da09eaa7-904f-45e2-a727-74760b2696f6", "storage_url": "https://storage.rendi.dev/files/.../silence_metadata.txt", "status": "STORED" } } } ``` The metadata file will contain timestamps of all detected silence segments, which you can parse for further processing. ## Silence Removal While FFmpeg includes a `silenceremove` filter, the recommended method for removing silence is the **Jump Cuts** technique, which involves a two-step process: **Step 1: Detect Silence and Get Timestamps** First, use `silencedetect` to identify where silence occurs in your video: ```bash theme={null} curl --location 'https://api.rendi.dev/v1/run-ffmpeg-command' \ --header 'X-API-KEY: ' \ --header 'Content-Type: application/json; charset=utf-8' \ --data '{ "input_files": { "in_1": "https://storage.rendi.dev/sample/popeye_talking.mp4" }, "output_files": { "out_1": "silence_metadata.txt" }, "ffmpeg_command": "-i {{in_1}} -af \"silencedetect=noise=-20dB:d=0.5,ametadata=mode=print:file={{out_1}}\" -f null -" }' ``` **Step 2: Parse Timestamps and Create Jump Cuts** Parse the silence timestamps from the metadata file, then use them to create precise jump cuts that completely remove the silent segments. This gives you: * Complete removal of silence (not just audio compression) * Maintained video/audio sync * Precise control over what gets cut * Shorter final video duration #### Example: Running Jump Cuts in Rendi After analyzing the silence metadata, you can create jump cuts to keep only the non-silent portions. For example, to keep segments from 0.0-5.7s, 11.0-18.0s, and 19.0-20.0s: **Base FFmpeg Command:** ```bash theme={null} ffmpeg -i https://storage.rendi.dev/sample/popeye_talking.mp4 -vf "select='between(t,0.0,5.7)+between(t,11.0,18.0)+between(t,19.0,20.0)',setpts=N/FRAME_RATE/TB" -af "aselect='between(t,0.0,5.7)+between(t,11.0,18.0)+between(t,19.0,20.0)',asetpts=N/SR/TB" popeye_jumpcuts.mp4 ``` **Run in Rendi:** ```bash theme={null} curl --location 'https://api.rendi.dev/v1/run-ffmpeg-command' \ --header 'X-API-KEY: ' \ --header 'Content-Type: application/json; charset=utf-8' \ --data '{ "input_files": { "in_1": "https://storage.rendi.dev/sample/popeye_talking.mp4" }, "output_files": { "out_1": "popeye_jumpcuts.mp4" }, "ffmpeg_command": "-i {{in_1}} -vf \"select='\''between(t,0.0,5.7)+between(t,11.0,18.0)+between(t,19.0,20.0)'\'',setpts=N/FRAME_RATE/TB\" -af \"aselect='\''between(t,0.0,5.7)+between(t,11.0,18.0)+between(t,19.0,20.0)'\'',asetpts=N/SR/TB\" {{out_1}}" }' ``` **Command Breakdown:** * `-vf "select='...'"` - Video filter to select specific time ranges * `between(t,0.0,5.7)+between(t,11.0,18.0)+between(t,19.0,20.0)` - Keep frames between these timestamps * `setpts=N/FRAME_RATE/TB` - Reset presentation timestamps for smooth playback * `-af "aselect='...'"` - Same selection applied to audio * `asetpts=N/SR/TB` - Reset audio timestamps to maintain sync For detailed examples of creating jump cuts with specific timestamps, see the [FFmpeg Cheatsheet - Jump Cuts](https://github.com/rendi-api/ffmpeg-cheatsheet?tab=readme-ov-file#jump-cuts) section. > [!TIP] > > This two-step approach is superior to `silenceremove` for video files because it actually cuts out the silent portions entirely, making your videos shorter and more engaging, rather than just modifying the audio track. ## Use Cases **Silence Detection with Metadata:** * Analyze podcast episodes for silence patterns * Quality control for audio recordings * Identify timestamps for manual editing * Generate subtitles timing **Silence Removal:** * Clean up podcast recordings * Speed up video tutorials by removing pauses * Create tighter, more engaging content * Reduce file size by removing dead air ## Tips for Best Results 1. **Test with different thresholds**: Start with `-20dB` and adjust based on your audio quality 2. **Consider minimum duration**: Use `d=0.5` (0.5 seconds) to avoid removing natural pauses in speech 3. **Preview before batch processing**: Test on a small sample first 4. **Use metadata for precision**: Detect silence first, then use timestamps for precise cuts 5. **Quality encoding**: When re-encoding, use `-c:a aac -b:a 128k` for good audio quality ## Related Resources * [FFmpeg Cheatsheet](https://github.com/rendi-api/ffmpeg-cheatsheet) - More audio processing examples * [Run FFmpeg Command](/docs/api-reference/endpoint/run-ffmpeg-command) - API documentation * [Jump Cuts](https://github.com/rendi-api/ffmpeg-cheatsheet#jump-cuts) - Advanced silence cutting techniques # Webhooks Source: https://rendi.dev/docs/webhooks Get notified when a Rendi FFmpeg command completes. # Webhooks Rendi provides webhooks to notify you when FFmpeg command processing is completed, whether successful or failed. This eliminates the need for continuous polling and allows your application to react to processing events asynchronously. > [!NOTE] > > **When to use webhooks vs polling**: use webhooks for jobs expected to run longer than \~30 seconds; [poll](/docs/api-reference/endpoint/poll-command) for shorter ones. ## Setting Up Webhooks In rendi's dashboard, under the "Configuration" tab, you can set your webhook URL. The tab also allows you to test your webhook URL. ## Webhook Payload When the command processing is complete, Rendi will send a POST request to your webhook URL. The payload will have a data field which will be identical to what you would receive from the polling endpoint - containing the complete status of the command execution, and a timestamp of when the webhook was sent - unix epoch time in milliseconds. ### Example Webhook Payload ```json theme={null} { "data": { "command_id": "123e4567-e89b-12d3-a456-426614174000", "status": "SUCCESS", "command_type": "FFMPEG_COMMAND", "vcpu_count": 8, "total_processing_seconds": 8.821761, "ffmpeg_command_run_seconds": 5.606014728546143, "processing_quota_used": 12.5, "metadata": {"key": "value"}, "output_files": { "out_1": { "file_id": "e9cf7551-4c7d-405f-9090-76e74fa90ab9", "size_mbytes": 1.0111198425292969, "duration": 2.74, "file_type": "image", "file_format": "gif", "codec": "gif", "pixel_format": "bgra", "mime_type": "image/gif", "storage_url": "https://storage.rendi.dev/temp_files/583b2877-15b7-48e3-8255-615991a945de/be603edd-5526-477c-98b1-fbf5f98a5a7b/output1.gif", "width": 284, "height": 160 } }, "original_request": { "input_files": { "in_1": "https://storage.rendi.dev/sample/sample.avi" }, "output_files": { "out_1": "output1.gif" }, "ffmpeg_command": "-i {{in_1}} -ss 00:00 -to 01:00 -vf select='lte(n\\,1)+gt(trunc(t/10),trunc(prev_t/10))',setpts='PTS*0.025',scale=trunc(oh*a/2)*2:160:force_original_aspect_ratio=decrease,pad=trunc(oh*a/2)*2:160:-1:-1 -an -fps_mode vfr {{out_1}}" }, }, "timestamp": 1739130741156 } ``` For failed commands, the payload will include error details: ```json theme={null} { "data": { "command_id": "105bc9a0-5021-4c46-8b1f-2652a3277f2e", "error_status": "UNREACHABLE_INPUT_FILE", "error_message": "Failed to download file https://storage.rendi.dev/sample/sample_fail.avi, server returned status code 404", "status": "FAILED", "command_type": "FFMPEG_COMMAND", "original_request": { "input_files": { "in_1": "https://storage.rendi.dev/sample/sample_fail.avi" }, "output_files": { "out_1": "output1.gif" }, "ffmpeg_command": "-i {{in_1}} -ss 00:00 -to 01:00 -vf select='lte(n\\,1)+gt(trunc(t/10),trunc(prev_t/10))',setpts='PTS*0.025',scale=trunc(oh*a/2)*2:160:force_original_aspect_ratio=decrease,pad=trunc(oh*a/2)*2:160:-1:-1 -an -fps_mode vfr {{out_1}}" }, "total_processing_seconds": 3.702893 }, "timestamp": 1739130741156 } ``` ## Webhook Retry Policy Each message is attempted based on the following schedule, where each period is started following the failure of the preceding attempt: * Immediately * 5 seconds * 5 minutes * 30 minutes * 2 hours * 5 hours * 10 hours * 10 hours (in addition to the previous) For example, an attempt that fails three times before eventually succeeding will be delivered roughly 35 minutes and 5 seconds following the first attempt. After all retry attempts are exhausted, the webhook delivery will be marked as failed, and you will need to use the polling endpoint to retrieve the command status. ## Webhook Timeout Your webhook endpoint should respond within 15 seconds. If it takes longer, Rendi will consider the delivery attempt failed and will retry according to the retry policy. ## Disabling failing endpoints If all attempts to a specific endpoint fail for a period of 5 days, the endpoint will be disabled. # Zapier Integration Source: https://rendi.dev/docs/zapier Automate FFmpeg video processing in Zapier workflows using Rendi — no-code integration. # Rendi and Zapier Integration Rendi's integration with Zapier enables seamless automation of video processing workflows by combining Rendi's FFmpeg capabilities with Zapier's powerful automation platform. ## Integration Details You can find our official integration on Zapier's marketplace: [Zapier – Rendi – FFmpeg API](https://zapier.com/apps/rendi/integrations) To establish the integration between Zapier and Rendi: 1. Obtain your API key from the Rendi dashboard 2. Connect your Zapier account to Rendi 3. Use your Rendi API key to authenticate the connection ## Available Actions Rendi provides two native actions within Zapier: 1. **Run FFmpeg Command**: The primary action for triggering video processing tasks. The full documentation for this action can be found in [API reference - run FFmpeg command endpoint](/docs/api-reference/endpoint/run-ffmpeg-command) 2. **Poll FFmpeg Command**: For polling the command for its output. These actions are accessible through Zapier's action search when building your Zaps. ## Handling Curly Brackets `{{}}` Zapier uses curly brackets `{{}}` as special characters for its stored variables. When using these brackets in Rendi FFmpeg commands, you need to escape them with backslashes, like this: `\{\{\}\}`. Here's an example of a configured FFmpeg command in Zapier: ![Zapier Run Command Example](https://mintcdn.com/rendi/1OKYW2ScK83N9NWR/zapier_run_command.png?fit=max\&auto=format\&n=1OKYW2ScK83N9NWR\&q=85\&s=bbfbc5bd96a41c4a6eab1403dd1e93ed) Here's the test output of the Poll Command for the command\_id returned: ![Zapier Poll Command Example](https://mintcdn.com/rendi/1OKYW2ScK83N9NWR/zapier_poll_command.png?fit=max\&auto=format\&n=1OKYW2ScK83N9NWR\&q=85\&s=de63d73026bb0e6a697b889ef837181c) ## Processing Workflow After submitting a command to Rendi, you have two options to track the processing status: 1. **Polling Method**: Monitor the job status using the native Poll Command action which returns the same response as in our [API reference - poll command endpoint](/docs/api-reference/endpoint/poll-command) 2. **Webhook Integration**: Configure webhooks to automatically trigger Zapier workflows upon job completion. See our [webhooks documentation](/docs/webhooks) for details.