How can I add an image overlay?
Product: Video Edit SDK .Net. Engine: VideoEditCoreX (Cross-platform).
SDK allows for the addition of an image overlay to the video, which allows you to set the image file, position, and other properties.
Supported image formats
The SDK supports the following image formats: BMP, GIF, JPEG, PNG, and TIFF.
Sample code
The sample code shows how to add an image overlay to the video with a defined position.
// add video source from the MP4 video file
var videoSource = new VideoFileSource("video.mp4", TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(15));
// add an image overlay to a video source effects from PNG file
var imageOverlay = new ImageOverlayVideoEffect("logo.png");
// set position
imageOverlay.X = 50;
imageOverlay.Y = 50;
// set alpha
imageOverlay.Alpha = 0.5;
// set start time and stop time
imageOverlay.StartTime = TimeSpan.FromSeconds(0);
imageOverlay.StopTime = TimeSpan.FromSeconds(5);
// add video source to timeline
_videoEdit.Input_AddVideoFile(videoSource, TimeSpan.FromSeconds(0));
Visit our GitHub page to get more code samples.