private void btnOpen_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "MP4 文件 (*.mp4)|*.mp4|视频剪辑 (*.avi)|*.avi|MKV 文件 (*.mkv)|*.mkv" + "|Rmvb 文件 (*.rmvb)|*.rmvb|WMV 文件 (*.wmv)|*.wmv|FLV 文件 (*.flv)|*.flv"; if (ofd.ShowDialog() == DialogResult.OK) { txtFileName.Text = ofd.FileName; picThumb.Image = null; long size = new FileInfo(ofd.FileName).Length; string formatSize = FileUtility.GetFileSize(size); labSize.Text = string.Format("大小:{0}", formatSize); string d = FFmpegUtility.GetDuration(ofd.FileName); labTime.Text = string.Format("时长:{0}", d); trackBar.Minimum = 1; trackBar.Maximum = GetDurationInt(d); trackBar.Value = 1; password = ""; int len = trackBar.Maximum > 10 ? 10 : 1; picThumb.Image = FFmpegUtility.GetVideoThumbnail(ofd.FileName, len); } }
private void trackBar_MouseUp(object sender, MouseEventArgs e) { picThumb.Image = null; picThumb.Image = FFmpegUtility.GetVideoThumbnail(txtFileName.Text, trackBar.Value); }