From c1ef97155b1116796f41cb9656200a5a1e7004a5 Mon Sep 17 00:00:00 2001 From: linxiao Date: Wed, 17 Oct 2018 00:02:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=B1=8F=E5=B9=95=E5=BD=95?= =?UTF-8?q?=E5=88=B6gidgrab=E9=80=89=E9=A1=B9=EF=BC=8C=E8=A7=A3=E5=86=B3dp?= =?UTF-8?q?i=E7=BC=A9=E6=94=BE=E5=BD=95=E5=88=B6=E5=B1=8F=E5=B9=95?= =?UTF-8?q?=E4=B8=8D=E5=AE=8C=E6=95=B4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RecordVideo.py | 16 ++++++++++++---- SettingWindow.py | 2 ++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/RecordVideo.py b/RecordVideo.py index c1b401a..2caece0 100644 --- a/RecordVideo.py +++ b/RecordVideo.py @@ -214,15 +214,23 @@ class RecordVideo(): ) # print(record_cmd) self.record(record_cmd, self.start_ffmpeg) - + + def get_screen_device(self): + pass + def record_screen(self, resolution='1024x768'): if self.screen_name and self.system_voice_device_name: self.record_type=RecordType.Screen if self.adaptive_screen_resolution is not True: resolution = self.resolution - record_cmd='ffmpeg -f dshow -i video="{}":audio="{}" -acodec libmp3lame -vcodec {} -preset:v ultrafast -tune:v zerolatency -s {} -r {} -threads {} -y {}'.format( - self.deal_with_device_name(self.screen_name), - self.deal_with_device_name(self.system_voice_device_name), + device_cmd_str = '' + if self.screen_name.lower().find('gdigrab') >=0: + #使用gdigrab录制屏幕 + device_cmd_str = '-f dshow -i audio="{}" -f gdigrab -i desktop'.format(self.system_voice_device_name) + else: + device_cmd_str = '-f dshow -i video="{}":audio="{}"'.format(self.screen_name, self.system_voice_device_name) + record_cmd='ffmpeg {} -acodec libmp3lame -vcodec {} -preset:v ultrafast -tune:v zerolatency -s {} -r {} -threads {} -y {}'.format( + device_cmd_str, self.video_codec, # '1024x768', #屏幕录制分辨率固定 resolution, diff --git a/SettingWindow.py b/SettingWindow.py index 37104bf..a69439d 100644 --- a/SettingWindow.py +++ b/SettingWindow.py @@ -295,6 +295,8 @@ class SettingWindow(QDialog): ''' #设备 di = DevicesInfo() + #gdigrab + di.video_devices.append(['GDI Grab', 'gdigrab']) self.load_combobox_data(self.cb_camera_devices, di.video_devices) self.load_combobox_data(self.cb_screen_devices, di.video_devices) self.load_combobox_data(self.cb_voice_devices, di.voice_devices)