From 82daa08a7ea1f99bc89654c709ff1c6a4d1925ce Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 6 Sep 2023 23:04:59 +0200 Subject: [PATCH] ScreenRecorder: Support recording on macOS Change-Id: I1f5429939acf82235caf07af85ab3397aee5955d Reviewed-by: Marcus Tillmanns --- src/plugins/screenrecorder/record.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/plugins/screenrecorder/record.cpp b/src/plugins/screenrecorder/record.cpp index 62db3bad212..d60501e092a 100644 --- a/src/plugins/screenrecorder/record.cpp +++ b/src/plugins/screenrecorder/record.cpp @@ -338,14 +338,22 @@ QStringList RecordWidget::ffmpegParameters(const ClipInfo &clipInfo) const }; break; } - case OsTypeMac: + case OsTypeMac: { videoGrabParams = { "-f", "avfoundation", "-framerate", frameRateStr, - "-video_size", sizeStr(rS.cropRect.size()), - "-i", QString("%1:none").arg(screenIdStr), + "-pixel_format", "bgr0", + "-i", QString("Capture screen %1:none").arg(rS.screenId), }; + if (!rS.cropRect.isNull()) { + videoGrabParams.append({ + "-filter_complex", QString("crop=x=%1:y=%2:w=%3:h=%4") + .arg(rS.cropRect.x()).arg(rS.cropRect.y()) + .arg(rS.cropRect.width()).arg(rS.cropRect.height()) + }); + } break; + } default: break; }