protected override void WorkMethod() { m_vp = new VideoProcessor(m_path); m_vp.Progress += new VideoProcessor.ProgressCallback(vp_Progress); m_vp.Transcode(TempFile); if (IsRunning == false && File.Exists(TempFile)) File.Delete(TempFile); }
private void VideoFileButton_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog(this) == DialogResult.OK) { FilePath.Text = openFileDialog1.FileName; Inentifier.Text = String.Empty; Title.Text = String.Empty; Subject.Text = String.Empty; Genre.Text = String.Empty; Producer.Text = String.Empty; Description.Text = String.Empty; Tags.Text = String.Empty; Email.Text = String.Empty; Cue.Text = "0"; string title = Path.GetFileNameWithoutExtension(openFileDialog1.FileName); Match m = Regex.Match(title, @"^(\d+)-(.*)$"); if (m.Success) { Inentifier.Text = m.Groups[1].Value; title = m.Groups[2].Value; Title.Text = title; Inentifier_Validating(this, new CancelEventArgs(false)); } else Title.Text = title; VideoProcessor vp = new VideoProcessor(openFileDialog1.FileName); Length.Text = vp.LengthInSeconds.ToString(); // check if the file is compatible if (vp.VideoFormat != "mpeg2video" || vp.AudioFormat != "mp2" || vp.FrameRate != 29.97 || vp.Height != 480 || vp.Width != 720) TranscodeIndicator.Text = "* NOTE: This file will be transcoded before being queued"; else TranscodeIndicator.Text = String.Empty; videoBitrate = vp.BitRate; audioBitrate = vp.AudioBitRate; } }