Video capture from a camera with text overlay in C# (video tutorial with code) in Video Capture SDK .Net

Related products
Video Capture SDK .Net

YouTube tutorial - video capture with text overlay

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

using VisioForge.Types.OutputFormat;
using VisioForge.Types.VideoEffects;


namespace SampleCapture
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btStart_Click(object sender, EventArgs e)
        {		    
            videoCapture1.Video_CaptureDevice = videoCapture1.Video_CaptureDevicesInfo[0].Name;
            videoCapture1.Audio_CaptureDevice = videoCapture1.Audio_CaptureDevicesInfo[0].Name;
            videoCapture1.Mode = VisioForge.Types.VFVideoCaptureMode.VideoCapture;
            videoCapture1.Output_Filename = Environment.GetFolderPath(Environment.SpecialFolder.MyVideos) + "\\output.mp4";
            videoCapture1.Output_Format = new VFMP4Output();

            // we are using existing simple code for MP4 capture

            // add text overlay
            videoCapture1.Video_Effects_Enabled = true;
            videoCapture1.Video_Effects_Clear();
            var textOverlay = new VFVideoEffectTextLogo(true) { Text = "Hello World!", Top = 50, Left = 50, FontColor = Color.Red };
            videoCapture1.Video_Effects_Add(textOverlay);

            videoCapture1.Start();
        }

        private void btStop_Click(object sender, EventArgs e)
        {
            videoCapture1.Stop();
        }
    }
}

Required redists

Please contact support to get help with this tutorial. Visit our GitHub page to get more code samples.
abstract 2abstract 1abstract 3
logo
VisioForge © 2006 - 2021