Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
dev
-
None
Description
I using Windows 10 and Qt 6.6 (dev branch).
I want to record a single window video.
However, the entire screen is recorded instead of a single window.
My MainWindow has the following members:
QScreenCapture m_screenCapture;
QMediaCaptureSession m_mediaCaptureSession;
QMediaRecorder m_mediaRecorder;
On the start button pressed:
m_screenCapture.setWindow(windowHandle());
m_mediaCaptureSession.setScreenCapture(&m_screenCapture);
m_mediaCaptureSession.setRecorder(&m_mediaRecorder);
m_screenCapture.setActive(true);
m_mediaRecorder.setOutputLocation(QUrl::fromLocalFile("a.mp4"));
m_mediaRecorder.record();
Even though I specify a window handle, the entire screen is recorded instead of that window.
What I have investigated is that the recording function in Windows uses QFFmpegScreenCaptureDxgi, not QFFmpegScreenCapture.
In QFFmpegMediaIntegration::createScreenCapture(),
I found that QFFmpegScreenCaptureDxgi is used when Q_OS_WINDOWS is defined.
Then I modified it to force it to use QFFmpegScreenCapture and was able to record a single window.
Questions:
- Is it possible to record a single window with the implementation using QFFmpegScreenCaptureDxgi?
- Is it possible to use QFFmpegScreenCapture in Windows environment?
- Is it possible to switch between them?