Giter Club home page Giter Club logo

wcap's Introduction

wcap

Simple and efficient screen recording utility for Windows.

Get latest binary here: wcap.exe (WARNING: Windows Defender or other AV software might report false positive detection)

Features

  • press Ctrl + PrintScreen to start recording current monitor (where mouse cursor currently is positioned)
  • press Ctrl + Win + PrintScreen to start recording currently active window
  • press Ctrl + Shift + PrintScreen to select & record fixed position area on current monitor
  • press any of previous combinations to stop recording
  • right or double-click on tray icon to change settings
  • video encoded using H264/AVC or H265/HEVC, with 10-bit support for HEVC
  • audio encoded using AAC or FLAC
  • for window capture can capture full window area (including title bar/borders) or just the client area
  • optionally exclude mouse cursor from capture
  • can limit recording length in seconds or file size in MB's
  • can limit max width, height or framerate - captured frames will be automatically downscaled

Details

wcap uses Windows.Graphics.Capture API available since Windows 10 version 1903, May 2019 Update (19H1) to capture contents of window or whole monitor. Captured texture is submitted to Media Foundation to encode video to mp4 file with hardware accelerated codec. Using capture from compositor and hardware accelerated encoder allows it to consume very little CPU and memory.

You can choose in settings to capture only client area or full size of window - client area will not include title bar and borders for standard windows style. Recorded video size is determined by initial window size.

Make sure your GPU drivers are updated if something is not working with hardware video encoding - by default hardware encoder is enabled, you can disable it in settings - then video will be encoded using Microsoft Media Foundation H264 software encoder. You might want to explicitly use software encoder on older GPU's as their hardware encoder quality is not great.

H265 encoding might require installing HEVC package from Microsoft Store - copy following link into Explorer address bar, or in Start->Run dialog:

windows-store://pdp/?ProductId=9n4wgh0z6vhq

Audio is captured using WASAPI loopback recording and encoded using Microsoft Media Foundation AAC encoder, or undocumented Media Foundation FLAC encoder (it seems it always is present in Windows 10).

Recorded mp4 file can be set to use fragmented mp4 format in settings (only for H264 codec). Fragmented mp4 file does not require "finalizing" it. Which means that in case application or GPU driver crashes or if you run out of disk space then the partial mp4 file will be valid for playback. The disadvantage of fragmented mp4 file is that it is a bit larger than normal mp4 format, and seeking is slower.

You can use settings dialog to restrict max resolution of video - captured image will be scaled down to keep aspect ratio if you set any of max width/height settings to non-zero value. Similarly framerate of capture can be reduced to limit maximum amount of frames per second. Setting it to zero will use compositor framerate which is typically monitor refresh rate. Lower video framerate will give higher quality video for same bitrate and reduced GPU usage. If you notice too many dropped frames during recording, try reducing video resolution and framerate.

Capture of mouse cursor in video can be disabled only when using Windows 10 version 2004, May 2020 Update (20H1) or newer.

Creating gif from mp4

If you want to create gif file out of recorded mp4 file, you can use following .bat file:

ffmpeg.exe -hide_banner -nostdin -loglevel fatal -stats -y -i %1 -filter_complex "[0]fps=15,split[v0][v1];[v0]palettegen=stats_mode=full[p];[v1][p]paletteuse" %~n1.gif

And to use new palette every frame to have more colors, but larger file size:

ffmpeg.exe -hide_banner -nostdin -loglevel fatal -stats -y -i %1 -filter_complex "[0]fps=15,split[v0][v1];[v0]palettegen=stats_mode=single[p];[v1][p]paletteuse=new=1" %~n1.gif

Put this line in make_gif.bat file, place ffmpeg executable next to it and then simply drag & drop .mp4 file on top of it. Change fps=15 to desired gif fps (or remove to use original video fps). Check the paletteuse filter arguments for different dither methods.

Building

To build the binary from source code, have Visual Studio installed, and simply run build.cmd.

Changelog

2022.11.06
  • remove notifications on start & stop of capture
  • remove Windows 10 version check on startup, code always assumes Windows 10
  • support for 10-bit HEVC encoding
older entries

2021.12.21
  • allow to choose integrated vs discrete GPU to use for encoding
  • keep proper encoded video stream time when no new frames are captured
2021.12.18
  • fixed wrong audio timestamps when encoding audio
  • fixed wrong d3d11 calls to copy texture when size is odd
  • fixed hanging when encoding audio & video with too many dropped frames
2021.12.08
  • fixed compute shaders to work on older D3D11 hardware
2021.12.05
  • allow to selected limited vs full range for YUV conversion
2021.12.04
  • improved resizing and YUV conversion quality
  • improved performance for drawing background for rectangle selection
  • fix crash when child window is in foreground for window capture
2021.10.17
  • allow to configure keyboad shortcuts
2021.10.04
  • option to encode video with HEVC codec
  • option to encode audio with FLAC codec
  • allow limit file length or size
  • allow to choose output folder location
  • customize audio codec channels & samplerate
2021.09.25
  • allow to capture fixed position rectangle area on screen
  • prevent config dialog to be open multiple times
2021.09.20
  • added WASAPI loopback recording
  • audio is encoded using AAC codec
  • fix crash when capturing toolbar window
2021.09.19
  • initial release

License

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

wcap's People

Contributors

mmozeiko avatar pmttavara avatar vhebert-gh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wcap's Issues

Incorrect detection of Windows version

I was trying to run this, and got this error:
image

My Windows version:
image

