Browse Source

Merge remote-tracking branch 'origin/zyy' into zhangxueyang

tags/录制修改前
zhangxueyang 4 years ago
parent
commit
26c9839660

+ 20
- 12
Common/system/FFMpeg.cs View File

20
     {
20
     {
21
         public Process myProcess = null;
21
         public Process myProcess = null;
22
 
22
 
23
+        /// <summary>
24
+        /// 是否输出录课录屏日志
25
+        /// </summary>
26
+        public bool OutputVideoLog = FileToolsCommon.GetConfigValue("OutputVideoLog") != "0";
23
         /// <summary>
27
         /// <summary>
24
         /// ffmpeg输出日志文件地址  每个文件2MB左右
28
         /// ffmpeg输出日志文件地址  每个文件2MB左右
25
         /// </summary>
29
         /// </summary>
138
                     myProcess.StartInfo.Arguments = SpeakerStr + MicrophoneStr + " -f gdigrab -i desktop -vcodec libx264 -preset:v ultrafast -tune:v zerolatency -acodec aac " + PathName;
142
                     myProcess.StartInfo.Arguments = SpeakerStr + MicrophoneStr + " -f gdigrab -i desktop -vcodec libx264 -preset:v ultrafast -tune:v zerolatency -acodec aac " + PathName;
139
                     break;
143
                     break;
140
             }
144
             }
141
-            LogHelper.WriteInfoLog("【录屏】:"+myProcess.StartInfo.Arguments);
145
+            if (OutputVideoLog)
146
+            {
147
+                LogHelper.WriteInfoLog("【录屏】:" + myProcess.StartInfo.Arguments);
148
+            }
142
             myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
149
             myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
143
             myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
150
             myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
144
             myProcess.StartInfo.CreateNoWindow = true;             //不显示程序窗口
151
             myProcess.StartInfo.CreateNoWindow = true;             //不显示程序窗口
228
                         MicrophoneName + "\" -filter_complex amix=inputs=2:duration=first:dropout_transition=2 " + PathName;
235
                         MicrophoneName + "\" -filter_complex amix=inputs=2:duration=first:dropout_transition=2 " + PathName;
229
                 }
236
                 }
230
             }
237
             }
231
-            LogHelper.WriteInfoLog("【录音】:" + myProcess.StartInfo.Arguments);
238
+            if (OutputVideoLog)
239
+                LogHelper.WriteInfoLog("【录音】:" + myProcess.StartInfo.Arguments);
232
             myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
240
             myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
233
             myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
241
             myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
234
             myProcess.StartInfo.CreateNoWindow = true;             //不显示程序窗口
242
             myProcess.StartInfo.CreateNoWindow = true;             //不显示程序窗口
371
                             VideoSavePath;
379
                             VideoSavePath;
372
                         break;
380
                         break;
373
                 }
381
                 }
382
+                if (OutputVideoLog)
383
+                    LogHelper.WriteInfoLog("【图片音频合成视频】:" + myProcess.StartInfo.Arguments);
374
                 myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
384
                 myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
375
                 myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
385
                 myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
376
                 myProcess.StartInfo.CreateNoWindow = true;             //不显示程序窗口
386
                 myProcess.StartInfo.CreateNoWindow = true;             //不显示程序窗口
471
 
481
 
472
                 myProcess.StartInfo.Arguments = "-f concat  -safe 0 -i " + Path + "temprs/filelist.d -c copy " + FilePath;
482
                 myProcess.StartInfo.Arguments = "-f concat  -safe 0 -i " + Path + "temprs/filelist.d -c copy " + FilePath;
473
             }
483
             }
484
+            if (OutputVideoLog)
485
+                LogHelper.WriteInfoLog("【音视频合成】:" + myProcess.StartInfo.Arguments);
474
             myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
486
             myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
475
             myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
487
             myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
476
             myProcess.StartInfo.CreateNoWindow = true;             //不显示程序窗口
488
             myProcess.StartInfo.CreateNoWindow = true;             //不显示程序窗口
595
                 myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
607
                 myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
596
                                                                                                                  //myProcess.StartInfo.Arguments = "-i \"" + VideoPath + "\" -ss 1 -vframes 1 -r 1 -ac 1 -ab 2 -s " + thubWidth + "*" + thubHeight + " -f image2 \"" + ImagePath + "\"";
608
                                                                                                                  //myProcess.StartInfo.Arguments = "-i \"" + VideoPath + "\" -ss 1 -vframes 1 -r 1 -ac 1 -ab 2 -s " + thubWidth + "*" + thubHeight + " -f image2 \"" + ImagePath + "\"";
597
                 myProcess.StartInfo.Arguments = "-i \"" + VideoPath + "\" -ss 1 -vframes 1 -r 1 -ac 1 -ab 2"+ WHStr + " -f image2 \"" + ImagePath + "\"";
609
                 myProcess.StartInfo.Arguments = "-i \"" + VideoPath + "\" -ss 1 -vframes 1 -r 1 -ac 1 -ab 2"+ WHStr + " -f image2 \"" + ImagePath + "\"";
