Browse Source

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

tags/录制修改前
耀 4 years ago
parent
commit
72812a5af3

+ 5
- 4
Common/system/FFMpeg.cs View File

3
 using System;
3
 using System;
4
 using System.Collections.Generic;
4
 using System.Collections.Generic;
5
 using System.Diagnostics;
5
 using System.Diagnostics;
6
+using System.Drawing;
6
 using System.Linq;
7
 using System.Linq;
7
 using System.Text;
8
 using System.Text;
8
 using System.Threading;
9
 using System.Threading;
45
         /// 录制屏幕
46
         /// 录制屏幕
46
         /// </summary>
47
         /// </summary>
47
         /// <param name="FilePath">文件存储路径</param>
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
             while (myProcess != null)
51
             while (myProcess != null)
51
             {
52
             {
117
             switch (Extension.ToUpper())
118
             switch (Extension.ToUpper())
118
             {
119
             {
119
                 case ".MP4":
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
                     //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
                     //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
                     //if (string.IsNullOrWhiteSpace(MicrophoneName))
123
                     //if (string.IsNullOrWhiteSpace(MicrophoneName))
123
                     //{
124
                     //{
131
                     break;
132
                     break;
132
                 case ".AVI":
133
                 case ".AVI":
133
                 case ".FLV":
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
                     //if (string.IsNullOrWhiteSpace(MicrophoneName))
136
                     //if (string.IsNullOrWhiteSpace(MicrophoneName))
136
                     //{
137
                     //{
137
                     //    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的参数
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
                     //}
144
                     //}
144
                     break;
145
                     break;
145
                 default:
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
                     break;
148
                     break;
148
             }
149
             }
149
             if (OutputVideoLog)
150
             if (OutputVideoLog)

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

419
                         encoder.Save(memoryStream);
419
                         encoder.Save(memoryStream);
420
                         new Thread(new ThreadStart(new Action(() =>
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
                             Bitmap bit = new Bitmap(memoryStream);
423
                             Bitmap bit = new Bitmap(memoryStream);
424
                             if (ImgWidth - 2 < bit.Width)
424
                             if (ImgWidth - 2 < bit.Width)
425
                             {
425
                             {

+ 2
- 7
Common/system/MouseEventCommon.cs View File

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
 namespace Common.system
3
 namespace Common.system
9
 {
4
 {
22
         /// <returns></returns>
17
         /// <returns></returns>
23
         [DllImport("user32.dll")]
18
         [DllImport("user32.dll")]
24
         public static extern int SetCursorPos(int x, int y);
19
         public static extern int SetCursorPos(int x, int y);
25
-        
20
+
26
         /// <summary>   
21
         /// <summary>   
27
         /// 获取鼠标的坐标   
22
         /// 获取鼠标的坐标   
28
         /// </summary>   
23
         /// </summary>   

+ 1
- 1
XHWK.WKTool/App.cs View File

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

+ 1
- 0
XHWK.WKTool/PracticeWindow.xaml.cs View File

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

+ 3
- 3
XHWK.WKTool/PrintWindow.xaml.cs View File

84
             if (string.IsNullOrWhiteSpace(cmbClass.Text))
84
             if (string.IsNullOrWhiteSpace(cmbClass.Text))
85
             {
85
             {
86
                 //MessageWindow.Show("打印机不能为空!");
86
                 //MessageWindow.Show("打印机不能为空!");
87
-                MessageWindow.Show("打印机不能为空!");
87
+                MessageWindow.Show("请设置打印机!");
88
                 return;
88
                 return;
89
             }
89
             }
90
             //APP.myloading.Show();
90
             //APP.myloading.Show();
420
                         Dispatcher.Invoke(() =>
420
                         Dispatcher.Invoke(() =>
421
                         {
421
                         {
422
                             tip_outer.Visibility = Visibility.Collapsed;
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
                     }))).Start();
426
                     }))).Start();
427
                 }
427
                 }

+ 4
- 4
XHWK.WKTool/ScreenRecordingToolbarWindow.xaml.cs View File

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

+ 2
- 2
XHWK.WKTool/UploadWindow.xaml.cs View File

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

+ 12
- 12
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs View File

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

Loading…
Cancel
Save