Screen capture to video with Directx9 / Directx11 and Microsoft Media Foundation
Re: Screen capture to video with Directx9 / Directx11 and Microsoft Media Foundation
Such situation means that PC is slow and You need to decrease FPS.
Re: Screen capture to video with Directx9 / Directx11 and Microsoft Media Foundation
Fixed inaccurate frame allocation algorithm.
Now consumes more CPU, but this is IMHO OK for real-time encoding.
Now consumes more CPU, but this is IMHO OK for real-time encoding.
Re: Screen capture to video with Directx9 / Directx11 and Microsoft Media Foundation
Hi malcev, thank for continuing to work on this, it's very interesting.
With the code from the first post for Win7, which appears to have been updated quite recently, I get this error:
An empty *.mp4 is produced.
Your code from ~= December 14, 2019 (no sound) is working quite well on Win7.
Regards,
burque505
With the code from the first post for Win7, which appears to have been updated quite recently, I get this error:
Code: Select all
IMFSinkWriter_SetInputMediaType error:
ErrorLevel: 0xc0000005
Your code from ~= December 14, 2019 (no sound) is working quite well on Win7.
Regards,
burque505
Re: Screen capture to video with Directx9 / Directx11 and Microsoft Media Foundation
As I understand this error occurs when You want to capture video with audio?
Try to capture video only.
Sorry, but I do not know why this error occurs to You.
Try to capture video only.
Sorry, but I do not know why this error occurs to You.
Re: Screen capture to video with Directx9 / Directx11 and Microsoft Media Foundation
I get the same error when I comment out the following lines, if I'm understanding you correctly.
I will try the Win10 code on Win10 to see if I have better luck.
Thanks again.
Regards,
burque505
Code: Select all
;audiodevice := "Microphone (HD Webcam C270)"
; x1 := 100, x2 := 1000, y1 := 100, y2 := 500
; ShowAllAudioDevicesNames := true
; CaptureCoordinatesWithCPU := true
; Rotate := true
Thanks again.
Regards,
burque505
Re: Screen capture to video with Directx9 / Directx11 and Microsoft Media Foundation
Update code in first post.
Add some options, reduce CPU consumption and fix bugs.
@burque505, as I understand from PM, Your hardware encoder does not let use MF_SINK_WRITER_DISABLE_THROTTLING attribute.
Therefore You have 2 choices:
Uncomment "UseSoftwareEncoding := true" to use software encoding.
or
Comment
Add some options, reduce CPU consumption and fix bugs.
@burque505, as I understand from PM, Your hardware encoder does not let use MF_SINK_WRITER_DISABLE_THROTTLING attribute.
Therefore You have 2 choices:
Uncomment "UseSoftwareEncoding := true" to use software encoding.
or
Comment
Code: Select all
IMFAttributes_SetUINT32(pMFAttributes, MF_GUID(GUID, "MF_SINK_WRITER_DISABLE_THROTTLING"), true)
Re: Screen capture to video with Directx9 / Directx11 and Microsoft Media Foundation
Thank you, @malcev. What you say does not surprise me as my video card is over ten years old. I really appreciate you staying on top of this, it's working quite well.
Regards,
burque505
Regards,
burque505
Re: Screen capture to video with Directx9 / Directx11 and Microsoft Media Foundation
hardware-encoder - NVIDIA H.264 Encoder MFT
Cannot find Audio device - "CABLE Output (VB-Audio Virtual Cable)"
Cannot find Audio device - "CABLE Output (VB-Audio Virtual Cable)"
Re: Screen capture to video with Directx9 / Directx11 and Microsoft Media Foundation
@TheDewd, you might try this first:
You'll get a MsgBox with whatever audio device(s) show up. Then you can comment out the 'ShowAllAudioDevicesNames := true (Edit: epic fail - or set it to 'false', I suppose) and add in 'audiodevice:=' with your device.
Regards,
burque505
Code: Select all
file := "test.mp4"
video_bitrate := 2000000
video_fps := 25
duration := 5
capture_cursor := true
;audiodevice := "Microphone (HD Webcam C270)"
; audiodevice := "CABLE Output (VB-Audio Virtual Cable)"
; x1 := 100, x2 := 1000, y1 := 100, y2 := 500
ShowAllAudioDevicesNames := true
; CaptureCoordinatesWithCPU := true
; Rotate := true
Regards,
burque505
Re: Screen capture to video with Directx9 / Directx11 and Microsoft Media Foundation
Update first code.
1) Add quotes when enumerate devices.
2) Add support for enumerating devices with the same name
3) Now You can write ShowAllAudioDevicesNames := false.
1) Add quotes when enumerate devices.
2) Add support for enumerating devices with the same name
3) Now You can write ShowAllAudioDevicesNames := false.
Re: Screen capture to video with Directx9 / Directx11 and Microsoft Media Foundation
Hi @malcev, getting this error on Win7 again with the code from 15 February:
Code from 31 January is still working fine.
Regards,
burque505
Code: Select all
IMFSinkWriter_SetInputMediaType error:
ErrorLevel: 0xc0000005
Regards,
burque505
Re: Screen capture to video with Directx9 / Directx11 and Microsoft Media Foundation
Strange. Do You get this error after:
Uncomment "UseSoftwareEncoding := true" to use software encoding.
or
Comment
?
Uncomment "UseSoftwareEncoding := true" to use software encoding.
or
Comment
Code: Select all
IMFAttributes_SetUINT32(pMFAttributes, MF_GUID(GUID, "MF_SINK_WRITER_DISABLE_THROTTLING"), true)
Re: Screen capture to video with Directx9 / Directx11 and Microsoft Media Foundation
@malcev, both of your fixes work fine for me.
Thanks!
Regards,
burque505
Thanks!
Regards,
burque505
-
- Posts: 74
- Joined: 18 May 2017, 10:56
Re: Screen capture to video with Directx9 / Directx11 and Microsoft Media Foundation
@malcev Thanks for your work. You are well experienced in this field. I would like to ask you a question that I have since long time a go. How some software programs can detect screen recording? Is your code traceable by video protector programs? How those advanced detector programs work? The second question is that how to record the video with system audio not mic? (The ShowAllAudioDevicesNames only shows "Microphone Array (Realtek High Definition Audio)").
Re: Screen capture to video with Directx9 / Directx11 and Microsoft Media Foundation
I do not know, because I have not seen such programs.How some software programs can detect screen recording?
I am sure that You can capture anything that You see on screen (there are different API to capture screen)
https://docs.microsoft.com/en-us/previous-versions/technet-magazine/hh241037(v=msdn.10)
Install virtual audio device.how to record the video with system audio not mic?
https://vb-audio.com/Cable/
BTW, Capturing with directx11 is not good now it can have empty frames.
Someday I will correct it.
-
- Posts: 74
- Joined: 18 May 2017, 10:56
Re: Screen capture to video with Directx9 / Directx11 and Microsoft Media Foundation
I disabled the speaker enhancement and it is working now but It crashes without any message when the duration is long. Is there a method to stream the screen?
My settings (DirectX 11 + DXGI (Win10)):
My settings (DirectX 11 + DXGI (Win10)):
Code: Select all
video_bitrate := 4000000
video_fps := 25
duration := 1800
capture_cursor := true
audiodevice := "Stereo Mix (Realtek High Definition Audio)"
audioDelay := 80
Rotate := true
Re: Screen capture to video with Directx9 / Directx11 and Microsoft Media Foundation
I just tested it.
For me works OK.
For me works OK.
Re: Screen capture to video with Directx9 / Directx11 and Microsoft Media Foundation
I cant make the audio work, if I un-comment this "ShowAllAudioDevicesNames := true" line, it just says
Audio:
None
Even if I typed in the Audio device name in the Sound properties dialog box by entering mmsys.cpl, its says "Cannot find audio device - Speakers (Realtek High Definition Audio)". Is there anything else I could do?
(I am using Windows 10 21H2 (Build 19044.1526)
Audio:
None
Even if I typed in the Audio device name in the Sound properties dialog box by entering mmsys.cpl, its says "Cannot find audio device - Speakers (Realtek High Definition Audio)". Is there anything else I could do?
(I am using Windows 10 21H2 (Build 19044.1526)
Return to “Scripts and Functions (v1)”
Who is online
Users browsing this forum: No registered users and 226 guests