Skip to main content

Image Overlay

Hybrik can overlay an image into your target video. This can be done to apply a "bug" to an entire video or to apply a visual watermark over a piece of content.

dolby_top_left

Usage

You can read the full documentation for the image_overlay filter in our API Docs; this tutorial will walk through a couple of examples.

The image_overlay filter can be applied to individual targets within a transcode task, or it can be enabled in the source_pipeline so that it applies to multiple targets.

Let's look at an example of the filter. You'll notice that the image path is provided directly in the filter; you do not need to supply the image in the source of your job. The image at the top of this page was generated with these settings:

"filters": [ {% raw %}
{
"kind": "image_overlay",
"payload": {
"image_file": {
"storage_provider": "s3",
"url": "s3://my_bucket/my_image.png"
},
"opacity": 1,
"x": 0,
"y": 0,
"height": "video_h/4",
"start_sec": 10,
"fadein_duration_sec": 1,
"duration_sec": 5,
"fadeout_duration_sec": 1
}
}
] {% endraw %}

Here's how he parameters break down:

  • "opacity": 1
    • this is the opacity of the overlaid image where 1 is 100% and 0 is 0%; 50% would be 0.5
  • "x": 0
    • align the overlay to the left-most pixel of the video frame
  • "y": 0
    • align the overlay to the top-most pixel of the video frame
  • "height": "video_h/4"
    • scale the image's height to 25% of the video frame's height
  • "start_sec": 10
    • start displaying the overlay 10 seconds into the video
  • "fadein_duration_sec": 1
    • fade in from 0% opacity to 100% opacity over the course of 1 second, beginning at the start_sec
  • "duration_sec": 5
    • show the image on-screen for 5 seconds. This parameter is inclusive of fadein_duration_sec and fadeout_duration_sec. Fades do not extend the duration
  • "fadeout_duration_sec": 1
    • fade out from full opacity to 0% over the course of 1 second

Centered Image

Let's look at a second example where we center the image:

{
"kind": "image_overlay",
"payload": {
"image_file": {
"storage_provider": "s3",
"url": "s3://my_bucket/my_image.png"
},
"opacity": 0.75,
"x": "(video_w-overlay_w)/2",
"y": "(video_h-overlay_h)/2",
"height": "video_h/3",
"start_sec": 25,
"fadein_duration_sec": 1,
"duration_sec": 5,
"fadeout_duration_sec": 1
}
}

center_overlay

The parameters are nearly the same as our first example but we are using some FFMPEG-style positioning. The x and y parameters will center the image and the height parameter scales the image's height to 1/3 of the video's height. The opacity is set to 75% so that the image is not fully opaque.

Multiple image_overlays

It is possible to combine multiple image_overlay filters in the same Hybrik job. See the example job linked below for the entire workflow.

Example