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.

Overlay a logo or image watermark onto a video at a fixed position (corner, center, or custom coordinates).

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

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

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