A tool for real time screen and audio capture on Windows, using NVIDIA's NVENC and with an emphasis on performance, correctness (eg. frame rate stability) and configurability. Mostly made for demoscene productions but you can use it with everything that's on your screen.

Overview

Capturinha

A tool for real time screen and audio recording on Windows, using NVIDIA's NVENC and with an emphasis on performance, correctness (eg. frame rate stability) and configurability. Mostly made for demoscene productions but you can use it with everything that's on your screen.

This is not a .kkapture successor. At least not yet. Mainly it's there to make the lives of demo party organizers - and other people who need a good video of their screen - easier.

Why

Yes, there are a lot of screen capture tools around, built into Windows and GPU drivers even, but during testing I found them all lacking. There are either commercial solutions where the "Free" tier is so bad it's pretty much unusable and doesn't inspire you to shell out money for the real product, and the solutions built into Windows or the graphics driver lack configuration options such as choosing a constant quality encoding mode or even what codec to use - and all of them dropped frames like hot potatoes. So, having had some experience with graphics programming in general and with using NVENC and the FFmpeg libraries for encoding and muxing video and audio in particular, I thought "how hard can it be?"

Building

Prerequisites
Build
  • Press Ctrl-Shift-B, basically

Usage

To run Capturinha you'll need at least Windows 10 (64 bit) version 1903 or later, and an NVIDIA graphics card. Your screen must be connected to that GPU, so sadly at the moment most laptops are out 😞

You'll be greeted by a configuration dialog. Select the screen you want to capture at the top, set up encoding and audio options in the middle, and choose an output directory, name and container format at the bottom.

Now press "Start" (or press Win-F9). Recording will begin immediately, or as soon as a program goes into fullscreen (and will pause when that program leaves fullscreen again). If the screen mode changes, the currently recording file will be closed and a new one will be opened.

Press "Stop" when you're done. That's basically it.

The current configuration gets stored in a file called config.json in the program directory.

About the settings

The codecs currently supported by NVENC are h.264 and HEVC (also known as h.265). If your graphics card isn't too old (older than let's say the GTX 900 series), HEVC is usually better in quality (per bitrate) as well as encoder performance, so if you haven't got a good reason to use h.264 (for example you want to encode for a device that only supports that), choose HEVC.

The 4:4:4 and Main10 profiles are choices for high quality encoding - 4:4:4 means no chroma subsampling and will result in a less washed out image when there's a lot of colorful high resolution detail, and the Main10 profiles will encode in 10 bits per color channel instead of 8. This even helps for 8 bit screens, as there is some slight loss of precision when converting from the screen's RGB into the YCbCr color space that the encoded video is stored in, so choosing 10 bits will reduce some banding artifacts. But beware that if you capture for uploading to a video streaming site, as far as I know none of them support these high quality settings, and the added fidelity will be lost (the files will upload and play just fine though) - so encoding in the "normal" profiles is good enough for that. Also you'll need at least a GTX 1060 to unlock these modes for HEVC.

The "Const QP" rate control mode encodes in constant quality while wildly varying the bitrate according to how much is happening on screen. The values go from 1 (best) to 52 (worst), and a value of 24 for h.264 and 28 for HEVC is already really good. Use this mode when you don't want to put a file directly onto the internet or play on limited/mobile devices - for presentation from a sufficiently powered machine, editing, archival, and uploading to video streaming sites (that transcode all incoming files anyway) Const QP is vastly preferred.

The frame layout option should be kept at "I+P" unless you want to radically edit the resulting file - "I", aka "I frames only", forgoes any "let's predict what the next frame could look like" magic and stores each frame as complete image. Perfect for editing but absolutely devastating for bitrate or file size. The GOP length determines how many P frames (as in "predicted") go between two I frames, aka how many frames go by until the decoder resets to a known state. Increasing this value helps with bitrate a lot but it makes it harder to edit or even seek in the files, and you might experience that the image drifts/washes away and then "comes back" every so and so seconds. When in doubt, leave at the default.

