Przeglądaj źródła

zhao:1限制录制视频大小,2增加录制视频日志

tags/录制修改前
耀 4 lat temu
rodzic
commit
1094d2b129

+ 20
- 12
Common/system/FFMpeg.cs Wyświetl plik

@@ -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 Wyświetl plik

@@ -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 Wyświetl plik

@@ -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 Wyświetl plik

@@ -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 Wyświetl plik

@@ -3134,25 +3134,26 @@ namespace XHWK.WKTool
3134 3134
         {
3135 3135
             try
3136 3136
             {
3137
-                Dispatcher.Invoke(() =>
3137
+                if (IsStartCount)
3138 3138
                 {
3139
-                    if (IsStartCount)
3139
+                    string FilePathName = ImgPath + RsImgName.Count + ".png";
3140
+                    RsImgName.Add(FilePathName);
3141
+                    #region 设置大小
3142
+                    double RsW = (int)(GridMain.ActualWidth * (PrimaryScreen.DpiX / 96f));
3143
+                    double RsH = (int)(GridMain.ActualHeight * (PrimaryScreen.DpiY / 96f));
3144
+                    if (RsW > 1266)
3140 3145
                     {
3141
-                        string FilePathName = ImgPath + RsImgName.Count + ".png";
3142
-                        RsImgName.Add(FilePathName);
3143
-                        #region 设置大小
3144
-                        //double RsW = (int)(ActualWidth * (PrimaryScreen.DpiX / 96f));
3145
-                        //double RsH = (int)(ActualHeight * (PrimaryScreen.DpiY / 96f));
3146
-                        //if (RsW > 1281)
3147
-                        //{
3148
-                        //    //double Proportion = RsH / RsW;
3149
-                        //    RsW = 1281;
3150
-                        //    //RsH = RsW * Proportion;
3151
-                        //    RsH = 1026;
3152
-                        //}
3153
-                        #endregion         
3146
+                        double Proportion = RsH / RsW;
3147
+                        RsW = 1266;
3148
+                        RsH = RsW * Proportion;
3149
+                        RsH = ((int)RsH) % 2 > 0 ? (int)RsH - 1 : (int)RsH;
3150
+                        //RsH = 898;
3151
+                    }
3152
+                    Dispatcher.Invoke(() =>
3153
+                    {
3154
+                        #endregion
3154 3155
                         //保存图片
3155
-                        ImageHelper.SaveUIToImage(GridMain, FilePathName, gridActWidth, gridActHeight, gridActWidth, gridActHeight);
3156
+                        ImageHelper.SaveUIToImage(GridMain, FilePathName, gridActWidth, gridActHeight, RsW, RsH);
3156 3157
                         //ImageHelper.SaveUIToImage(GridMain, FilePathName, (int)(GridMain.ActualWidth * (PrimaryScreen.DpiX / 96f)), (int)(GridMain.ActualHeight * (PrimaryScreen.DpiY / 96f)), 0, 0);
3157 3158
                         //ImageHelper.SaveUIToImage(GridMain, FilePathName, (int)(ActualWidth * (PrimaryScreen.DpiX / 96f)), (int)(ActualHeight * (PrimaryScreen.DpiY / 96f)), (int)RsW, (int)RsH);
3158 3159
                         //ImageHelper.SaveUIToImage(GridMain, FilePathName, (int)(ActualWidth * (PrimaryScreen.DpiX / 96f)), (int)(ActualHeight * (PrimaryScreen.DpiY / 96f)), 1281, 1026);
@@ -3175,8 +3176,8 @@ namespace XHWK.WKTool
3175 3176
                             txbTime.Text = SRTime.ToString("mm:ss");
3176 3177
                             //});
3177 3178
                         }
3178
-                    }
3179
-                });
3179
+                    });
3180
+                }
3180 3181
             }
3181 3182
             catch (Exception ex)
3182 3183
             {
@@ -4080,9 +4081,9 @@ namespace XHWK.WKTool
4080 4081
             TranslateTransform transform1 = group.Children[1] as TranslateTransform;
4081 4082
             transform1.X = -1 * ((pointToContent.X * transform.ScaleX) - point.X);
4082 4083
             transform1.Y = -1 * ((pointToContent.Y * transform.ScaleY) - point.Y);
4083
-            LogHelper.WriteInfoLog("【img宽高】" + imgCanvas.ActualWidth.ToString() + ":"
4084
-                 + imgCanvas.ActualHeight.ToString() + "百分比:" + transform.ScaleX.ToString() + ":" + transform.ScaleY.ToString()
4085
-                );
4084
+            //LogHelper.WriteInfoLog("【img宽高】" + imgCanvas.ActualWidth.ToString() + ":"
4085
+            //     + imgCanvas.ActualHeight.ToString() + "百分比:" + transform.ScaleX.ToString() + ":" + transform.ScaleY.ToString()
4086
+            //    );
4086 4087
 
4087 4088
             //Console.WriteLine("transform.ScaleX = " + transform.ScaleX + "; transform.ScaleY = " + transform.ScaleY);
4088 4089
 

Ładowanie…
Anuluj
Zapisz