610
+
611
+                if (OutputVideoLog)
612
+                    LogHelper.WriteInfoLog("【生成缩略图】:" + myProcess.StartInfo.Arguments);
598
                 myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
613
                 myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
599
                 myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
614
                 myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
600
                 myProcess.StartInfo.CreateNoWindow = true;             //不显示程序窗口
615
                 myProcess.StartInfo.CreateNoWindow = true;             //不显示程序窗口
653
                 LogPath = CreateffmpegLog();
668
                 LogPath = CreateffmpegLog();
654
                 myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
669
                 myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
655
                 myProcess.StartInfo.Arguments = "-i " + VideoPathName + " -acodec copy -vcodec libx264 -s " + Width + "*" + Height + " " + VideoSavePathName;
670
                 myProcess.StartInfo.Arguments = "-i " + VideoPathName + " -acodec copy -vcodec libx264 -s " + Width + "*" + Height + " " + VideoSavePathName;
671
+
672
+                if (OutputVideoLog)
673
+                    LogHelper.WriteInfoLog("【视频转码】:" + myProcess.StartInfo.Arguments);
656
                 myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
674
                 myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
657
                 myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
675
                 myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
658
                 myProcess.StartInfo.CreateNoWindow = true;             //不显示程序窗口
676
                 myProcess.StartInfo.CreateNoWindow = true;             //不显示程序窗口
741
             }
759
             }
742
         }
760
         }
743
 
761
 
744
-        //private void P_ErrorDataReceived(object sender, DataReceivedEventArgs e)
745
-        //{
746
-        //    //+= new DataReceivedEventHandler((s, message) => { Console.WriteLine(message.Data); })
747
-        //    using (StreamWriter fs = new StreamWriter("E:\\项目\\测试\\Wpf测试\\bin\\Debug\\ffmpeg\\log.txt", true))
748
-        //    {
749
-        //        fs.WriteLine(e.Data);
750
-        //        Debug.WriteLine(output.Data.ToString());
751
-        //    }
752
-        //}
753
-
754
         /// <summary>
762
         /// <summary>
755
         /// 获取麦克风
763
         /// 获取麦克风
756
         /// </summary>
764
         /// </summary>

+ 1
- 1
Common/system/HttpHelper.cs View File

564
                     response.Close();
564
                     response.Close();
565
                     readStream.Close();
565
                     readStream.Close();
566
                     //MessageWindow.Show(returnValue);
566
                     //MessageWindow.Show(returnValue);
567
-                    LogHelper.WriteInfoLog("【文件上传】" + returnValue);
567
+                    //LogHelper.WriteInfoLog("【文件上传】" + returnValue);
568
                 }
568
                 }
569
                 return jobResult;
569
                 return jobResult;
570
             }
570
             }

+ 1
- 0
XHWK.WKTool/App.config View File

6
   <appSettings>
6
   <appSettings>
7
     <!--0正式 1测试-->
7
     <!--0正式 1测试-->
8
     <add key="IsDebug" value="1" />
8
     <add key="IsDebug" value="1" />
9
+    <add key="OutputVideoLog" value="0"/>
9
     <!--图片压缩等级-->
10
     <!--图片压缩等级-->
10
     <add key="ImageCompressionLevel" value="30" />
11
     <add key="ImageCompressionLevel" value="30" />
11
     <!--文件存放路径  路径\账户名\讲解名称_x.MP4-->
12
     <!--文件存放路径  路径\账户名\讲解名称_x.MP4-->

+ 0
- 2
XHWK.WKTool/CountdownWindow.xaml.cs View File

43
                         if (ImgNum >= 1)
43
                         if (ImgNum >= 1)
44
                         {
44
                         {
45
                             loadingImg(ImgNum);
45
                             loadingImg(ImgNum);
46
-                            LogHelper.WriteInfoLog("【" + ImgNum + "】");
47
                             ImgNum--;
46
                             ImgNum--;
48
                             Thread.Sleep(changeTime / 22);
47
                             Thread.Sleep(changeTime / 22);
49
                         }
48
                         }
79
             {
78
             {
80
                 loadingImg(ImgNum);
79
                 loadingImg(ImgNum);
81
                 ImgNum--;
80
                 ImgNum--;
82
-                LogHelper.WriteInfoLog("【" + ImgNum + "】");
83
             }
81
             }
84
             else
82
             else
