How to get a loading return value
I am trying to create a loading progress bar for my function:
private string ConvertToFLV(string phyicalFilePath)开发者_开发知识库
{
if (Path.GetExtension(phyicalFilePath).Equals(".flv")) return phyicalFilePath;
var argument = string.Format(@"-i ""{0}"" -vcodec flv -f flv -r 29.97 -s 320x240 -aspect 4:3 -b 300k -g 160 -cmp dct -subcmp dct -mbd 2 -flags +aic+cbp+mv0+mv4 -trellis 1 -ac 1 -ar 22050 -ab 56k ""{1}""", phyicalFilePath, Path.ChangeExtension(phyicalFilePath, "flv"));
// var argument = string.Format("-i {0} -crf 35.0 -vcodec libx264 -acodec libfaac -ar 48000 -ab 128k -coder 1 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method hex -subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -threads 0 {1}", phyicalFilePath, Path.ChangeExtension(phyicalFilePath, "mp4"));
File.Delete(Path.ChangeExtension(phyicalFilePath, "flv"));
ProcessStartInfo process = new ProcessStartInfo(ffmpegPhysicalPath, argument);
Process proc = new Process();
proc.StartInfo = process;
proc.Start();
proc.WaitForExit();
return Path.ChangeExtension(phyicalFilePath, "flv");
}
Whent he command "proc.WaitForExit()" is invoked, I want to be able to return some type of load percentage. In the frontend I just have a gif loading image, but I want to be able to show progress on this, is there a way to do this?
This post is explaining how to do it, it's in ruby, but you could find some info in it.
精彩评论