Пример #1
0
        private void cbTextLogo_CheckedChanged(object sender, EventArgs e)
        {
            IVFVideoEffectTextLogo textLogo;
            var effect = VideoEdit1.Video_Effects_Get("TextLogo");

            if (effect == null)
            {
                textLogo = new VFVideoEffectTextLogo(cbTextLogo.Checked);
                VideoEdit1.Video_Effects_Add(textLogo);
            }
            else
            {
                textLogo = effect as IVFVideoEffectTextLogo;
            }

            if (textLogo == null)
            {
                MessageBox.Show("Unable to configure text logo effect.");
                return;
            }

            textLogo.Enabled   = cbTextLogo.Checked;
            textLogo.Text      = edTextLogo.Text;
            textLogo.Left      = Convert.ToInt32(edTextLogoLeft.Text);
            textLogo.Top       = Convert.ToInt32(edTextLogoTop.Text);
            textLogo.Font      = fontDialog1.Font;
            textLogo.FontColor = fontDialog1.Color;

            textLogo.TransparencyLevel = tbTextLogoTransp.Value;

            textLogo.Update();
        }
Пример #2
0
        private void btTextLogoAdd_Click(object sender, EventArgs e)
        {
            var dlg = new TextLogoSettingsDialog();

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

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

            dlg.ShowDialog(this);
            dlg.Dispose();
        }
Пример #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();
        }
Пример #4
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            string name          = textBox_name_save.Text;
            string partia        = textBox_partia_save.Text;
            string control_date  = data.ToString("dd-MM-yyyy hh:mm:ss");
            string user_name     = textBox_user_name_save.Text;
            string quantity      = textBox_quantity_save.Text;
            string data_sales    = textBox_data_sales_save.Text;   //numer kartonu
            string file_location = Environment.GetFolderPath(Environment.SpecialFolder.MyVideos) + "\\" + name + "_" + partia + ".mp4";

            videoCapture1.Video_CaptureDevice = videoCapture1.Video_CaptureDevicesInfo[0].Name;
            videoCapture1.Audio_CaptureDevice = videoCapture1.Audio_CaptureDevicesInfo[0].Name;
            videoCapture1.IP_Camera_Source    = new VisioForge.Types.Sources.IPCameraSourceSettings()
            {
                URL = "http://192.168.43.1:8080/video"
            };
            videoCapture1.Audio_PlayAudio = videoCapture1.Audio_RecordAudio = false;
            videoCapture1.Output_Filename = Environment.GetFolderPath(Environment.SpecialFolder.MyVideos) + "\\" + name + "_" + partia + ".mp4";
            videoCapture1.Output_Format   = new VFMP4v8v10Output(); //using MP4 output with default settings



            // we using existing simple code for MP4 capture

            // add text overlay
            videoCapture1.Video_Effects_Enabled = true;
            videoCapture1.Video_Effects_Clear();
            var text_name = new VFVideoEffectTextLogo(true)
            {
                Text = name, Top = 50, Left = 50, FontColor = Color.Red
            };
            var text_partia = new VFVideoEffectTextLogo(true)
            {
                Text = partia, Top = 100, Left = 50, FontColor = Color.Red
            };
            var text_control_date = new VFVideoEffectTextLogo(true)
            {
                Text = control_date, Top = 150, Left = 50, FontColor = Color.Red
            };
            var text_user_name = new VFVideoEffectTextLogo(true)
            {
                Text = user_name, Top = 200, Left = 50, FontColor = Color.Red
            };
            var text_quantity = new VFVideoEffectTextLogo(true)
            {
                Text = quantity, Top = 250, Left = 50, FontColor = Color.Red
            };
            var text_data_sales = new VFVideoEffectTextLogo(true)
            {
                Text = data_sales, Top = 300, Left = 50, FontColor = Color.Red
            };

            videoCapture1.Video_Effects_Add(text_name);
            videoCapture1.Video_Effects_Add(text_partia);
            videoCapture1.Video_Effects_Add(text_control_date);
            videoCapture1.Video_Effects_Add(text_user_name);
            videoCapture1.Video_Effects_Add(text_quantity);
            videoCapture1.Video_Effects_Add(text_data_sales);
            videoCapture1.Mode = VisioForge.Types.VFVideoCaptureMode.IPCapture;
            //save_database(name, partia, control_date, user_name, quantity, partia, file_location, data_sales);
            videoCapture1.Start();
        }