سلام
دوستان چطوری میشه زمان فایل ویدئو رو بعد از آپلود شدن بدست آورد؟
اگر راهنمایی بفرمایید ممنون میشم
using(Process ffmpeg = new Process()) { String duration; // soon will hold our video's duration in the form "HH:MM:SS.UU" String result; // temp variable holding a string representation of our video's duration StreamReader errorreader; // StringWriter to hold output from ffmpeg // we want to execute the process without opening a shell ffmpeg.StartInfo.UseShellExecute = false; ffmpeg.StartInfo.ErrorDialog = false; // redirect StandardError so we can parse it // for some reason the output comes through over StandardError ffmpeg.StartInfo.RedirectStandardError = true; // set the file name of our process, including the full path // (as well as quotes, as if you were calling it from the command-line) ffmpeg.StartInfo.FileName = "[directory of ffmpeg.exe]\ffmpeg.exe"; // set the command-line arguments of our process, including full paths of any files // (as well as quotes, as if you were passing these arguments on the command-line) ffmpeg.StartInfo.Arguments = "-i [directory of video file]\video_file"; // start the process ffmpeg.Start(); // now that the process is started, we can redirect output to the StreamReader we defined errorreader = ffmpeg.StandardError; // wait until ffmpeg comes back ffmpeg.WaitForExit([time_to_wait_in_milliseconds]); // read the output from ffmpeg, which for some reason is found in Process.StandardError result = errorreader.ReadToEnd(); // a little convoluded, this string manipulation... // working from the inside out, it: // takes a substring of result, starting from the end of the "Duration: " label contained within, // (execute "ffmpeg.exe -i somevideofile" on the command-line to verify for yourself that it is there) // and going the full length of the timestamp. // The resulting substring is of the form "HH:MM:SS.UU" duration = result.Substring(result.IndexOf("Duration: ") + ("Duration: ").Length, ("00:00:00.00").Length); }
جناب مدائنی توی این خط error دارد
ffmpeg.StartInfo.FileName =
"[directory of ffmpeg.exe]\ffmpeg.exe"
;
میشه راهنمایی بفرمایید
هیچ کاربری تا کنون از این پست تشکر نکرده است
با ما تماس بگیرید تا در این مسیر همراهتان باشیم :)