rdp / virtual-audio-capture-grabber-device

free audio capture device to capture all the "wave out sound" that is playing on your speakers (i.e. record what you hear) for Windows Vista+. Releases downloadable in this package:
https://github.com/rdp/screen-capture-recorder-to-video-windows-free
Other
578 stars 181 forks source link

How to capture a movable window without black area? #12

Open matinlotfali opened 10 years ago

matinlotfali commented 10 years ago

I use ffmpeg to record a window using this code:

ffmpeg.exe -f dshow -y -i video="screen-capture-recorder":audio="virtual-audio-capturer":audio="Microphone (USB Audio Device)" -framerate 15 -vcodec libx264 -crf 0 -preset ultrafast -acodec pcm_s16le -vf crop=Width:Height:Left:Top output.flv

But the problem is i might move the window, this leads to recording an area without the window i want. How can I capture a specific window that I am able to move it? I also used gdigrab to capture my window (Skype for instance) instead of dshow:

ffmpeg.exe -y -f dshow -i audio="virtual-audio-capturer":audio="Microphone (USB Audio Device)" -f gdigrab -draw_mouse 0 -i title="Skype" -framerate 30 -vcodec libx264 -crf 0 -preset ultrafast -acodec pcm_s16le output.flv

But the conference area is black... How can i do this?

mca64 commented 10 years ago

you may try my application. It uses FFmep and screen-capture-recorder http://mca64.com

matinlotfali commented 10 years ago

Thanks but i am using this in my own application. I want to use my own gui.

rdp commented 10 years ago

does gdigrab work? re: conference area being black, that is a bit odd...this is with windows 8?

On Sun, Aug 24, 2014 at 6:57 AM, Matin Lotfaliee notifications@github.com wrote:

I use ffmpeg to record a window using this code:

ffmpeg.exe -f dshow -y -i video="screen-capture-recorder":audio="virtual-audio-capturer":audio="Microphone (USB Audio Device)" -framerate 15 -vcodec libx264 -crf 0 -preset ultrafast -acodec pcm_s16le -vf crop=Width:Height:Left:Top output.flv

But the problem is i might move the window, this leads to recording an area without the window i want. How can I capture a specific window that I am able to move it? I also used gdigrab to capture my window (Skype for instance) instead of dshow:

ffmpeg.exe -y -f dshow -i audio="virtual-audio-capturer":audio="Microphone (USB Audio Device)" -f gdigrab -draw_mouse 0 -i title="Skype" -framerate 30 -vcodec libx264 -crf 0 -preset ultrafast -acodec pcm_s16le output.flv

But the conference area is black... How can i do this?

— Reply to this email directly or view it on GitHub https://github.com/rdp/virtual-audio-capture-grabber-device/issues/12.

matinlotfali commented 10 years ago

gdigrab works great on -i desktop but when i use -i title the conference area is black. this is with windows 7. does screen-capture-recorder have window capturing support? I also have access to the window pointer (IntPtr)

mca64 commented 10 years ago

screen capturer and probally gdigrab works like you were making screenshot with PRTSC key, if there is black screen after PRTSC and pasting it to PAINT or other graphic program nothing you can do it.

matinlotfali commented 10 years ago

No i don't have any black area when using PRTSC. Screen capturer & "gdigrab -i desktop" are also good but they capture whole desktop that i don't want to. The only good solution that i can capture a movable window is "gdigrab -i title" that captures a black area inside the window instead of the conference.

mca64 commented 10 years ago

you can use hwnd_to_track_with_window_decoration or hwnd_to_track with screen-capture-recorder. HKEY_CURRENT_USER\Software\screen-capture-recorder\hwnd_to_track and REG_DWORD value of HWND captured window

all you must do is get somehow HWND of the window

mca64 commented 10 years ago

http://i.imgur.com/oO5f0jz.png start_x and start_y must be set to 0 and capture_width and capture_height contains window dimension

rdp commented 10 years ago

If capturing desktop works but not that hwnd, it's probably some child "hwnd" that is the actual area...try using a windows spy utility to see if this is the case, GL!

On Tue, Aug 26, 2014 at 5:44 AM, Matin Lotfaliee notifications@github.com wrote:

