添加屏幕录制gidgrab选项,解决dpi缩放录制屏幕不完整问题

master
linxiao 2018-10-17 00:02:06 +08:00
parent e4687355da
commit c1ef97155b
2 changed files with 14 additions and 4 deletions

View File

@ -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,

View File

@ -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)