Procházet zdrojové kódy

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

tags/录制修改前
zhangxueyang před 4 roky
rodič
revize
26c9839660

+ 20
- 12
Common/system/FFMpeg.cs Zobrazit soubor

@@ -20,6 +20,10 @@ namespace Common.system
20 20
     {
21 21
         public Process myProcess = null;
22 22
 
23
+        /// <summary>
24
+        /// 是否输出录课录屏日志
25
+        /// </summary>
26
+        public bool OutputVideoLog = FileToolsCommon.GetConfigValue("OutputVideoLog") != "0";
23 27
         /// <summary>
24 28
         /// ffmpeg输出日志文件地址  每个文件2MB左右
25 29
         /// </summary>
@@ -138,7 +142,10 @@ namespace Common.system
138 142
                     myProcess.StartInfo.Arguments = SpeakerStr + MicrophoneStr + " -f gdigrab -i desktop -vcodec libx264 -preset:v ultrafast -tune:v zerolatency -acodec aac " + PathName;
139 143
                     break;
140 144
             }
141
-            LogHelper.WriteInfoLog("【录屏】:"+myProcess.StartInfo.Arguments);
145
+            if (OutputVideoLog)
146
+            {
147
+                LogHelper.WriteInfoLog("【录屏】:" + myProcess.StartInfo.Arguments);
148
+            }
142 149
             myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
143 150
             myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
144 151
             myProcess.StartInfo.CreateNoWindow = true;             //不显示程序窗口
@@ -228,7 +235,8 @@ namespace Common.system
228 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 240
             myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
233 241
             myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
234 242
             myProcess.StartInfo.CreateNoWindow = true;             //不显示程序窗口
@@ -371,6 +379,8 @@ namespace Common.system
371 379
                             VideoSavePath;
372 380
                         break;
373 381
                 }
382
+                if (OutputVideoLog)
383
+                    LogHelper.WriteInfoLog("【图片音频合成视频】:" + myProcess.StartInfo.Arguments);
374 384
                 myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
375 385
                 myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
376 386
                 myProcess.StartInfo.CreateNoWindow = true;             //不显示程序窗口
@@ -471,6 +481,8 @@ namespace Common.system
471 481
 
472 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 486
             myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
475 487
             myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
476 488
             myProcess.StartInfo.CreateNoWindow = true;             //不显示程序窗口
@@ -595,6 +607,9 @@ namespace Common.system
595 607
                 myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
596 608
                                                                                                                  //myProcess.StartInfo.Arguments = "-i \"" + VideoPath + "\" -ss 1 -vframes 1 -r 1 -ac 1 -ab 2 -s " + thubWidth + "*" + thubHeight + " -f image2 \"" + ImagePath + "\"";
597 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 613
                 myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
599 614
                 myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
600 615
                 myProcess.StartInfo.CreateNoWindow = true;             //不显示程序窗口
@@ -653,6 +668,9 @@ namespace Common.system
653 668
                 LogPath = CreateffmpegLog();
654 669
                 myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
655 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 674
                 myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
657 675
                 myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
658 676
                 myProcess.StartInfo.CreateNoWindow = true;             //不显示程序窗口
@@ -741,16 +759,6 @@ namespace Common.system
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 762
         /// <summary>
755 763
         /// 获取麦克风
756 764
         /// </summary>

+ 1
- 1
Common/system/HttpHelper.cs Zobrazit soubor

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

+ 1
- 0
XHWK.WKTool/App.config Zobrazit soubor

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

+ 0
- 2
XHWK.WKTool/CountdownWindow.xaml.cs Zobrazit soubor

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

+ 22
- 21
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs Zobrazit soubor

@@ -3182,25 +3182,26 @@ namespace XHWK.WKTool
3182 3182
         {
3183 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 3205
                         //ImageHelper.SaveUIToImage(GridMain, FilePathName, (int)(GridMain.ActualWidth * (PrimaryScreen.DpiX / 96f)), (int)(GridMain.ActualHeight * (PrimaryScreen.DpiY / 96f)), 0, 0);
3205 3206
                         //ImageHelper.SaveUIToImage(GridMain, FilePathName, (int)(ActualWidth * (PrimaryScreen.DpiX / 96f)), (int)(ActualHeight * (PrimaryScreen.DpiY / 96f)), (int)RsW, (int)RsH);
3206 3207
                         //ImageHelper.SaveUIToImage(GridMain, FilePathName, (int)(ActualWidth * (PrimaryScreen.DpiX / 96f)), (int)(ActualHeight * (PrimaryScreen.DpiY / 96f)), 1281, 1026);
@@ -3223,8 +3224,8 @@ namespace XHWK.WKTool
3223 3224
                             txbTime.Text = SRTime.ToString("mm:ss");
3224 3225
                             //});
3225 3226
                         }
3226
-                    }
3227
-                });
3227
+                    });
3228
+                }
3228 3229
             }
3229 3230
             catch (Exception ex)
3230 3231
             {
@@ -4129,9 +4130,9 @@ namespace XHWK.WKTool
4129 4130
             TranslateTransform transform1 = group.Children[1] as TranslateTransform;
4130 4131
             transform1.X = -1 * ((pointToContent.X * transform.ScaleX) - point.X);
4131 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 4137
             //Console.WriteLine("transform.ScaleX = " + transform.ScaleX + "; transform.ScaleY = " + transform.ScaleY);
4137 4138
 

Načítá se…
Zrušit
Uložit