Пример #1
0
        public bool GetVideoThumbnail(VideoFile input, string saveThumbnailTo, string tamanho, int secs)
        {
            if (!input.infoGathered)
            {
                GetVideoInfo(input);
            }

            //divide the duration in 3 to get a preview image in the middle of the clip
            //instead of a black image from the beginning.
            //secs = (int)Math.Round(TimeSpan.FromTicks(input.Duration.Ticks / 3).TotalSeconds, 0);
            //if (secs.Equals(0)) secs = 1;

            string Params = string.Format("-i \"{0}\" -s 1024x768 -vcodec mjpeg -ss {2} -vframes 1 -an -f image2 \"{1}\"", input.Path, saveThumbnailTo, secs, tamanho);
            string output = RunProcess(Params);

            if (File.Exists(saveThumbnailTo))
            {
                return true;
            }
            else
            {
                //try running again at frame 1 to get something
                Params = string.Format("-i \"{0}\" -s 1024x768 -vcodec mjpeg -ss {2} -vframes 1 -an -f image2 \"{1}\"", input.Path, saveThumbnailTo, 1, tamanho);
                output = RunProcess(Params);

                if (File.Exists(saveThumbnailTo))
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
        }
Пример #2
0
        public static string getMediaInfo(string mediaName)
        {
            /**
              * 支持视频格式:mpeg,mpg,avi,dat,mkv,rmvb,rm,mov.
              *不支持:wmv
              * **/

            VideoEncoder.Encoder enc = new VideoEncoder.Encoder();
            //ffmpeg.exe的路径,程序会在执行目录(....FFmpeg测试\bin\Debug)下找此文件,
            enc.FFmpegPath = System.Environment.CurrentDirectory + "\\ffmpeg.exe";
            //视频路径
            VideoFile videoFile = new VideoFile(mediaName);

            enc.GetVideoInfo(videoFile);

            TimeSpan totaotp = videoFile.Duration;
            string totalTime = string.Format("{0:00}:{1:00}:{2:00}", (int)totaotp.TotalHours, totaotp.Minutes, totaotp.Seconds);

            Console.WriteLine("时间长度:{0}", totalTime);
            Console.WriteLine("高度:{0}", videoFile.Height);
            Console.WriteLine("宽度:{0}", videoFile.Width);
            Console.WriteLine("数据速率:{0}", videoFile.VideoBitRate);
            Console.WriteLine("数据格式:{0}", videoFile.VideoFormat);
            Console.WriteLine("比特率:{0}", videoFile.BitRate);
            Console.WriteLine("文件路径:{0}", videoFile.Path);

            return totalTime;
 
        }
Пример #3
0
        public EncodedVideo EncodeVideo(VideoFile input, string encodingCommand, string outputFile, bool getVideoThumbnail)
        {
            EncodedVideo encoded = new EncodedVideo();

            Params = string.Format("-i \"{0}\" {1} \"{2}\"", input.Path, encodingCommand, outputFile);
            string output = RunProcess(Params);
            encoded.EncodingLog = output;
            encoded.EncodedVideoPath = outputFile;
            
            if (File.Exists(outputFile))
            {
                encoded.Success = true;

                //get thumbnail?
                if (getVideoThumbnail)
                {
                    string saveThumbnailTo = outputFile + "_thumb.jpg";

                    if (GetVideoThumbnail(input, saveThumbnailTo))
                    {
                        encoded.ThumbnailPath = saveThumbnailTo;
                    }
                }
            }
            else
            {
                encoded.Success = false;
            }

            return encoded;
        }
Пример #4
0
 public TimeSpan GetVideoTotalTime(string videoPath)
 {
     Encoder encoder = new Encoder {
         FFmpegPath = AppDomain.CurrentDomain.BaseDirectory + this.ffmpegTools
     };
     string path = videoPath;
     VideoFile input = new VideoFile(path);
     encoder.GetVideoInfo(input);
     return input.Duration;
 }
Пример #5
0
 public void GetVideoInfo(VideoFile input)
 {
     string Params = string.Format("-i {0}", input.Path);
     string output = RunProcess(Params);
     input.RawInfo = output;
     input.Duration = ExtractDuration(input.RawInfo);
     input.BitRate = ExtractBitrate(input.RawInfo);
     input.RawAudioFormat = ExtractRawAudioFormat(input.RawInfo);
     input.AudioFormat = ExtractAudioFormat(input.RawAudioFormat);
     input.RawVideoFormat = ExtractRawVideoFormat(input.RawInfo);
     input.VideoFormat = ExtractVideoFormat(input.RawVideoFormat);
     input.Width = ExtractVideoWidth(input.RawInfo);
     input.Height = ExtractVideoHeight(input.RawInfo);
     input.infoGathered = true;
 }
Пример #6
0
        public void GetVideoInfo(VideoFile input)
        {
            string Params = string.Format("-i \"{0}\"", input.Path);
            string output = RunProcess(Params);

            input.RawInfo        = output;
            input.Duration       = ExtractDuration(input.RawInfo);
            input.BitRate        = ExtractBitrate(input.RawInfo);
            input.RawAudioFormat = ExtractRawAudioFormat(input.RawInfo);
            input.AudioFormat    = ExtractAudioFormat(input.RawAudioFormat);
            input.RawVideoFormat = ExtractRawVideoFormat(input.RawInfo);
            input.VideoFormat    = ExtractVideoFormat(input.RawVideoFormat);
            input.Width          = ExtractVideoWidth(input.RawInfo);
            input.Height         = ExtractVideoHeight(input.RawInfo);
            input.FrameRate      = ExtractFrameRate(input.RawVideoFormat);
            input.TotalFrames    = ExtractTotalFrames(input.Duration, input.FrameRate);
            input.AudioBitRate   = ExtractAudioBitRate(input.RawAudioFormat);
            input.VideoBitRate   = ExtractVideoBitRate(input.RawVideoFormat);

            input.infoGathered = true;
        }
Пример #7
0
        public bool GetVideoThumbnail(VideoFile input, string saveThumbnailTo)
        {
            if (!input.infoGathered)
            {
                GetVideoInfo(input);
            }

            //divide the duration in 3 to get a preview image in the middle of the clip
            //instead of a black image from the beginning.
            int secs;

            secs = (int)Math.Round(TimeSpan.FromTicks(input.Duration.Ticks / 3).TotalSeconds, 0);
            if (secs.Equals(0))
            {
                secs = 1;
            }

            string Params = string.Format("-i \"{0}\" \"{1}\" -vcodec mjpeg -ss {2} -vframes 1 -an -f rawvideo", input.Path, saveThumbnailTo, secs);
            string output = RunProcess(Params);

            if (File.Exists(saveThumbnailTo))
            {
                return(true);
            }
            else
            {
                //try running again at frame 1 to get something
                Params = string.Format("-i \"{0}\" \"{1}\" -vcodec mjpeg -ss {2} -vframes 1 -an -f rawvideo", input.Path, saveThumbnailTo, 1);
                output = RunProcess(Params);

                if (File.Exists(saveThumbnailTo))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Пример #8
0
        public bool GetVideoThumbnail(VideoFile input, string saveThumbnailTo)
        {
            if (!input.infoGathered)
            {
                GetVideoInfo(input);
            }
            int    num        = (int)Math.Round(TimeSpan.FromTicks(input.Duration.Ticks / 3).TotalSeconds, 0);
            string parameters = $"-i {input.File} {saveThumbnailTo} -vcodec mjpeg -ss {num} -vframes 1 -an -f rawvideo";
            string text       = RunProcess(parameters);

            if (File.Exists(saveThumbnailTo))
            {
                return(true);
            }
            parameters = $"-i {input.File} {saveThumbnailTo} -vcodec mjpeg -ss {1} -vframes 1 -an -f rawvideo";
            text       = RunProcess(parameters);
            if (File.Exists(saveThumbnailTo))
            {
                return(true);
            }
            return(false);
        }
Пример #9
0
        public bool GetVideoThumbnail(VideoFile input, string saveThumbnailTo)
        {
            if (!input.infoGathered)
            {
                GetVideoInfo(input);
            }


            int secs;

            secs = (int)Math.Round(TimeSpan.FromTicks(input.Duration.Ticks / 3).TotalSeconds, 0);
            if (secs.Equals(0))
            {
                secs = 1;
            }

            string Params = string.Format("-i \"{0}\" \"{1}\" -vcodec mjpeg -ss {2} -vframes 1 -an -f rawvideo", input.Path, saveThumbnailTo, secs);
            string output = RunProcess(Params);

            if (File.Exists(saveThumbnailTo))
            {
                return(true);
            }
            else
            {
                Params = string.Format("-i \"{0}\" \"{1}\" -vcodec mjpeg -ss {2} -vframes 1 -an -f rawvideo", input.Path, saveThumbnailTo, 1);
                output = RunProcess(Params);

                if (File.Exists(saveThumbnailTo))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Пример #10
0
 public EncodedVideo EncodeVideo(VideoFile input, string encodingCommand, string outputFile, bool getVideoThumbnail)
 {
     EncodedVideo video = new EncodedVideo();
     this.Params = string.Format("-i \"{0}\" {1} \"{2}\"", input.Path, encodingCommand, outputFile);
     string str = this.RunProcess(this.Params);
     video.EncodingLog = str;
     video.EncodedVideoPath = outputFile;
     if (File.Exists(outputFile))
     {
         video.Success = true;
         if (getVideoThumbnail)
         {
             string saveThumbnailTo = outputFile + "_thumb.jpg";
             if (this.GetVideoThumbnail(input, saveThumbnailTo))
             {
                 video.ThumbnailPath = saveThumbnailTo;
             }
         }
         return video;
     }
     video.Success = false;
     return video;
 }
Пример #11
0
 public bool GetVideoThumbnail(VideoFile input, string saveThumbnailTo)
 {
     if (!input.infoGathered)
     {
         this.GetVideoInfo(input);
     }
     int num = (int) Math.Round(TimeSpan.FromTicks(input.Duration.Ticks / 3L).TotalSeconds, 0);
     if (num.Equals(0))
     {
         num = 1;
     }
     string parameters = string.Format("-i \"{0}\" \"{1}\" -vcodec mjpeg -ss {2} -vframes 1 -an -f rawvideo", input.Path, saveThumbnailTo, num);
     this.RunProcess(parameters);
     if (File.Exists(saveThumbnailTo))
     {
         return true;
     }
     parameters = string.Format("-i \"{0}\" \"{1}\" -vcodec mjpeg -ss {2} -vframes 1 -an -f rawvideo", input.Path, saveThumbnailTo, 1);
     this.RunProcess(parameters);
     return File.Exists(saveThumbnailTo);
 }
Пример #12
0
 public void GetVideoInfo(VideoFile input)
 {
     string parameters = string.Format("-i \"{0}\"", input.Path);
     string str2 = this.RunProcess(parameters);
     input.RawInfo = str2;
     input.Duration = this.ExtractDuration(input.RawInfo);
     input.BitRate = this.ExtractBitrate(input.RawInfo);
     input.RawAudioFormat = this.ExtractRawAudioFormat(input.RawInfo);
     input.AudioFormat = this.ExtractAudioFormat(input.RawAudioFormat);
     input.RawVideoFormat = this.ExtractRawVideoFormat(input.RawInfo);
     input.VideoFormat = this.ExtractVideoFormat(input.RawVideoFormat);
     input.Width = this.ExtractVideoWidth(input.RawInfo);
     input.Height = this.ExtractVideoHeight(input.RawInfo);
     input.FrameRate = this.ExtractFrameRate(input.RawVideoFormat);
     input.TotalFrames = this.ExtractTotalFrames(input.Duration, input.FrameRate);
     input.AudioBitRate = this.ExtractAudioBitRate(input.RawAudioFormat);
     input.VideoBitRate = this.ExtractVideoBitRate(input.RawVideoFormat);
     input.infoGathered = true;
 }
Пример #13
0
 public void EncodeVideoAsyncAutoCommand(VideoFile input, string outputFile, Control caller, int treadCount)
 {
     if (!input.infoGathered)
     {
         this.GetVideoInfo(input);
     }
     if (input.VideoBitRate == 0.0)
     {
         int height = input.Height;
         if (height < 180)
         {
             input.VideoBitRate = 400.0;
         }
         else if (height < 260)
         {
             input.VideoBitRate = 1000.0;
         }
         else if (height < 400)
         {
             input.VideoBitRate = 2000.0;
         }
         else if (height < 800)
         {
             input.VideoBitRate = 5000.0;
         }
         else
         {
             input.VideoBitRate = 8000.0;
         }
     }
     if (input.AudioBitRate == 0.0)
     {
         input.AudioBitRate = 128.0;
     }
     string str = string.Format("-threads {0} -y -b {1} -ab {2}", treadCount.ToString(), input.VideoBitRate.ToString() + "k", input.AudioBitRate.ToString() + "k");
     this.tempEncodedVideo = new EncodedVideo();
     this.tempEncodedVideo.EncodedVideoPath = outputFile;
     this.tempCaller = caller;
     this.tempVideoFile = input;
     this.Params = string.Format("-i \"{0}\" {1} \"{2}\"", input.Path, str, outputFile);
     this.RunProcessAsync(this.Params);
 }
Пример #14
0
 public void EncodeVideoAsyncAutoCommand(VideoFile input, string outputFile, int threadCount)
 {
     this.EncodeVideoAsyncAutoCommand(input, outputFile, null, threadCount);
 }
Пример #15
0
 public void EncodeVideoAsync(VideoFile input, string encodingCommand, string outputFile, Control caller, int threadCount)
 {
     if (!input.infoGathered)
     {
         this.GetVideoInfo(input);
     }
     this.tempEncodedVideo = new EncodedVideo();
     this.tempEncodedVideo.EncodedVideoPath = outputFile;
     this.tempCaller = caller;
     this.tempVideoFile = input;
     if (threadCount.Equals(1))
     {
         this.Params = string.Format("-i \"{0}\" {1} \"{2}\"", input.Path, encodingCommand, outputFile);
     }
     else
     {
         this.Params = string.Format("-i \"{0}\" -threads {1} {2} \"{3}\"", new object[] { input.Path, threadCount.ToString(), encodingCommand, outputFile });
     }
     this.RunProcessAsync(this.Params);
 }
Пример #16
0
 public void EncodeVideoAsync(VideoFile input, string encodingCommand, string outputFile, int threadCount)
 {
     this.EncodeVideoAsync(input, encodingCommand, outputFile, null, threadCount);
 }
Пример #17
0
        private void VideoSplitByTime()
        {
            int time = Int32.Parse(boxPartHour.Text) * 3600
                + Int32.Parse(boxPartMin.Text) * 60
                + Int32.Parse(boxPartSec.Text);
            VideoEncoder.Encoder enc = new VideoEncoder.Encoder();
            enc.FFmpegPath = "ffmpeg.exe";
            VideoFile vf = new VideoFile(file);
            enc.GetVideoInfo(vf);
            TimeSpan t = vf.Duration;
            //int tt =(int)t.TotalSeconds;
            int parts = (int)t.TotalSeconds / time + 1;

            #region thread start

            //EnableUI(false);
            new Thread(() =>
            {
                for (int i = 0; i < parts; i++)
                {
                    Process p = new Process();
                    string ph = Environment.CommandLine;
                    ph = ph.Substring(0, ph.LastIndexOf('\\') + 1);
                    if (ph[0] == '"')
                        ph = ph.Substring(1);
                    p.StartInfo.FileName = "\"" + ph + "ffmpeg.exe\"";
                    p.StartInfo.Arguments = " -ss " + (i == 0 ? 0 : time * i - 10).ToString()
                        + " -i " + "\"" + file + "\""
                        + " -vcodec copy -acodec copy "
                        + " -t " + (i == 0 ? time : (time + 10)).ToString() + " "
                        + "\"" + path + (i + 1).ToString("00") + formate + "\"";
                    p.StartInfo.RedirectStandardError = true;
                    p.ErrorDataReceived += new DataReceivedEventHandler(SplitOutput);
                    p.StartInfo.UseShellExecute = false;
                    p.StartInfo.CreateNoWindow = true;
                    p.Start();
                    p.BeginErrorReadLine();
                    p.WaitForExit();
                    p.Close();
                    p.Dispose();

                }

                this.BeginInvoke(new MethodInvoker(() =>
                {
                    EnableUI(true);
                    //this.Text = title + " - 分割完成!";
                }));
            }).Start();
            #endregion
        }
Пример #18
0
 public void EncodeVideoAsync(VideoFile input, string encodingCommand, string outputFile, int threadCount)
 {
     EncodeVideoAsync(input, encodingCommand, outputFile, null, threadCount);
 }
Пример #19
0
        private void buttonSplit_Click(object sender, EventArgs e)
        {
            if (!textFlv.Text.EndsWith(".flv"))
            {
                MessageBox.Show("It's not flv file!", "not flv", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (!File.Exists(textFlv.Text))
            {
                MessageBox.Show("flv file does not exist!", "no such file.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            EnableUI(false);
            this.Text = title + " - 正在分割...";
            textStat.Clear();
            int parts = int.Parse(comboBoxPart.Text);
            int seconds = 0;
            if (parser != null)
            {
                seconds = (int)(parser.Duration / 1000) / parts + 10;
            }
            else
            {
                VideoEncoder.Encoder enc = new VideoEncoder.Encoder();
                enc.FFmpegPath = "ffmpeg.exe";
                VideoFile vf = new VideoFile(textFlv.Text);
                enc.GetVideoInfo(vf);
                TimeSpan t = vf.Duration;
                //int tt =(int)t.TotalSeconds;
                seconds = (int)t.TotalSeconds / parts + 10;
            }
            new Thread(() =>
            {
                for (int i = 0; i < parts; i++)
                {
                    Process p = new Process();
                    string ph = Environment.CommandLine;
                    ph = ph.Substring(0, ph.LastIndexOf('\\') + 1);
                    if (ph[0] == '"')
                        ph = ph.Substring(1);
                    p.StartInfo.FileName = "\"" + ph + "ffmpeg.exe\"";
                    p.StartInfo.Arguments = " -ss " + (i == 0 ? 0 : seconds * i - 10).ToString()
                        + " -i " + textFlv.Text
                        + " -vcodec copy -acodec copy "
                        + " -t " + (i == 0 ? seconds : (seconds + 10)).ToString() + " "
                        + textFlv.Text.Substring(0, textFlv.Text.LastIndexOf(".")) + (i + 1).ToString("00") + ".flv";
                    p.StartInfo.RedirectStandardError = true;
                    p.ErrorDataReceived += new DataReceivedEventHandler(SplitOutput);
                    p.StartInfo.UseShellExecute = false;
                    p.StartInfo.CreateNoWindow = true;
                    p.Start();
                    p.BeginErrorReadLine();
                    p.WaitForExit();
                    p.Close();
                    p.Dispose();

                }

                this.BeginInvoke(new MethodInvoker(() =>
                {
                    EnableUI(true);
                    this.Text = title + " - 分割完成!";
                }));
            }).Start();
        }
Пример #20
0
        /// <summary>
        /// Async for WinForms where secure threading is necessary, pass the control that will be used as Invoker
        /// This method uses output filename to detect resulting type, same resolution as source and the same bitrate as source
        /// </summary>
        /// <param name="input"></param>
        /// <param name="encodingCommand"></param>
        /// <param name="outputFile"></param>
        /// <param name="caller">The WinForm that makes the call</param>
        public void EncodeVideoAsyncAutoCommand(VideoFile input, string outputFile, System.Windows.Forms.Control caller, int treadCount)
        {
            //Gather info
            if (!input.infoGathered)
            {
                GetVideoInfo(input);
            }

            //If input video bitrate 0, then the correct video bitrate has not been detected, generate a value
            if (input.VideoBitRate == 0)
            {
                //Use video height, guestimations, tweak these at ur own will
                int h = input.Height;

                if (h < 180)
                {
                    input.VideoBitRate = 400;
                }
                else if (h < 260)
                {
                    input.VideoBitRate = 1000;
                }
                else if (h < 400)
                {
                    input.VideoBitRate = 2000;
                }
                else if (h < 800)
                {
                    input.VideoBitRate = 5000;
                }
                else
                {
                    input.VideoBitRate = 8000;
                }
            }

            //If input audio bitrate is 0, then the correct audio bitrate has not been detected, set it to 128k
            if (input.AudioBitRate == 0)
            {
                input.AudioBitRate = 128;
            }

            //Build encoding command
            string encodingCommand = String.Format("-threads {0} -y -b {1} -ab {2}", treadCount.ToString(), input.VideoBitRate.ToString() + "k", input.AudioBitRate.ToString() + "k");

            //Create new encoded video
            tempEncodedVideo = new EncodedVideo();
            tempEncodedVideo.EncodedVideoPath = outputFile;

            //Set caller
            tempCaller = caller;

            //Set input
            tempVideoFile = input;

            //Create parameters
            Params = string.Format("-i \"{0}\" {1} \"{2}\"", input.Path, encodingCommand, outputFile);

            //Execute ffmpeg async
            RunProcessAsync(Params);
        }
Пример #21
0
 public void EncodeVideoAsyncAutoCommand(VideoFile input, string outputFile, int threadCount)
 {
     EncodeVideoAsyncAutoCommand(input, outputFile, null, threadCount);
 }
Пример #22
0
        /// <summary>
        /// Async for WinForms where secure threading is necessary, pass the control that will be used as Invoker
        /// </summary>
        /// <param name="input"></param>
        /// <param name="encodingCommand"></param>
        /// <param name="outputFile"></param>
        /// <param name="caller"></param>
        public void EncodeVideoAsync(VideoFile input, string encodingCommand, string outputFile, System.Windows.Forms.Control caller, int threadCount)
        {
            //Gather info
            if (!input.infoGathered)
            {
                GetVideoInfo(input);
            }

            //Create new encoded video
            tempEncodedVideo = new EncodedVideo();
            tempEncodedVideo.EncodedVideoPath = outputFile;

            //Set caller
            tempCaller = caller;

            //Set input
            tempVideoFile = input;

            //Create parameters
            if (threadCount.Equals(1))
                Params = string.Format("-i \"{0}\" {1} \"{2}\"", input.Path, encodingCommand, outputFile);
            else
                Params = string.Format("-i \"{0}\" -threads {1} {2} \"{3}\"", input.Path, threadCount.ToString(), encodingCommand, outputFile);

            //Execute ffmpeg async
            RunProcessAsync(Params);
        }
Пример #23
0
        /// <summary>
        /// Async for WinForms where secure threading is necessary, pass the control that will be used as Invoker
        /// This method uses output filename to detect resulting type, same resolution as source and the same bitrate as source
        /// </summary>
        /// <param name="input"></param>
        /// <param name="encodingCommand"></param>
        /// <param name="outputFile"></param>
        /// <param name="caller">The WinForm that makes the call</param>
        public void EncodeVideoAsyncAutoCommand(VideoFile input, string outputFile, System.Windows.Forms.Control caller, int treadCount)
        {
            //Gather info
            if (!input.infoGathered)
            {
                GetVideoInfo(input);
            }

            //If input video bitrate 0, then the correct video bitrate has not been detected, generate a value
            if (input.VideoBitRate == 0)
            {
                //Use video height, guestimations, tweak these at ur own will
                int h = input.Height;

                if (h < 180) input.VideoBitRate = 400;
                else if (h < 260) input.VideoBitRate = 1000;
                else if (h < 400) input.VideoBitRate = 2000;
                else if (h < 800) input.VideoBitRate = 5000;
                else input.VideoBitRate = 8000;
            }

            //If input audio bitrate is 0, then the correct audio bitrate has not been detected, set it to 128k
            if (input.AudioBitRate == 0) input.AudioBitRate = 128;

            //Build encoding command
            string encodingCommand = String.Format("-threads {0} -y -b {1} -ab {2}", treadCount.ToString(), input.VideoBitRate.ToString() + "k", input.AudioBitRate.ToString() + "k");

            //Create new encoded video
            tempEncodedVideo = new EncodedVideo();
            tempEncodedVideo.EncodedVideoPath = outputFile;

            //Set caller
            tempCaller = caller;

            //Set input
            tempVideoFile = input;

            //Create parameters
            Params = string.Format("-i \"{0}\" {1} \"{2}\"", input.Path, encodingCommand, outputFile);

            //Execute ffmpeg async
            RunProcessAsync(Params);
        }
Пример #24
0
        private void listViewFlv_DragDrop(object sender, DragEventArgs e)
        {
            string[] stringTemp = (string[])e.Data.GetData(DataFormats.FileDrop);
            //textStat.Clear();
            listViewFlv.Items.Clear();
            VideoEncoder.Encoder enc = new VideoEncoder.Encoder();
            enc.FFmpegPath = "ffmpeg.exe";

            for (int i = 0; i < stringTemp.Length; i++)
            {

                VideoFile vf = new VideoFile(stringTemp[i]);
                enc.GetVideoInfo(vf);
                TimeSpan t = vf.Duration;
                //int tt =(int)t.TotalSeconds;
                //seconds = (int)t.TotalSeconds / parts + 10;
                ListViewItem it = new ListViewItem();
                it.Text = stringTemp[i];
                it.SubItems.Add(vf.Duration.ToString().Substring(0, vf.Duration.ToString().LastIndexOf(".")));
                it.SubItems.Add(vf.BitRate.ToString());
                it.SubItems.Add(vf.VideoBitRate.ToString());
                it.SubItems.Add(vf.AudioBitRate.ToString());

                listViewFlv.Items.Add(it);
                //                 stringTemp[i] = stringTemp[i]
                //                     + " Duration:" + t.TotalSeconds
                //                     + " VideoRate:" + vf.VideoBitRate
                //                     + " AudioRate:" + vf.AudioBitRate;

            }
            listViewFlv.Columns[0].Width = -1;
            //listViewFlv.Columns[1].Width = -1;
            //listViewFlv.Columns[4].Width = -1;
        }