(No, B frames are currently not supported, simply because they don't help too much with the use cases Capturinha has, and can make playback worse)

The "Oldschool upscale" feature will scale up the captured screen in integer increments and without filtering until a target number of lines is reached or surpassed - eg. capturing a 640x480 screen with the option set to 2160 lines will result in a 3200x2400 sized video. That way you can upload your oldschool or low res productions or your freshly captured emulator run in a way that unlocks the good resolutions and bitrates on the video platform of your choice.

Tips
  • The MP4 container can't contain PCM audio, so trying this combination will result in an error.
  • You can leave "only record when fullscreen" on and then just let Capturinha run minimized - everything that goes into fullscreen will be recorded into its own file in the background.
  • If you experience audio/video drift, try using HDMI or DisplayPort audio. Those usually keep audio and video in sync (in contrast to GPUs and sound cards using their own clock each).
  • There seems to be an issue with 10bit screens and certain 8bit fullscreen modes regarding the gamma Windows reports, so if the recording comes out way too dark, setting the screen to 8 bits per pixel should fix it.

TODO:

(This is the point where I state that I'd really like people to contribute :) )

(also, not listed by priority)

  • Proper GPU capabilities and error handling. At the moment it just displays a message box and then bails.
  • Backends for Non-NVIDIA encoders
    • AMD Video Code Engine
    • Intel Quick Sync
    • Media Foundation to get vendor independent
  • Replace WTL with a more modern UI toolkit that doesn't look like a 90s revival party at 4AM when the lights go on
  • Factor the encode and output parts into a library that can be used by other people that need a video writer in their engines/tools
  • Refine full screen detection so it doesn't capture a few wrong frames at the end when the app to record is already gone
  • Optionally capture the mouse cursor (needs to be rendered into the target texture)
  • Region of Interest or single window capture (only if it's in the foreground)
  • As soon as it becomes relevant: HDR capture (using HEVC)
Issues
  • DX issue, graphics.cpp after try to start capture.

    DX issue, graphics.cpp after try to start capture.

    Hey, I've already posted this on Pouet, but I'll put it here again as it's more appropriate. When I try to start a capture, it fails, with error message

    C:\code\ScreenCap\graphics.ccp(855): 
    D3D call failed (887a002d).
    

    Not sure what's up here. Dxdiag (v 10.00.19041.0928 64-bit Unicode) tells me I'm running DirectX 12.

    FWIW, there is no C:\code\ScreenCap\graphics.ccp file, nor directory; but graphics.cpp line 855 is:

    DXERR(D3D11CreateDevice(Output.Adapter, Output.Adapter.IsValid() ? D3D_DRIVER_TYPE_UNKNOWN : D3D_DRIVER_TYPE_HARDWARE, NULL, flags, levels, _countof(levels), D3D11_SDK_VERSION, dev0, &FeatureLevel, ctx0));
    

    cheers K

    opened by kmshort 1
  • Capturinha Display-List does not match Windows/Nvidia Numbering

    Capturinha Display-List does not match Windows/Nvidia Numbering

    Issue Description

    Capturinha Version: 0.3.0

    The dropdown List for Display-Selection shows the three displays connecten to the GPU and lists them all as generic display devices: grafik

    But the numbering of the displays does not correspond to the numbering in the Windows Display Settings or the Nvidia Control Panel:

    In Capturinha:

    • Display 1 = BenQ PD32220U (Primary Display)
    • Display 2 = HP ZR30w
    • Display 3 = LG HDR 4k

    In the Nvidia Controll Panel (same on the Windows Display Settings):

    grafik

    Not a breaking Issue or anything wild (capturing works great) - but requires some trial-and-error to find the correct display to capture from.

    Tests perfomed

    Not much besides restarting capturinha on different display devices, restarting the Workstation and, updating the NV drivers. The behaviour remains the same.

    Machine Specs

    Windows

    Windows 10 Pro Version 21H1 OS build 19043.1237 Experience Windows Feature Experience Pack 120.2212.3530.0

    NVIDIA

    NVIDIA System Information report created on: 09/19/2021 15:22:46

    Display

    Operating System: Windows 10 Pro, 64-bit DirectX version: 12.0 GPU processor: NVIDIA GeForce RTX 2080 Driver version: 471.96 Driver Type: DCH Direct3D feature level: 12_1 CUDA Cores: 2944 Core clock: 1800 MHz Memory data rate: 14.00 Gbps Memory interface: 256-bit Memory bandwidth: 448.00 GB/s Total available graphics memory: 73663 MB Dedicated video memory: 8192 MB GDDR6 System video memory: 0 MB Shared system memory: 65471 MB Video BIOS version: 90.04.23.40.C5 IRQ: Not used Bus: PCI Express x16 Gen3 Device ID: 10DE 1E87 86921043 Part Number: G180 0002

    Components

    nvui.dll 8.17.14.7196 NVIDIA User Experience Driver Component nvxdplcy.dll 8.17.14.7196 NVIDIA User Experience Driver Component nvxdbat.dll 8.17.14.7196 NVIDIA User Experience Driver Component nvxdapix.dll 8.17.14.7196 NVIDIA User Experience Driver Component NVCPL.DLL 8.17.14.7196 NVIDIA User Experience Driver Component nvCplUIR.dll 8.1.940.0 NVIDIA Control Panel nvCplUI.exe 8.1.940.0 NVIDIA Control Panel nvWSSR.dll 30.0.14.7196 NVIDIA Workstation Server nvWSS.dll 30.0.14.7196 NVIDIA Workstation Server nvViTvSR.dll 30.0.14.7196 NVIDIA Video Server nvViTvS.dll 30.0.14.7196 NVIDIA Video Server nvLicensingS.dll 6.14.14.7196 NVIDIA Licensing Server nvDevToolSR.dll 30.0.14.7196 NVIDIA Licensing Server nvDevToolS.dll 30.0.14.7196 NVIDIA 3D Settings Server nvDispSR.dll 30.0.14.7196 NVIDIA Display Server nvDispS.dll 30.0.14.7196 NVIDIA Display Server PhysX 09.19.0218 NVIDIA PhysX NVCUDA64.DLL 30.0.14.7196 NVIDIA CUDA 11.4.125 driver nvGameSR.dll 30.0.14.7196 NVIDIA 3D Settings Server nvGameS.dll 30.0.14.7196 NVIDIA 3D Settings Server

    opened by psykon 0
Releases(v0.4.1)
  • v0.4.1(Jan 25, 2022)

    • Show recorded pixel format in statistics view
    • Fixed wrong video format in MKV EBML chunk when recording HDR
    • Better HDR detection and passthrough for 10bit outputs that are already in Rec.2100 format

    These binaries don't contain FFmpeg - please download the n4.4 x64 shared build from https://github.com/BtbN/FFmpeg-Builds/releases and place the DLLs in the same directory.

    Source code(tar.gz)
    Source code(zip)
    Capturinha.zip(359.45 KB)
  • v0.4.0(Jan 23, 2022)

    • Added HDR capture - if the screen is set to HDR we will now faithfully encode it in full Rec.2100 glory (HEVC 10 bit profiles only)
    • And while we're at it, mark SDR captures as having the sRGB transfer function (instead of Rec.709) which should improve shadows for players that care

    These binaries don't contain FFmpeg - please download the n4.4 x64 shared build from https://github.com/BtbN/FFmpeg-Builds/releases and place the DLLs in the same directory.

    Source code(tar.gz)
    Source code(zip)
    Capturinha.zip(359.56 KB)
  • v0.3.0(May 24, 2021)

    • Oldschool Upscale: Scales up the screen in integer increments until a certain target resolution is hit (or surpassed)
    • More memory management fixes
    • Fixed Direct3D error on some machines
    • Error box shows full error text (instead of just a code) now also in release builds

    These binaries don't contain FFmpeg - please download the n4.4 x64 shared build from https://github.com/BtbN/FFmpeg-Builds/releases and place the DLLs in the same directory.

    Source code(tar.gz)
    Source code(zip)
    Capturinha.zip(274.96 KB)
  • v0.2.0(May 11, 2021)

    • Added Compute Shader based color space conversion
      • Less GPU and VRAM usage when encoding in 8 bit 4:2:0
      • Added 4:4:4 and 10 bits/channel profiles
    • Screen capture now supports 10/16 bits per channel modes
    • Tested a lot and tweaked encoder parameters for optimum performance/quality
    • Added Win-F9 hotkey to start/stop recording
    • Added a bit of help re. encoder settings to the README
    • Fixed file corruption when app window gets closed mid-recording
    • Scroll Lock light doesn't get stuck on "on" after recording anymore :)

    These binaries don't contain FFmpeg - please download the n4.4 x64 shared build from https://github.com/BtbN/FFmpeg-Builds/releases and place the DLLs in the same directory.

    Source code(tar.gz)
    Source code(zip)
    Capturinha.zip(273.05 KB)
  • v0.1.1(May 4, 2021)

    Bug fix release

    • Removed AVI container (it can't do HEVC)
    • Fixed occasional hang when recording stops
    • Fixed HEVC muxing into Matroska container
    • Fixed memory leak after recording

    These binaries don't contain FFmpeg - please download the x64 shared build from the address in README.md and place the DLLs in the same directory.

    Source code(tar.gz)
    Source code(zip)
    Capturinha.zip(265.83 KB)
  • 0.1.0(May 2, 2021)

Owner
Tammo 'kb' Hinrichs
Farbrausch zum Feierabend
Tammo 'kb' Hinrichs
C++ library thats implemets class color. Available models: RGB, HSL, HSV, CMY, CMYK, YIQ, YUV and growing.

Yet another c++ library that implements color. Description Yet another c++ library that implements color conversion and manipulation. Key features: No

Dejan 122 Jun 10, 2022
Rate-Distortion Optimized Lossy PNG Encoding Tool

rdopng is a command line tool which uses LZ match optimization, Lagrangian multiplier rate distortion optimization (RDO), a simple perceptual error tolerance model, and Oklab-based colorspace error metrics to encode 24/32bpp PNG files which are 30-80% smaller relative to lodepng/libpng.

Rich Geldreich 31 Apr 25, 2022
HDRView is a simple research-oriented image viewer with an emphasis on examining and comparing high-dynamic range (HDR) images

HDRView is a simple research-oriented high-dynamic range image viewer with an emphasis on examining and comparing images, and including minimalistic tonemapping capabilities. HDRView currently supports reading EXR, PNG, TGA, BMP, HDR, JPG, GIF, PNM, PFM, and PSD images and writing EXR, HDR, PNG, TGA, PPM, PFM, and BMP images.

Wojciech Jarosz 103 Jun 16, 2022
Lossy fixed-rate GPU-friendly image compression\decompression.

NotOkImageFormat Lossy fixed-rate GPU-friendly image compression\decompression. Supported profiles 16:1:1 2.8125 bpp yuv 4:1:1 3.75 bpp

Boris Batkin 10 Jan 27, 2022
Video, Image and GIF upscale/enlarge(Super-Resolution) and Video frame interpolation. Achieved with Waifu2x, SRMD, RealSR, Anime4K, RIFE, CAIN, DAIN and ACNet.

Video, Image and GIF upscale/enlarge(Super-Resolution) and Video frame interpolation. Achieved with Waifu2x, SRMD, RealSR, Anime4K, RIFE, CAIN, DAIN and ACNet.

Aaron Feng 7k Jun 29, 2022
a Vulkan real-time rendering engine (Windows and Linux).

Luz Engine A Vulkan engine that I'm developing to study and implement modern rendering techniques used by AAA games. Videos on Youtube Features How to

Hadryan Salles 46 Jun 3, 2022
You can use this to compile the code and output images into a word doc for assignment purposes

Code_n_Ouput_to_docx You can use this to compile the code and output images into a word doc for assignment purposes Basic requirements: Python 3.7 or

Aaditya Prabu K 1 Dec 25, 2021
Minimal example of prototyping CLAP audio plugins using Dear ImGui as the user interface.

clap-imgui Minimal example of prototyping CLAP audio plugins using Dear ImGui as the user interface. This is intended as an example of presenting a UI

schwa 28 Jun 19, 2022
Like feh, but better, faster, more image formats, simpler, more lightweight, animation support, and better UI

Like feh, but better, faster, more image formats, simpler, more lightweight, animation support, and better UI

martin 8 Apr 9, 2022
A toolkit for making real world machine learning and data analysis applications in C++

dlib C++ library Dlib is a modern C++ toolkit containing machine learning algorithms and tools for creating complex software in C++ to solve real worl

Davis E. King 11.2k Jun 27, 2022
Video++, a C++14 high performance video and image processing library.

Video++ Video++ is a video and image processing library taking advantage of the C++14 standard to ease the writing of fast video and image processing

Matthieu Garrigues 681 Jun 14, 2022
ppl.cv is a high-performance image processing library of openPPL supporting x86 and cuda platforms.

ppl.cv is a high-performance image processing library of openPPL supporting x86 and cuda platforms.

null 318 Jun 10, 2022
CGIF, A fast and lightweight GIF encoder that can create GIF animations and images

CGIF, a GIF encoder written in C A fast and lightweight GIF encoder that can create GIF animations and images. Summary of the main features: user-defi

Daniel Löbl 63 Jun 29, 2022
An open source library for face detection in images. The face detection speed can reach 1000FPS.

libfacedetection This is an open source library for CNN-based face detection in images. The CNN model has been converted to static variables in C sour

Shiqi Yu 11.1k Jun 28, 2022
A GIF art engine that will allow you to generate multi-layer GIFs from single GIFs as layers.

A GIF art engine that will allow you to generate multi-layer GIFs from single GIFs as layers. All the code in this repository has been written by me in c++, inspired by the generative art engine of HashLips that does not support GIFs as layers. The problem arose from my and my teamleader's need to generate animated images and then GIFs, in the same way as HashLips generated static images.

Andre 58 May 31, 2022
o/ ImGui Builder is a graphical framework for assembling imgui codes in your interface easily

IMGUI BUILDER The project consists a gui editor of the Imgui framework EDITOR Menu Export 1 - Export cpp file 2 - Cpp file Credits Credits for Shadowy

Code Building 343 Jun 28, 2022
libspng is a C library for reading and writing PNG format files with a focus on security and ease of use.

libspng (simple png) is a C library for reading and writing Portable Network Graphics (PNG) format files with a focus on security and ease of use.

Randy 508 Jun 22, 2022
Dear IMGUI + Render + Window handling, amalgamation in two files ready to use

imgui-app Imgui-app is an amalgamation of two amazing projects Dear Imgui and Sokol libraries into two files to make it very easy to start working wit

PpluX 100 Jun 15, 2022
Flameshot - Powerful yet simple to use screenshot software.

Flameshot - Powerful yet simple to use screenshot software.

Flameshot 18k Jun 26, 2022