I am definitely meeting the requirement stated. I altered Capture_IsSupported to simply return TRUE and that prevents the error but the program still doesn't appear to run; I've just hidden the error.

I don't know enough about C++ to be able to print out dwMajorVersion and dwBuildNumber to the command line. Apparently, adding #include <stdio.h> at the top of the file isn't enough to make printf work.

Request/Help: H265

Hello @mmozeiko,
The recorded file using h265 (Main_420_8) codec has noise while using the latest version and the earlier version (prior to convert buffer) works as expected. PFA of mock-ups for the same. Can you please advice how to address it?

earlier/working version:
H265Works

not working:
H265Noise

Thanks,
Muthu

Capturing active window results in empty files

Hi there, first let me thank you for this amazing tool :)

While the modes capturing the monitor and rectangle work, I've noticed the "active window" mode creates 0-byte files on my system.

If there's anything I can do to help debug this issue, let me know!

Microsoft Windows [Version 10.0.19043.1415]

Cheers

Big artifacts in monitor capture

20230704_122330.mp4

I just recorded this and it's got some pretty heavy artifacts. I understand this gives you little to no information to debug this issue, but I'm opening this to ask what else is there you might need to figure out why this is happening, or if this is intended behavior. I'm on windows 11 with a laptop nvidia gtx 1050 TI

Feature request: command line trigger

Would it be feasible to add the ability to launch (if not already loaded) and trigger active window (or full screen) recording with a flag from the command line (or a script)?

Shortcut keys fail/not respond when recording certain windows

When I'm recording League of Legends, I can't use the hotkeys. Specifically, when my mouse is over the League of Legends window, the hotkeys don't work, but when I move the mouse back to the desktop, I can record. The recording of the League of Legends window is normal; it's just that I can't use the hotkeys within the window.

It only records one second of video

99% of the time, wcap only records about a second of video. I have not been able to reliably reproduce the 1% of the time where it records until I tell it to stop. On rare occasion, it happens once if I change the settings back and fourth for a bit, and then goes back to only recording one second.

While recording, it displays the yellow borders as though it is still recording, but the stored file will be 100-600 KB and no longer than 1-2 seconds.

Sorry that this bug report is a little vague, but this is all I know right now. Please tell me if there's anything more I can do to help solve this, because it makes wcap completely unusable for me.

20230823_134049.mp4
20230823_134806.mp4
20230823_134940.mp4

I'm on W10, btw.

Latest version records a green screen

Latest version records an empty green video, and a second after I press the shortcut to stop recording, the program exits.
I don't know if this was introduced in this particular version, cause I've missed a couple of updates.

This is on a Thinkpad with Windows 11, Intel GPU HD4600, Core i5 4300M

I tried both the provided binary, and also built it myself.

wcap is not recording

im need help idk why wcap is not recording, tho wcap had open but when i try to record it wont record
Please i need help

[Possible Bug]: Recordings are not clear.

20240123_172213.mp4
20240123_172843.mp4
20240123_172933.mp4

I am have tried recording an win32-app window while listening to messages from
spy++64-bit.
I tried both h264 and h265, I tried iGPU and dGPU and I tried without GPU encoding all together. (this is why I am attaching different video samples, not sure if that is relevant or helpful tho).

I am not sure what info to provide ( aside from using windows 11 Pro build number 23H2) so I attached dxdiag system info to this issue.
DxDiag.txt

Audio via Microphone capture

Hi,

Is audio capture via microphone a planned feature? wcap does not appear to record from my attached microphone, but it does capture system audio.

Thanks

recording fps drops when recording games

Hi, thanks for this terrific work.

I encountered a problem when I use wcap.exe to record games such as HORIZON 5 or Microsoft Flight Simulator, the FPS in result file may drop to 10 or even less especial when the camera moves (the FPS in games didn't fluctuate). I have tried lots of combination settings(including FPS, hardware/software encoding, resolutions, etc...), but none of them helps.

I tried to modify some codes but am unfamiliar with Windows Media Foundation and d3d program. I saw some error logs but I don't know if they were relative to this issue. It happens when the code runs into IMFSinkWriter_SetInputMediaType

2022-09-02 19:58:22.875     1B48 [AMFH264AsyncEncoderMF]   Error: ..\..\..\..\..\runtime\src\mft\vceencoder\H264AsyncEncoderMFT.cpp(179):OnCheckInputType(1): Output type must be set first.
2022-09-02 19:58:22.875     1B48 [AMFAsyncMFTBase]   Error: ..\..\..\..\..\runtime\src\mft\mft-framework\AsyncMFTBase.cpp(709):AsyncMFTBase(1)::OnCheckInputType(StreamID=0) - failed with HRESULT(0xC00D6D60)
2022-09-02 19:58:22.875     1B48 [AMFH264AsyncEncoderMF]   Error: ..\..\..\..\..\runtime\src\mft\vceencoder\H264AsyncEncoderMFT.cpp(514):OnSetOutputType(1): failed to set MF_MT_FRAME_RATE set to 60/1, HRESULT(0x80070057)

BTW, I am using the RX 6900 with the latest Driver, and the System version is windows 11. Do you have any idea about how to improve the recording performance when recording games?

I tried to use the native game recording App by Windows system and obs-studio with WCG used, but neither of them has this problem.

Video series

Hey, found this project from handmade.network. Not exactly an issue but wanted to ask, apologies if this is not the right place, is there a video series on this project. Would like to learn more on the win apis used for wcap, if any blogs/series you have for wcap, can you link that pls. Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.