Docs · Add a watermark to a video
Guides · Add a watermark to a video

Add a watermark to a video

Give the video and a PNG logo as inputs, and overlay the logo with filter_complex. Map the filtered picture and the original audio into the output.

The request

Request
curl https://media.logicboostkit.com/ffmpeg/process \
  -H "Authorization: Basic $MEDIA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "task": {
      "inputs": [
        {
          "file_path": "dir_pi23jgy1yxlmigi873bz/source.mp4"
        },
        {
          "file_path": "dir_pi23jgy1yxlmigi873bz/logo.png"
        }
      ],
      "outputs": [
        {
          "file": "watermarked.mp4",
          "maps": [
            "[v]",
            "0:a"
          ],
          "options": [
            "-c:v",
            "libx264",
            "-crf",
            "23",
            "-c:a",
            "copy"
          ]
        }
      ],
      "filter_complex": "[0:v][1:v]overlay=W-w-24:H-h-24[v]"
    }
  }'
Response
HTTP/1.1 200 OK
X-Request-Id: job_0mv6iygbcl43togsnvc4g2wc

{
  "ok": true,
  "result": [
    {
      "file_name": "watermarked.mp4",
      "size_bytes": 713031680,
      "download_url": "https://…"
    }
  ],
  "usage": {
    "time_sec": 58,
    "input_size_gb": 0.68359375,
    "output_size_gb": 0.6640625,
    "gb_sec": 78.1640625
  },
  "request_id": "job_0mv6iygbcl43togsnvc4g2wc",
  "amount_usd": 1.041145313
}

The input is a file you uploaded (POST /file). The full reference is POST /ffmpeg/process.

The options, explained

What each option does
[0:v][1:v]overlay=W-w-24:H-h-24[v]Places the logo (input 1) on the video (input 0), 24 pixels from the bottom-right corner, and labels the result v.
maps [v] and 0:aThe output takes the overlaid picture and the video’s audio.
-c:v libx264 -crf 23The picture changes, so the video is re-encoded.
-c:a copyThe audio is copied as it is.

Variations

Top-left corner

x and y are measured from the top left.

In the task: "filter_complex": "[0:v][1:v]overlay=24:24[v]"

Half transparent

Lower the logo’s alpha before the overlay.

In the task: "filter_complex": "[1:v]format=rgba,colorchannelmixer=aa=0.5[logo];[0:v][logo]overlay=W-w-24:H-h-24[v]"

A smaller logo

Scale the logo before the overlay: 160 pixels wide, proportions kept.

In the task: "filter_complex": "[1:v]scale=160:-1[logo];[0:v][logo]overlay=W-w-24:H-h-24[v]"

What it costs

A logo on a 0.7 GB, 10-minute video: (0.7 GB + 0.67 GB) × 58 s = 79.460 GB-seconds, which is USD 1.0584 at USD 0.01332 per GB-second.

The seconds are an example; every response reports the job’s own. Failed jobs are not charged. See Pricing.