Commit 4343e5ae 张东亮

存储机构视频转换后台进行

1 个父辈 1a20f1b1
...@@ -236,8 +236,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -236,8 +236,8 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info("监控视频开始转换"); LogUtil.info("监控视频开始转换");
Task task1 = ffmpegA.ConvertImgsToMp4(); Task task1 = ffmpegA.ConvertImgsToMp4();
Task task2 = ffmpegB.ConvertImgsToMp4(); Task task2 = ffmpegB.ConvertImgsToMp4();
Task.WaitAll(new Task[] { task1, task2 }, TimeSpan.FromMinutes(1)); //Task.WaitAll(new Task[] { task1, task2 }, TimeSpan.FromMinutes(1));
LogUtil.info("监控视频转换完成"); //LogUtil.info("监控视频转换完成");
} }
#endregion #endregion
} }
...@@ -286,7 +286,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -286,7 +286,6 @@ namespace OnlineStore.DeviceLibrary
/// 输出文件名带后缀 /// 输出文件名带后缀
/// </summary> /// </summary>
public string OutputFileName { get; set; } = "test.mp4"; public string OutputFileName { get; set; } = "test.mp4";
public string Cmd { get { return ExportCmd(); } }
public void SetParam(string inputfolder, string outputfolder, string outputfilename) public void SetParam(string inputfolder, string outputfolder, string outputfilename)
{ {
InputFolder = inputfolder; InputFolder = inputfolder;
...@@ -305,9 +304,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -305,9 +304,10 @@ namespace OnlineStore.DeviceLibrary
} }
public Task ConvertImgsToMp4() public Task ConvertImgsToMp4()
{ {
StringBuilder sb = new StringBuilder(InputFolder);
StringBuilder sb1 = new StringBuilder(ExportCmd());
Task task = Task.Factory.StartNew(delegate Task task = Task.Factory.StartNew(delegate
{ {
StringBuilder sb = new StringBuilder(InputFolder);
using (Process p = new Process()) using (Process p = new Process())
{ {
//(1)设置要启动的应用程序 //(1)设置要启动的应用程序
...@@ -324,7 +324,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -324,7 +324,7 @@ namespace OnlineStore.DeviceLibrary
p.StartInfo.RedirectStandardError = true; p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true; p.StartInfo.CreateNoWindow = true;
p.Start(); p.Start();
p.StandardInput.WriteLine(Cmd + "&exit"); p.StandardInput.WriteLine(sb1.ToString() + "&exit");
p.StandardInput.AutoFlush = true; p.StandardInput.AutoFlush = true;
p.StandardInput.Close(); p.StandardInput.Close();
p.StandardError.ReadToEnd(); p.StandardError.ReadToEnd();
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!