|
@@ -116,7 +116,7 @@ namespace Common.system
|
116
|
116
|
switch (Extension.ToUpper())
|
117
|
117
|
{
|
118
|
118
|
case ".MP4":
|
119
|
|
- myProcess.StartInfo.Arguments = SpeakerStr + MicrophoneStr + " -f gdigrab -i desktop -vcodec libx264 -preset:v ultrafast -tune:v zerolatency -acodec aac " + PathName;
|
|
119
|
+ myProcess.StartInfo.Arguments = SpeakerStr + MicrophoneStr + " -f gdigrab -i desktop -pix_fmt yuv420p -vf scale=trunc(iw/2)*2:trunc(ih/2)*2 -vcodec libx264 -preset:v ultrafast -tune:v zerolatency -acodec aac " + PathName;
|
120
|
120
|
//myProcess.StartInfo.Arguments = SpeakerStr + MicrophoneStr + " -f dshow -i video=\"screen-capture-recorder\" -pix_fmt yuv420p -vcodec libx264 -preset:v ultrafast -tune:v zerolatency -acodec aac " + PathName;
|
121
|
121
|
//if (string.IsNullOrWhiteSpace(MicrophoneName))
|
122
|
122
|
//{
|
|
@@ -130,7 +130,7 @@ namespace Common.system
|
130
|
130
|
break;
|
131
|
131
|
case ".AVI":
|
132
|
132
|
case ".FLV":
|
133
|
|
- myProcess.StartInfo.Arguments = SpeakerStr + MicrophoneStr + " -f gdigrab -i desktop -vcodec libx264 -preset:v ultrafast -tune:v zerolatency -acodec aac -f " + Extension.ToLower().Replace(".", "") + " " + PathName;
|
|
133
|
+ myProcess.StartInfo.Arguments = SpeakerStr + MicrophoneStr + " -f gdigrab -i desktop -pix_fmt yuv420p -vf scale=trunc(iw/2)*2:trunc(ih/2)*2 -vcodec libx264 -preset:v ultrafast -tune:v zerolatency -acodec aac -f " + Extension.ToLower().Replace(".", "") + " " + PathName;
|
134
|
134
|
//if (string.IsNullOrWhiteSpace(MicrophoneName))
|
135
|
135
|
//{
|
136
|
136
|
// myProcess.StartInfo.Arguments = "-f dshow -i video=\"screen-capture-recorder\" -f dshow -i audio=\"virtual-audio-capturer\" -vcodec libx264 -acodec libmp3lame -r 15 -crf 22 -f " + Extension.ToLower() + " " + PathName; //ffmpeg的参数
|
|
@@ -142,13 +142,14 @@ namespace Common.system
|
142
|
142
|
//}
|
143
|
143
|
break;
|
144
|
144
|
default:
|
145
|
|
- myProcess.StartInfo.Arguments = SpeakerStr + MicrophoneStr + " -f gdigrab -i desktop -vcodec libx264 -preset:v ultrafast -tune:v zerolatency -acodec aac " + PathName;
|
|
145
|
+ myProcess.StartInfo.Arguments = SpeakerStr + MicrophoneStr + " -f gdigrab -i desktop -pix_fmt yuv420p -vf scale=trunc(iw/2)*2:trunc(ih/2)*2 -vcodec libx264 -preset:v ultrafast -tune:v zerolatency -acodec aac " + PathName;
|
146
|
146
|
break;
|
147
|
147
|
}
|
148
|
148
|
if (OutputVideoLog)
|
149
|
149
|
{
|
150
|
150
|
LogHelper.WriteInfoLog("【录屏】:" + myProcess.StartInfo.Arguments);
|
151
|
151
|
}
|
|
152
|
+ FileToolsCommon.AppendText(LogPath, "【录屏】:" + myProcess.StartInfo.Arguments + "\r\n");
|
152
|
153
|
myProcess.StartInfo.UseShellExecute = false; //不使用操作系统外壳程序启动
|
153
|
154
|
myProcess.StartInfo.RedirectStandardError = true; //重定向标准错误输出
|
154
|
155
|
myProcess.StartInfo.CreateNoWindow = true; //不显示程序窗口
|
|
@@ -222,7 +223,7 @@ namespace Common.system
|
222
|
223
|
myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe"); //ffmpeg.exe的绝对路径
|
223
|
224
|
if (IsRecordSpeaker && IsRecordMicrophone)
|
224
|
225
|
{
|
225
|
|
- myProcess.StartInfo.Arguments = "-f dshow -i audio=\"virtual-audio-capturer\" -f dshow -i audio=\"" +
|
|
226
|
+ myProcess.StartInfo.Arguments = "-f dshow -i audio=\"virtual-audio-capturer\" -f dshow -i audio=\"" +
|
226
|
227
|
MicrophoneName + "\" -filter_complex amix=inputs=2:duration=first:dropout_transition=2 " + PathName;
|
227
|
228
|
}
|
228
|
229
|
else if (IsRecordSpeaker)
|
|
@@ -240,6 +241,7 @@ namespace Common.system
|
240
|
241
|
}
|
241
|
242
|
if (OutputVideoLog)
|
242
|
243
|
LogHelper.WriteInfoLog("【录音】:" + myProcess.StartInfo.Arguments);
|
|
244
|
+ FileToolsCommon.AppendText(LogPath, "【录音】:" + myProcess.StartInfo.Arguments + "\r\n");
|
243
|
245
|
myProcess.StartInfo.UseShellExecute = false; //不使用操作系统外壳程序启动
|
244
|
246
|
myProcess.StartInfo.RedirectStandardError = true; //重定向标准错误输出
|
245
|
247
|
myProcess.StartInfo.CreateNoWindow = true; //不显示程序窗口
|
|
@@ -384,6 +386,7 @@ namespace Common.system
|
384
|
386
|
}
|
385
|
387
|
if (OutputVideoLog)
|
386
|
388
|
LogHelper.WriteInfoLog("【图片音频合成视频】:" + myProcess.StartInfo.Arguments);
|
|
389
|
+ FileToolsCommon.AppendText(LogPath, "【图片音频合成视频】:" + myProcess.StartInfo.Arguments + "\r\n");
|
387
|
390
|
myProcess.StartInfo.UseShellExecute = false; //不使用操作系统外壳程序启动
|
388
|
391
|
myProcess.StartInfo.RedirectStandardError = true; //重定向标准错误输出
|
389
|
392
|
myProcess.StartInfo.CreateNoWindow = true; //不显示程序窗口
|
|
@@ -486,6 +489,7 @@ namespace Common.system
|
486
|
489
|
}
|
487
|
490
|
if (OutputVideoLog)
|
488
|
491
|
LogHelper.WriteInfoLog("【音视频合成】:" + myProcess.StartInfo.Arguments);
|
|
492
|
+ FileToolsCommon.AppendText(LogPath, "【音视频合成】:" + myProcess.StartInfo.Arguments + "\r\n");
|
489
|
493
|
myProcess.StartInfo.UseShellExecute = false; //不使用操作系统外壳程序启动
|
490
|
494
|
myProcess.StartInfo.RedirectStandardError = true; //重定向标准错误输出
|
491
|
495
|
myProcess.StartInfo.CreateNoWindow = true; //不显示程序窗口
|
|
@@ -613,6 +617,7 @@ namespace Common.system
|
613
|
617
|
|
614
|
618
|
if (OutputVideoLog)
|
615
|
619
|
LogHelper.WriteInfoLog("【生成缩略图】:" + myProcess.StartInfo.Arguments);
|
|
620
|
+ FileToolsCommon.AppendText(LogPath, "【生成缩略图】:" + myProcess.StartInfo.Arguments + "\r\n");
|
616
|
621
|
myProcess.StartInfo.UseShellExecute = false; //不使用操作系统外壳程序启动
|
617
|
622
|
myProcess.StartInfo.RedirectStandardError = true; //重定向标准错误输出
|
618
|
623
|
myProcess.StartInfo.CreateNoWindow = true; //不显示程序窗口
|
|
@@ -674,6 +679,7 @@ namespace Common.system
|
674
|
679
|
|
675
|
680
|
if (OutputVideoLog)
|
676
|
681
|
LogHelper.WriteInfoLog("【视频转码】:" + myProcess.StartInfo.Arguments);
|
|
682
|
+ FileToolsCommon.AppendText(LogPath,"【视频转码】:" + myProcess.StartInfo.Arguments + "\r\n");
|
677
|
683
|
myProcess.StartInfo.UseShellExecute = false; //不使用操作系统外壳程序启动
|
678
|
684
|
myProcess.StartInfo.RedirectStandardError = true; //重定向标准错误输出
|
679
|
685
|
myProcess.StartInfo.CreateNoWindow = true; //不显示程序窗口
|
|
@@ -758,7 +764,8 @@ namespace Common.system
|
758
|
764
|
{
|
759
|
765
|
if (!string.IsNullOrEmpty(output.Data))
|
760
|
766
|
{
|
761
|
|
- FileToolsCommon.AppendText(LogPath, output.Data);
|
|
767
|
+ FileToolsCommon.AppendText(LogPath, "【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff") +"】:");
|
|
768
|
+ FileToolsCommon.AppendText(LogPath, output.Data+"\r\n");
|
762
|
769
|
}
|
763
|
770
|
}
|
764
|
771
|
#region 麦克风声卡检测
|
|
@@ -822,28 +829,29 @@ namespace Common.system
|
822
|
829
|
try
|
823
|
830
|
{
|
824
|
831
|
|
825
|
|
- while (myProcess != null)
|
826
|
|
- {
|
827
|
|
- Thread.Sleep(100);
|
828
|
|
- }
|
829
|
|
- myProcess = new Process();
|
830
|
|
- LogPath = CreateffmpegLog();
|
831
|
|
- myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe"); //ffmpeg.exe的绝对路径
|
832
|
|
- myProcess.StartInfo.Arguments = " -list_devices true -f dshow -i dummy";
|
833
|
|
- if (OutputVideoLog)
|
834
|
|
- LogHelper.WriteInfoLog("【音视频合成】:" + myProcess.StartInfo.Arguments);
|
835
|
|
- myProcess.StartInfo.UseShellExecute = false; //不使用操作系统外壳程序启动
|
836
|
|
- myProcess.StartInfo.RedirectStandardError = true; //重定向标准错误输出
|
837
|
|
- myProcess.StartInfo.CreateNoWindow = true; //不显示程序窗口
|
838
|
|
- myProcess.StartInfo.RedirectStandardInput = true; //用于模拟该进程控制台的输入
|
839
|
|
- //外部程序(这里是FFMPEG)输出流时候产生的事件,这里是把流的处理过程转移到下面的方法中,详细请查阅MSDN
|
840
|
|
- myProcess.ErrorDataReceived += GetDevInfoData;
|
841
|
|
- myProcess.Start(); //启动线程
|
842
|
|
- myProcess.BeginErrorReadLine(); //开始异步读取
|
843
|
|
- myProcess.WaitForExit(); //阻塞等待进程结束
|
844
|
|
- myProcess.Close(); //关闭进程
|
845
|
|
- myProcess.Dispose(); //释放资源
|
846
|
|
- myProcess = null;
|
|
832
|
+ while (myProcess != null)
|
|
833
|
+ {
|
|
834
|
+ Thread.Sleep(100);
|
|
835
|
+ }
|
|
836
|
+ myProcess = new Process();
|
|
837
|
+ LogPath = CreateffmpegLog();
|
|
838
|
+ myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe"); //ffmpeg.exe的绝对路径
|
|
839
|
+ myProcess.StartInfo.Arguments = " -list_devices true -f dshow -i dummy";
|
|
840
|
+ if (OutputVideoLog)
|
|
841
|
+ LogHelper.WriteInfoLog("【获取设备信息】:" + myProcess.StartInfo.Arguments);
|
|
842
|
+ FileToolsCommon.AppendText(LogPath, "【获取设备信息】:" + myProcess.StartInfo.Arguments + "\r\n");
|
|
843
|
+ myProcess.StartInfo.UseShellExecute = false; //不使用操作系统外壳程序启动
|
|
844
|
+ myProcess.StartInfo.RedirectStandardError = true; //重定向标准错误输出
|
|
845
|
+ myProcess.StartInfo.CreateNoWindow = true; //不显示程序窗口
|
|
846
|
+ myProcess.StartInfo.RedirectStandardInput = true; //用于模拟该进程控制台的输入
|
|
847
|
+ //外部程序(这里是FFMPEG)输出流时候产生的事件,这里是把流的处理过程转移到下面的方法中,详细请查阅MSDN
|
|
848
|
+ myProcess.ErrorDataReceived += GetDevInfoData;
|
|
849
|
+ myProcess.Start(); //启动线程
|
|
850
|
+ myProcess.BeginErrorReadLine(); //开始异步读取
|
|
851
|
+ myProcess.WaitForExit(); //阻塞等待进程结束
|
|
852
|
+ myProcess.Close(); //关闭进程
|
|
853
|
+ myProcess.Dispose(); //释放资源
|
|
854
|
+ myProcess = null;
|
847
|
855
|
}
|
848
|
856
|
catch (Exception ex)
|
849
|
857
|
{
|