Esempio n. 1
0
        private void cbImageLogo_CheckedChanged(object sender, RoutedEventArgs e)
        {
            IVFVideoEffectImageLogo imageLogo;
            var effect = VideoCapture1.Video_Effects_Get("ImageLogo");

            if (effect == null)
            {
                imageLogo = new VFVideoEffectImageLogo(cbImageLogo.IsChecked == true);
                VideoCapture1.Video_Effects_Add(imageLogo);
            }
            else
            {
                imageLogo = effect as IVFVideoEffectImageLogo;
            }

            if (imageLogo == null)
            {
                System.Windows.MessageBox.Show("Unable to configure image logo effect.");
                return;
            }

            imageLogo.Enabled           = cbImageLogo.IsChecked == true;
            imageLogo.Filename          = edImageLogoFilename.Text;
            imageLogo.Left              = Convert.ToUInt32(edImageLogoLeft.Text);
            imageLogo.Top               = Convert.ToUInt32(edImageLogoTop.Text);
            imageLogo.TransparencyLevel = (int)tbImageLogoTransp.Value;
            imageLogo.AnimationEnabled  = true;
        }
Esempio n. 2
0
        private void btImageLogoAdd_Click(object sender, EventArgs e)
        {
            var dlg = new ImageLogoSettingsDialog();

            var name   = dlg.GenerateNewEffectName(VideoCapture1);
            var effect = new VFVideoEffectImageLogo(true, name);

            VideoCapture1.Video_Effects_Add(effect);
            lbLogos.Items.Add(effect.Name);

            dlg.Fill(effect);
            dlg.ShowDialog(this);
            dlg.Dispose();
        }
Esempio n. 3
0
        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 VFMP4Output();
                break;

            case "avi":
                core.Output_Format = new VFAVIOutput();
                break;

            case "wmv":
                core.Output_Format = new VFWMVOutput();
                break;

            case "webm":
                core.Output_Format = new VFWebMOutput();
                break;

            default:
                Console.WriteLine("Wrong output format. MP4 will be used.");
                core.Output_Format = new VFMP4Output();
                break;
            }

            core.Video_Renderer.VideoRendererInternal = VFVideoRendererInternal.None;

            //Text overlay
            if (!string.IsNullOrEmpty(options.TextOverlay))
            {
                core.Video_Effects_Enabled = true;

                var textOverlay = new VFVideoEffectTextLogo(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 VFVideoEffectImageLogo(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 VFFileTags()
                {
                    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();
        }