CmdDemo.ffmpeg.RunJpg C# (CSharp) Method

RunJpg() private method

轉換為Jpg文件
private RunJpg ( string fullName, string path, int ImageWidth, int ImageHeight ) : void
fullName string
path string
ImageWidth int
ImageHeight int
return void
        private void RunJpg(string fullName, string path, int ImageWidth, int ImageHeight)
        {
            //ffmpeg -i F:\01.wmv -y -f image2 -t 0.001 -s  寬x高 f:\test.jpg;
            if (System.IO.File.Exists(fullName))
            {
            string jpgName = System.IO.Path.ChangeExtension(fullName, ".jpg");
            if (!String.IsNullOrEmpty(path))
            {
                string lastChar = path.Substring(path.Length - 1);
                if (lastChar == @"\" || lastChar == @"/") path = path.Substring(0, path.Length - 1);
                jpgName = path + @"\" + GetFileName(jpgName);
            }
            string args;
            if (ImageWidth!=0&&ImageHeight!=0)
            {
                args = String.Format("-i {0} -y -f image2 -t 0.001 -s {1}x{2} {3}", fullName, ImageWidth, ImageHeight, jpgName);
            }
            else
            {
                args = String.Format("-i {0} -y -f image2 -t 0.001  {1}", fullName,jpgName);
            }
            RunCmd(args);
            }
        }