Browse Source

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

tags/录制修改前
耀 4 years ago
parent
commit
1094d2b129

+ 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

3134
         {
3134
         {
3135
             try
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
                         //ImageHelper.SaveUIToImage(GridMain, FilePathName, (int)(GridMain.ActualWidth * (PrimaryScreen.DpiX / 96f)), (int)(GridMain.ActualHeight * (PrimaryScreen.DpiY / 96f)), 0, 0);
3157
                         //ImageHelper.SaveUIToImage(GridMain, FilePathName, (int)(GridMain.ActualWidth * (PrimaryScreen.DpiX / 96f)), (int)(GridMain.ActualHeight * (PrimaryScreen.DpiY / 96f)), 0, 0);
3157
                         //ImageHelper.SaveUIToImage(GridMain, FilePathName, (int)(ActualWidth * (PrimaryScreen.DpiX / 96f)), (int)(ActualHeight * (PrimaryScreen.DpiY / 96f)), (int)RsW, (int)RsH);
3158
                         //ImageHelper.SaveUIToImage(GridMain, FilePathName, (int)(ActualWidth * (PrimaryScreen.DpiX / 96f)), (int)(ActualHeight * (PrimaryScreen.DpiY / 96f)), (int)RsW, (int)RsH);
3158
                         //ImageHelper.SaveUIToImage(GridMain, FilePathName, (int)(ActualWidth * (PrimaryScreen.DpiX / 96f)), (int)(ActualHeight * (PrimaryScreen.DpiY / 96f)), 1281, 1026);
3159
                         //ImageHelper.SaveUIToImage(GridMain, FilePathName, (int)(ActualWidth * (PrimaryScreen.DpiX / 96f)), (int)(ActualHeight * (PrimaryScreen.DpiY / 96f)), 1281, 1026);
3175
                             txbTime.Text = SRTime.ToString("mm:ss");
3176
                             txbTime.Text = SRTime.ToString("mm:ss");
3176
                             //});
3177
                             //});
3177
                         }
3178
                         }
3178
-                    }
3179
-                });
3179
+                    });
3180
+                }
3180
             }
3181
             }
3181
             catch (Exception ex)
3182
             catch (Exception ex)
3182
             {
3183
             {
4080
             TranslateTransform transform1 = group.Children[1] as TranslateTransform;
4081
             TranslateTransform transform1 = group.Children[1] as TranslateTransform;
4081
             transform1.X = -1 * ((pointToContent.X * transform.ScaleX) - point.X);
4082
             transform1.X = -1 * ((pointToContent.X * transform.ScaleX) - point.X);
4082
             transform1.Y = -1 * ((pointToContent.Y * transform.ScaleY) - point.Y);
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
             //Console.WriteLine("transform.ScaleX = " + transform.ScaleX + "; transform.ScaleY = " + transform.ScaleY);
4088
             //Console.WriteLine("transform.ScaleX = " + transform.ScaleX + "; transform.ScaleY = " + transform.ScaleY);
4088
 
4089
 

Loading…
Cancel
Save