Skip to content

.NET Video Editing Code Examples & Tutorials

Video Edit SDK .Net

This page collects ready-to-use C# recipes for the most common editing scenarios using the Video Edit SDK .Net. Every snippet is verified against the SDK source and demos under _SOURCE/_DEMOS/Video Edit SDK/. The recipes below use the Windows-only VideoEditCore engine. Cross-platform code based on VideoEditCoreX follows a similar shape with engine-specific source and effect types.

Available Recipes

Visual Effects & Overlays

Audio Manipulation

Video Composition

iOS

Recipe — Join Multiple Source Files into a Single MP4

VideoSource accepts a filename plus optional start/stop times. To trim a section from a source, pass the start and stop offsets; to use the whole file, pass null. Each call to Input_AddVideoFile appends to the timeline.

using System;
using System.Threading.Tasks;
using VisioForge.Core.Types.VideoEdit;
using VisioForge.Core.VideoEdit;
using VisioForge.Core.Types.Output;

public async Task JoinClipsAsync(string output)
{
    var videoEdit = new VideoEditCore();

    // Output container.
    videoEdit.Output_Filename = output;
    videoEdit.Output_Format = new MP4Output();

    // First clip — first 10 seconds.
    var clip1 = new VideoSource(
        @"intro.mp4",
        TimeSpan.Zero,
        TimeSpan.FromSeconds(10),
        VideoEditStretchMode.Letterbox);
    await videoEdit.Input_AddVideoFileAsync(clip1);

    // Second clip — the whole file appended to the timeline.
    var clip2 = new VideoSource(
        @"content.mp4",
        null,
        null,
        VideoEditStretchMode.Letterbox);
    await videoEdit.Input_AddVideoFileAsync(clip2);

    // Third clip — the whole file appended.
    var clip3 = new VideoSource(
        @"outro.mp4",
        null,
        null,
        VideoEditStretchMode.Letterbox);
    await videoEdit.Input_AddVideoFileAsync(clip3);

    // Run the engine.
    await videoEdit.StartAsync();
}

Recipe — Add an Image Logo Overlay

VideoEffectImageLogo is the legacy image-overlay effect. Create it with a unique effect name (the second constructor argument), assign the image file via Filename, and add it to the engine. Position is controlled by Left/Top (in pixels) when no automatic alignment is used.

using VisioForge.Core.Types.VideoEdit;
using VisioForge.Core.VideoEdit;
using VisioForge.Core.Types.Output;
using VisioForge.Core.Types.VideoEffects;

public async Task AddLogoAsync(string source, string output)
{
    var videoEdit = new VideoEditCore();

    videoEdit.Output_Filename = output;
    videoEdit.Output_Format = new MP4Output();

    var video = new VideoSource(source, null, null, VideoEditStretchMode.Letterbox);
    await videoEdit.Input_AddVideoFileAsync(video);

    // Image logo overlay (PNG with alpha is recommended for transparent logos).
    var logo = new VideoEffectImageLogo(enabled: true, name: "logo1")
    {
        Filename = "logo.png",
        Left = 10,
        Top = 10
    };
    videoEdit.Video_Effects_Add(logo);

    await videoEdit.StartAsync();
}

Recipe — Replace the Source Audio With a Music Track

Add the video file as a video-only source (via targetStreamIndex-aware overloads of Input_AddVideoFile if needed), then add a separate AudioSource for the music track. The AudioSource constructor accepts a filename plus optional start/stop offsets.

using VisioForge.Core.Types.VideoEdit;
using VisioForge.Core.VideoEdit;
using VisioForge.Core.Types.Output;

public async Task ReplaceAudioAsync(string source, string music, string output)
{
    var videoEdit = new VideoEditCore();

    videoEdit.Output_Filename = output;
    videoEdit.Output_Format = new MP4Output();

    // Source video (original audio is ignored by the engine when a separate
    // AudioSource is added; see Input_AddAudioFile overloads to control mixing).
    var video = new VideoSource(source, null, null, VideoEditStretchMode.Letterbox);
    await videoEdit.Input_AddVideoFileAsync(video);

    // Background music — full file.
    var music_src = new AudioSource(music);
    await videoEdit.Input_AddAudioFileAsync(music_src);

    await videoEdit.StartAsync();
}

Additional Resources

Find more extensive code samples and resources on our GitHub repository, where we regularly update our collection with new examples and implementation techniques for .NET developers.