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.
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": [
{
"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
}
}
]
Here’s how he parameters break down:
"opacity": 1
- this is the opacity of the overlaid image where
1
is 100% and0
is 0%; 50% would be0.5
- this is the opacity of the overlaid image where
"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
- fade in from 0% opacity to 100% opacity over the course of 1 second, beginning at the
"duration_sec": 5
- show the image on-screen for 5 seconds. This parameter is inclusive of
fadein_duration_sec
andfadeout_duration_sec
. Fades do not extend the duration
- show the image on-screen for 5 seconds. This parameter is inclusive of
"fadeout_duration_sec": 1
- fade out from
full
opacity to0%
over the course of 1 second
- fade out from
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
}
}
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_overlay
s
It is possible to combine multiple image_overlay
filters in the same Hybrik job. See the example job linked below for the entire workflow.