示例#1
0
 private void Form2_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (this.Point != null && this.Point.Height > 0 && this.Point.Width > 0)
     {
         SaveFileDialog saveFile = new SaveFileDialog()
         {
             Filter = "mp4|*.mp4"
         };
         var j = new DataReceivedEventHandler((a, b) =>
         {
             if (b.Data == null)
             {
                 return;
             }
             if (b.Data.Trim().StartsWith("Duration:"))
             {
                 Regex rr = new Regex("(?<=Duration: ).+(?=, start)");
                 var mm   = rr.Match(b.Data);
                 if (mm.Success)
                 {
                     SetPM((DateTime.Parse("0001-1-1 " + mm.Value) - new DateTime()).TotalSeconds);
                 }
             }
             else if (b.Data.Trim().StartsWith("frame="))
             {
                 Regex rr = new Regex("(?<=time=).+(?= bitrate=)");
                 var mm   = rr.Match(b.Data);
                 if (mm.Success)
                 {
                     SetPV((DateTime.Parse("0001-1-1 " + mm.Value) - new DateTime()).TotalSeconds);
                 }
             }
             else if (b.Data.Trim().StartsWith("[aac @") && !this.form1.button1.Enabled && b.Data.Contains("Qavg:"))
             {
                 SetPV(this.form1.progressBar1.Maximum);
                 BtnEnabled();
             }
         });
         if (saveFile.ShowDialog() == DialogResult.OK)
         {
             this.form1.button1.Enabled = false;
             FFMpegHelper.DeleteLogo(this.form1.Video, saveFile.FileName, this.Point.StartX, this.Point.StartY, this.Point.Width, this.Point.Height
                                     , j
                                     , j);
         }
     }
 }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog open = new OpenFileDialog();

            open.Title  = "选择视频";
            open.Filter = "mp4|*.mp4|flv|*.flv";
            if (open.ShowDialog() == DialogResult.OK)
            {
                var file = open.FileName;
                this.Video = open.FileName;
                if (System.IO.File.Exists("1.jpg"))
                {
                    System.IO.File.Delete("1.jpg");
                }
                FFMpegHelper.Screenshot(file, "1.jpg");

                Form2 form2 = new Form2(this, "1.jpg");
                progressBar1.Value = progressBar1.Minimum;
                form2.Show();
            }
        }