Skip to main content

Documentation Index

Fetch the complete documentation index at: https://rendi.dev/docs/llms.txt

Use this file to discover all available pages before exploring further.

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

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));
}

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 (ultrafastveryslow)
  • -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

{
  "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"
}