소스 검색

zhao:1多屏幕录制改为录制主屏幕。2优化消息提示

tags/录制修改前
耀 4 년 전
부모
커밋
72812a5af3

+ 5
- 4
Common/system/FFMpeg.cs 파일 보기

@@ -3,6 +3,7 @@
3 3
 using System;
4 4
 using System.Collections.Generic;
5 5
 using System.Diagnostics;
6
+using System.Drawing;
6 7
 using System.Linq;
7 8
 using System.Text;
8 9
 using System.Threading;
@@ -45,7 +46,7 @@ namespace Common.system
45 46
         /// 录制屏幕
46 47
         /// </summary>
47 48
         /// <param name="FilePath">文件存储路径</param>
48
-        public bool StartRecordingVideo(string FilePath, out string ErrMessage)
49
+        public bool StartRecordingVideo(string FilePath, Size size, out string ErrMessage)
49 50
         {
50 51
             while (myProcess != null)
51 52
             {
@@ -117,7 +118,7 @@ namespace Common.system
117 118
             switch (Extension.ToUpper())
118 119
             {
119 120
                 case ".MP4":
120
-                    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;
121
+                    myProcess.StartInfo.Arguments = SpeakerStr + MicrophoneStr + " -f gdigrab -framerate 6 -offset_x 0 -offset_y 0 -video_size " + size.Width + "x" + size.Height + " -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;
121 122
                     //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;
122 123
                     //if (string.IsNullOrWhiteSpace(MicrophoneName))
123 124
                     //{
@@ -131,7 +132,7 @@ namespace Common.system
131 132
                     break;
132 133
                 case ".AVI":
133 134
                 case ".FLV":
134
-                    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;
135
+                    myProcess.StartInfo.Arguments = SpeakerStr + MicrophoneStr + " -f gdigrab -framerate 6 -offset_x 0 -offset_y 0 -video_size " + size.Width + "x" + size.Height + " -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;
135 136
                     //if (string.IsNullOrWhiteSpace(MicrophoneName))
136 137
                     //{
137 138
                     //    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的参数
@@ -143,7 +144,7 @@ namespace Common.system
143 144
                     //}
144 145
                     break;
145 146
                 default:
146
-                    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;
147
+                    myProcess.StartInfo.Arguments = SpeakerStr + MicrophoneStr + " -f gdigrab -framerate 6 -offset_x 0 -offset_y 0 -video_size " + size.Width + "x" + size.Height + " -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;
147 148
                     break;
148 149
             }
149 150
             if (OutputVideoLog)

+ 1
- 1
Common/system/ImageHelper.cs 파일 보기

@@ -419,7 +419,7 @@ namespace Common.system
419 419
                         encoder.Save(memoryStream);
420 420
                         new Thread(new ThreadStart(new Action(() =>
421 421
                         {
422
-                        //System.Drawing.Image img = System.Drawing.Image.FromStream(memoryStream);
422
+                            //System.Drawing.Image img = System.Drawing.Image.FromStream(memoryStream);
423 423
                             Bitmap bit = new Bitmap(memoryStream);
424 424
                             if (ImgWidth - 2 < bit.Width)
425 425
                             {

+ 2
- 7
Common/system/MouseEventCommon.cs 파일 보기

@@ -1,9 +1,4 @@
1
-using System;
2
-using System.Collections.Generic;
3
-using System.Linq;
4
-using System.Runtime.InteropServices;
5
-using System.Text;
6
-using System.Threading.Tasks;
1
+using System.Runtime.InteropServices;
7 2
 
8 3
 namespace Common.system
9 4
 {
@@ -22,7 +17,7 @@ namespace Common.system
22 17
         /// <returns></returns>
23 18
         [DllImport("user32.dll")]
24 19
         public static extern int SetCursorPos(int x, int y);
25
-        
20
+
26 21
         /// <summary>   
27 22
         /// 获取鼠标的坐标   
28 23
         /// </summary>   

+ 1
- 1
XHWK.WKTool/App.cs 파일 보기

@@ -544,7 +544,7 @@ namespace XHWK.WKTool
544 544
                 }
545 545
                 else
546 546
                 {
547
-                    MessageBoxResult br = MessageWindow.Show("不安装环境将无法使用微课录制系统,是否重新安装?", "安装", MessageBoxButton.OKCancel);
547
+                    MessageBoxResult br = MessageWindow.Show("不安装环境将无法使用微课录制系统,是否现在安装?", "安装", MessageBoxButton.OKCancel);
548 548
                     if (br == MessageBoxResult.OK)
549 549
                     {
550 550
                         return InstallScreenCapturerRecorder();

+ 1
- 0
XHWK.WKTool/PracticeWindow.xaml.cs 파일 보기

@@ -1,4 +1,5 @@
1 1
 using Common.system;
2
+
2 3
 using System;
3 4
 using System.Collections.Generic;
4 5
 using System.Threading;

+ 3
- 3
XHWK.WKTool/PrintWindow.xaml.cs 파일 보기

@@ -84,7 +84,7 @@ namespace XHWK.WKTool
84 84
             if (string.IsNullOrWhiteSpace(cmbClass.Text))
85 85
             {
86 86
                 //MessageWindow.Show("打印机不能为空!");
87
-                MessageWindow.Show("打印机不能为空!");
87
+                MessageWindow.Show("请设置打印机!");
88 88
                 return;
89 89
             }
90 90
             //APP.myloading.Show();
@@ -420,8 +420,8 @@ namespace XHWK.WKTool
420 420
                         Dispatcher.Invoke(() =>
421 421
                         {
422 422
                             tip_outer.Visibility = Visibility.Collapsed;
423
-                                //tip_outer.Visibility = Visibility.Collapsed;
424
-                                MessageWindow.Show("打印成功");
423
+                            //tip_outer.Visibility = Visibility.Collapsed;
424
+                            MessageWindow.Show("打印成功");
425 425
                         });
426 426
                     }))).Start();
427 427
                 }

+ 4
- 4
XHWK.WKTool/ScreenRecordingToolbarWindow.xaml.cs 파일 보기

@@ -2,7 +2,6 @@
2 2
 
3 3
 using System;
4 4
 using System.IO;
5
-using System.Runtime.InteropServices;
6 5
 using System.Threading;
7 6
 using System.Windows;
8 7
 using System.Windows.Forms;
@@ -426,7 +425,8 @@ namespace XHWK.WKTool
426 425
                         {
427 426
                             Thread.Sleep(100);
428 427
                         }
429
-                        bool SynRes = APP.FFmpeg.StartRecordingVideo(VideoSavePathName, out string ErrMessage);
428
+                        System.Drawing.Size DesktopSize = PrimaryScreen.DESKTOP;
429
+                        bool SynRes = APP.FFmpeg.StartRecordingVideo(VideoSavePathName, DesktopSize, out string ErrMessage);
430 430
 
431 431
                         Thread.Sleep(1300);
432 432
                         Dispatcher.Invoke(() =>
@@ -599,7 +599,7 @@ namespace XHWK.WKTool
599 599
                         //视频过短
600 600
                         APP.FFmpeg.SuspendFFmpeg();
601 601
                         IsFirstRS = true;
602
-                        MessageWindow.Show("保存失败,录屏时间过短!");
602
+                        MessageWindow.Show("录屏时间过短,请重新录制!");
603 603
                     }
604 604
                 }
605 605
                 catch (Exception ex)
@@ -1100,7 +1100,7 @@ namespace XHWK.WKTool
1100 1100
         {
1101 1101
             if (!IsFirstRS)
1102 1102
             {
1103
-                MessageBoxResult br = MessageWindow.Show("退出将不保存当前录屏!", "提示", MessageBoxButton.OKCancel);
1103
+                MessageBoxResult br = MessageWindow.Show("退出将取消保存当前录屏,是否继续?", "提示", MessageBoxButton.OKCancel);
1104 1104
                 if (br == MessageBoxResult.Cancel)
1105 1105
                 {
1106 1106
                     return;

+ 2
- 2
XHWK.WKTool/UploadWindow.xaml.cs 파일 보기

@@ -198,7 +198,7 @@ namespace XHWK.WKTool
198 198
         {
199 199
             if (string.IsNullOrWhiteSpace(book_list.Text))
200 200
             {
201
-                MessageWindow.Show("教材不能为空!");
201
+                MessageWindow.Show("请选择教材!");
202 202
             }
203 203
             btnStart.IsEnabled = false;
204 204
             book_list.IsEnabled = false;
@@ -331,7 +331,7 @@ namespace XHWK.WKTool
331 331
                     cmbTeachingMaterial.IsEnabled = true;
332 332
                     times.Stop();
333 333
                     tip_outer.Visibility = Visibility.Collapsed;
334
-                    MessageWindow.Show("视频上传失败!");
334
+                    MessageWindow.Show("无法上传视频,请检查与服务器链接状态!");
335 335
                     APP.IsUpLoad = false;
336 336
                     Hide();
337 337
                     LogHelper.WriteErrLog("【UploadWindow】(BtnStart_Click)" + ex.Message, ex);

+ 12
- 12
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs 파일 보기

@@ -184,7 +184,7 @@ namespace XHWK.WKTool
184 184
         /// </summary>
185 185
         public void Initialize()
186 186
         {
187
-            if(APP.isDebug)
187
+            if (APP.isDebug)
188 188
             {
189 189
                 txbVersion.Text = "测试版:";
190 190
             }
@@ -192,7 +192,7 @@ namespace XHWK.WKTool
192 192
             {
193 193
                 txbVersion.Text = "正式版:";
194 194
             }
195
-           
195
+
196 196
             #region 数据初始化
197 197
             string pathTemp = AppDomain.CurrentDomain.BaseDirectory + "Temp\\";
198 198
             FileToolsCommon.CreateDirectory(pathTemp);
@@ -677,7 +677,7 @@ namespace XHWK.WKTool
677 677
                 }
678 678
                 else
679 679
                 {
680
-                    MessageWindow.Show("接口地址未输入");
680
+                    MessageWindow.Show("请输入接口地址");
681 681
                     return;
682 682
                 }
683 683
                 if (!string.IsNullOrWhiteSpace(txbImageUploadAddress.Text))//图片上传地址
@@ -688,7 +688,7 @@ namespace XHWK.WKTool
688 688
                 }
689 689
                 else
690 690
                 {
691
-                    MessageWindow.Show("上传地址未输入");
691
+                    MessageWindow.Show("请输入上传地址");
692 692
                     return;
693 693
                 }
694 694
                 if (!string.IsNullOrWhiteSpace(txbPictureShowsAddress.Text))
@@ -699,7 +699,7 @@ namespace XHWK.WKTool
699 699
                 }
700 700
                 else
701 701
                 {
702
-                    MessageWindow.Show("下载地址未输入");
702
+                    MessageWindow.Show("请输入下载地址");
703 703
                     return;
704 704
                 }
705 705
                 if (!APP.apiUrl.Equals("http://" + txbInterfaceAddress.Text))
@@ -782,7 +782,7 @@ namespace XHWK.WKTool
782 782
                 {
783 783
                     //存储文件
784 784
                     FileToolsCommon.SetConfigValue("VideoSavePath", txbStoragePath.Content.ToString());
785
-                    MessageWindow.Show("路径已变更,下次创建微课时自动生效!!!");
785
+                    MessageWindow.Show("路径已变更,下次创建微课时自动生效");
786 786
                 }
787 787
             }
788 788
             catch (Exception ex)
@@ -1290,7 +1290,7 @@ namespace XHWK.WKTool
1290 1290
                         {
1291 1291
                             Dispatcher.Invoke(new Action(() =>
1292 1292
                             {
1293
-                                MessageWindow.Show("文件无效或处于打开状态!");
1293
+                                MessageWindow.Show("无法访问文件,请检查文件是否有效或解除文件占用!");
1294 1294
                             }));
1295 1295
 
1296 1296
                             LogHelper.WriteErrLog("【打开ppt】(OpenDialog PPT)" + ex.Message, ex);
@@ -1487,7 +1487,7 @@ namespace XHWK.WKTool
1487 1487
                         {
1488 1488
                             Dispatcher.Invoke(new Action(() =>
1489 1489
                             {
1490
-                                MessageWindow.Show("文件无效或处于打开状态!");
1490
+                                MessageWindow.Show("无法访问文件,请检查文件是否有效或解除文件占用!");
1491 1491
                             }));
1492 1492
                             LogHelper.WriteErrLog("【XHMicroLessonSystemWindow】(OpenDialog 导入文档)" + ex.Message, ex);
1493 1493
                         }
@@ -1631,7 +1631,7 @@ namespace XHWK.WKTool
1631 1631
                                   catch (Exception ex)
1632 1632
                                   {
1633 1633
                                       APP.myloading.Hide();
1634
-                                      MessageWindow.Show("文件无效或者文件被加密!");
1634
+                                      MessageWindow.Show("无法访问文件,请检查文件是否有效或解除文件占用!");
1635 1635
                                       LogHelper.WriteErrLog("【打开ppt】(OpenDialog PPT)" + ex.Message, ex);
1636 1636
                                   }
1637 1637
                               }
@@ -3455,14 +3455,14 @@ namespace XHWK.WKTool
3455 3455
                         timer.Dispose();
3456 3456
                         IsFirstR = true;
3457 3457
 
3458
-                      
3459 3458
 
3460
-                      
3459
+
3460
+
3461 3461
                         BtnRecord.IsEnabled = true;
3462 3462
                         btnStop.IsEnabled = true;
3463 3463
                         TxbRecordingWord.Text = "录制";
3464 3464
                         txbType.Text = "";
3465
-                        MessageWindow.Show("保存失败,录制时间过短");
3465
+                        MessageWindow.Show("录制时间过短,请重新录制!");
3466 3466
                         Dispatcher.Invoke(() =>
3467 3467
                         {
3468 3468
                             txbTime.Text = "";

Loading…
취소
저장