85
             {
83
             {

+ 22
- 21
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs View File

3182
         {
3182
         {
3183
             try
3183
             try
3184
             {
3184
             {
3185
-                Dispatcher.Invoke(() =>
3185
+                if (IsStartCount)
3186
                 {
3186
                 {
3187
-                    if (IsStartCount)
3187
+                    string FilePathName = ImgPath + RsImgName.Count + ".png";
3188
+                    RsImgName.Add(FilePathName);
3189
+                    #region 设置大小
3190
+                    double RsW = (int)(GridMain.ActualWidth * (PrimaryScreen.DpiX / 96f));
3191
+                    double RsH = (int)(GridMain.ActualHeight * (PrimaryScreen.DpiY / 96f));
3192
+                    if (RsW > 1266)
3188
                     {
3193
                     {
3189
-                        string FilePathName = ImgPath + RsImgName.Count + ".png";
3190
-                        RsImgName.Add(FilePathName);
3191
-                        #region 设置大小
3192
-                        //double RsW = (int)(ActualWidth * (PrimaryScreen.DpiX / 96f));
3193
-                        //double RsH = (int)(ActualHeight * (PrimaryScreen.DpiY / 96f));
3194
-                        //if (RsW > 1281)
3195
-                        //{
3196
-                        //    //double Proportion = RsH / RsW;
3197
-                        //    RsW = 1281;
3198
-                        //    //RsH = RsW * Proportion;
3199
-                        //    RsH = 1026;
3200
-                        //}
3201
-                        #endregion         
3194
+                        double Proportion = RsH / RsW;
3195
+                        RsW = 1266;
3196
+                        RsH = RsW * Proportion;
3197
+                        RsH = ((int)RsH) % 2 > 0 ? (int)RsH - 1 : (int)RsH;
3198
+                        //RsH = 898;
3199
+                    }
3200
+                    Dispatcher.Invoke(() =>
3201
+                    {
3202
+                        #endregion
3202
                         //保存图片
3203
                         //保存图片
3203
-                        ImageHelper.SaveUIToImage(GridMain, FilePathName, gridActWidth, gridActHeight, gridActWidth, gridActHeight);
3204
+                        ImageHelper.SaveUIToImage(GridMain, FilePathName, gridActWidth, gridActHeight, (int)RsW, (int)RsH);
3204
                         //ImageHelper.SaveUIToImage(GridMain, FilePathName, (int)(GridMain.ActualWidth * (PrimaryScreen.DpiX / 96f)), (int)(GridMain.ActualHeight * (PrimaryScreen.DpiY / 96f)), 0, 0);
3205
                         //ImageHelper.SaveUIToImage(GridMain, FilePathName, (int)(GridMain.ActualWidth * (PrimaryScreen.DpiX / 96f)), (int)(GridMain.ActualHeight * (PrimaryScreen.DpiY / 96f)), 0, 0);
3205
                         //ImageHelper.SaveUIToImage(GridMain, FilePathName, (int)(ActualWidth * (PrimaryScreen.DpiX / 96f)), (int)(ActualHeight * (PrimaryScreen.DpiY / 96f)), (int)RsW, (int)RsH);
3206
                         //ImageHelper.SaveUIToImage(GridMain, FilePathName, (int)(ActualWidth * (PrimaryScreen.DpiX / 96f)), (int)(ActualHeight * (PrimaryScreen.DpiY / 96f)), (int)RsW, (int)RsH);
3206
                         //ImageHelper.SaveUIToImage(GridMain, FilePathName, (int)(ActualWidth * (PrimaryScreen.DpiX / 96f)), (int)(ActualHeight * (PrimaryScreen.DpiY / 96f)), 1281, 1026);
3207
                         //ImageHelper.SaveUIToImage(GridMain, FilePathName, (int)(ActualWidth * (PrimaryScreen.DpiX / 96f)), (int)(ActualHeight * (PrimaryScreen.DpiY / 96f)), 1281, 1026);
3223
                             txbTime.Text = SRTime.ToString("mm:ss");
3224
                             txbTime.Text = SRTime.ToString("mm:ss");
3224
                             //});
3225
                             //});
3225
                         }
3226
                         }
3226
-                    }
3227
-                });
3227
+                    });
3228
+                }
3228
             }
3229
             }
3229
             catch (Exception ex)
3230
             catch (Exception ex)
3230
             {
3231
             {
4129
             TranslateTransform transform1 = group.Children[1] as TranslateTransform;
4130
             TranslateTransform transform1 = group.Children[1] as TranslateTransform;
4130
             transform1.X = -1 * ((pointToContent.X * transform.ScaleX) - point.X);
4131
             transform1.X = -1 * ((pointToContent.X * transform.ScaleX) - point.X);
4131
             transform1.Y = -1 * ((pointToContent.Y * transform.ScaleY) - point.Y);
4132
             transform1.Y = -1 * ((pointToContent.Y * transform.ScaleY) - point.Y);
4132
-            LogHelper.WriteInfoLog("【img宽高】" + imgCanvas.ActualWidth.ToString() + ":"
4133
-                 + imgCanvas.ActualHeight.ToString() + "百分比:" + transform.ScaleX.ToString() + ":" + transform.ScaleY.ToString()
4134
-                );
4133
+            //LogHelper.WriteInfoLog("【img宽高】" + imgCanvas.ActualWidth.ToString() + ":"
4134
+            //     + imgCanvas.ActualHeight.ToString() + "百分比:" + transform.ScaleX.ToString() + ":" + transform.ScaleY.ToString()
4135
+            //    );
4135
 
4136
 
4136
             //Console.WriteLine("transform.ScaleX = " + transform.ScaleX + "; transform.ScaleY = " + transform.ScaleY);
4137
             //Console.WriteLine("transform.ScaleX = " + transform.ScaleX + "; transform.ScaleY = " + transform.ScaleY);
4137
 
4138
 

Loading…
Cancel
Save