1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
/// <summary>
/// Convert from a pictures sequence to a video
/// </summary>
/// <param name="PathVideo"></param>
/// <param name="PathImg"></param>
/// <returns></returns>
private bool _ConvertFromJpgToAVI(string PathVideo, string PathImg)
{
bool bresult = false;
/*
* -r 24 ! 24 picture\s
* -b 1800 birate3
*/
string argffmpeg = String.Format("-vcodec wmv1 -r 24 -b:v 1800 -i \"{0}SurvImg%4d.bmp\" {1}", PathImg, PathVideo);
bresult = _Useffmpeg(argffmpeg);
return bresult;
}
/// <summary>
/// Use ffmpeg.exe
/// </summary>
/// <param name="Argument"></param>
/// <returns></returns>
private bool _Useffmpeg(string Argument)
{
bool bresult = false;
try
{
using (Process process = new Process())
{
string pathffmpeg = _EncoderPath + "\\ffmpeg.exe";
if (File.Exists(pathffmpeg) )
{
process.StartInfo.FileName = _EncoderPath + "\\ffmpeg.exe";
process.StartInfo.WindowStyle = ProcessWindowStyle.Normal ;
process.StartInfo.UseShellExecute = false;
process.StartInfo.ErrorDialog = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.Arguments = Argument;
process.Start();
StreamReader myStreamReader = process.StandardError;
// Read the standard error of net.exe and write it on to console.
Console.WriteLine(myStreamReader.ReadToEnd());
process.WaitForExit();
bresult = process.HasExited;
process.Close();
}else
{
MessageBox.Show(String.Format("the software {0} is missing", pathffmpeg), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
[...] |
Partager