No i don't have any black area when using PRTSC. Screen capturer & "gdigrab -i desktop" are also good but they capture whole desktop that i don't want to. The only good solution that i can capture a movable window is "gdigrab -i title" that captures a black area inside the window instead of the conference.

— Reply to this email directly or view it on GitHub https://github.com/rdp/virtual-audio-capture-grabber-device/issues/12#issuecomment-53407898 .

zhangdexin commented 7 years ago

I met the same question, can you solve it, thanks?

rdp commented 7 years ago

I probably could with funding...

HoseinBahmany commented 3 years ago

I know this is question is rather old but I came across the same situation and thought maybe sharing my observations here could help someone else.

I'm developing an electron-based application and needed to implement screen recording that could arbitrarily capture other open windows as well as screens.

Although usually using gdigrab and screen-capture-recorder on Windows work pretty great, I noticed that they cannot capture some of the other application windows such as Skype, Slack, Whatsapp, or event my own app window (You'll get total black screens in the recordings).

The shared theme of all these apps where that they were Electron-based. Then I found this: https://discuss.atom.io/t/using-ffmpeg-to-record-electron-application-in-win10-will-be-black-screen/57221. And it works. If you change the compatibility mode of those applications to Windows 7, you'll no longer get the black screen in the recording.

But I noticed that some of the other apps such as Spotify although having default Windows 8 compatibility mode did not have the same issue. So the issue is not just the Windows 7 compatibility.

Then I did what @rdp suggested and used Spy++ on those Electron windows. It turns out all of them have nested windows that do the actual rendering. That's because Hardware Acceleration is turned on by default in Electron apps and gdigrab cannot capture hardware accelerated windows (https://trac.ffmpeg.org/ticket/7718). If you turn hardware acceleration off, then there is no need to change windows compatibility to Windows 7 anymore.

Cheers

rdp commented 3 years ago

Thanks!

On Sunday, May 16, 2021, HoseinBahmany @.***> wrote:

I know this is question is rather old but I came across the same situation and thought maybe sharing my observations here could help someone else.

I'm developing an electron-based application and needed to implement screen recording that could arbitrarily capture other open windows as well as screens.

Although usually using gdigrab and screen-capture-recorder on Windows work pretty great, I noticed that they cannot capture some of the other application windows such as Skype, Slack, Whatsapp, or event my own app window (You'll get total black screens in the recordings).

The shared theme of all these apps where that they were Electron-based. Then I found this: https://discuss.atom.io/t/using-ffmpeg-to-record-electron-application-in-win10-will-be-black-screen/57221. And it works. If you change the compatibility mode of those applications to Windows 7, you'll no longer get the black screen in the recording.

But I noticed that some of the other apps such as Spotify although having default Windows 8 compatibility mode did not have the same issue. So the issue is not just the Windows 7 compatibility.

Then I did what @rdp suggested and used Spy++ on those Electron windows. It turns out all of them have nested windows that do the actual rendering. That's because Hardware Acceleration is turned on by default in Electron apps and gdigrab cannot capture hardware accelerated windows ( https://trac.ffmpeg.org/ticket/7718). If you turn hardware acceleration off, then there is no need to change windows compatibility to Windows 7 anymore.

Cheers

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.< https://ci4.googleusercontent.com/proxy/9NJfi5CAtsOL-6syOwUgoI4nOZeEObqvH6mhrCEaT48ncW50lOkKaUdnqHNfZ3dVDner6sXukG4W50B5vFIpFg5pjYlkuiff_AVkp-ccJfWSJoAMpS3yCCPaGthDzeOOBiFkoYkxFAKWgpGKpTuEMDH0md29iWfSZTMmnot2FUKXQ79fIpzj7O1IYu0-aw-VMAiTSuaoL_XHW3imib9gYLWizkjGCCFLjozUw6k56g=s0-d-e1-ft#https://github.com/notifications/beacon/AAADBUF5TYW5YFWLXG776SDTN6ZBBA5CNFSM4ATKGIKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGIWPYCA.gif>

rdp commented 1 year ago

Capturing by HWND should work?