private void btTextLogoAdd_Click(object sender, RoutedEventArgs e) { var dlg = new TextLogoSettingsDialog(); var name = dlg.GenerateNewEffectName(VideoCapture1); var effect = new VideoEffectTextLogo(true, name); VideoCapture1.Video_Effects_Add(effect); Logos.Add(effect.Name); dlg.Fill(effect); dlg.ShowDialog(); dlg.Dispose(); }
private async void btStart_Click(object sender, EventArgs e) { videoCapture1.Video_CaptureDevice = new VideoCaptureSource(videoCapture1.Video_CaptureDevices()[0].Name); videoCapture1.Audio_CaptureDevice = new AudioCaptureSource(videoCapture1.Audio_CaptureDevices()[0].Name); videoCapture1.Mode = VideoCaptureMode.VideoCapture; videoCapture1.Output_Filename = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyVideos), "output.mp4"); videoCapture1.Output_Format = new MP4Output(); // add text overlay videoCapture1.Video_Effects_Enabled = true; videoCapture1.Video_Effects_Clear(); var textOverlay = new VideoEffectTextLogo(true) { Text = "Hello World!", Top = 50, Left = 50, FontColor = Color.Red }; videoCapture1.Video_Effects_Add(textOverlay); await videoCapture1.StartAsync(); }
static void Main(string[] args) { var options = new CommandLineOptions(); if (!CommandLine.Parser.Default.ParseArguments(args, options)) { Console.WriteLine("Press any key to exit..."); Console.ReadKey(); return; } var core = new VideoEditCore(); // resize if (options.Resize != null && options.Resize.Count == 2) { core.Video_Resize = true; core.Video_Resize_Width = Convert.ToInt32(options.Resize[0]); core.Video_Resize_Height = Convert.ToInt32(options.Resize[1]); } // add source files AddSources(options.InputFile1, core); if (options.InputFile2 != null) { AddSources(options.InputFile2, core); } if (options.InputFile3 != null) { AddSources(options.InputFile3, core); } if (options.InputFile4 != null) { AddSources(options.InputFile4, core); } if (string.IsNullOrEmpty(options.Format)) { options.Format = "mp4"; } switch (options.Format) { case "mp4": core.Output_Format = new MP4HWOutput(); break; case "avi": core.Output_Format = new AVIOutput(); break; case "wmv": core.Output_Format = new WMVOutput(); break; case "webm": core.Output_Format = new WebMOutput(); break; default: Console.WriteLine("Wrong output format. MP4 will be used."); core.Output_Format = new MP4HWOutput(); break; } core.Video_Renderer.VideoRenderer = VideoRendererMode.None; //Text overlay if (!string.IsNullOrEmpty(options.TextOverlay)) { core.Video_Effects_Enabled = true; var textOverlay = new VideoEffectTextLogo(true); textOverlay.Text = options.TextOverlay; core.Video_Effects_Add(textOverlay); } //Image overlay if (!string.IsNullOrEmpty(options.ImageOverlay)) { core.Video_Effects_Enabled = true; var imageLogo = new VideoEffectImageLogo(true) { Filename = options.ImageOverlay, Left = 30, Top = 30 }; core.Video_Effects_Add(imageLogo); } core.Output_Filename = options.OutputFile; //Event Handlers core.OnProgress += (sender, e) => { Console.Out.WriteLine("Video Encoding Status : " + e.Progress); }; core.OnStop += (sender, e) => { Console.Out.WriteLine("Done. Please press any key."); }; core.OnError += (sender, e) => { Console.Out.WriteLine("Error: " + e.Message + "\n" + e.StackTrace + "\n" + e.CallSite); }; //File Tags if (options.Tags) { core.Tags = new MediaFileTags() { Title = "Test Title", Performers = new string[] { }, Album = "test", Comment = "test", Track = 0, Copyright = string.Empty, Year = 2017, Composers = new string[] { }, Genres = new string[] { }, Lyrics = string.Empty }; } Console.Out.WriteLine("# Video Encoding Starting #"); core.ConsoleUsage = true; core.Start(); Console.ReadKey(); }