Skip to content

About

WideCapture is an experimental utility designed to capture 360-degree (equirectangular) gameplay video from DirectX 11 applications.

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

35 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

WideCapture

License Platform Language

WideCapture is an experimental utility designed to capture 360-degree (equirectangular) gameplay video from DirectX 11 applications. It utilizes DLL Injection, API Hooking, Compute Shaders, and Zero-Copy Hardware Encoding to achieve panoramic recording without requiring access to the game's source code.

Warning

Development Status: Proof of Concept

This project is currently in the Alpha stage. While the core infrastructure (injection, hooking, and FFmpeg integration) is implemented, advanced features like reliable camera control and seamless stitching are still in development.

The documentation below outlines the technical goals and architecture. Please anticipate instability, visual artifacts, and API limitations in the current build.

๐Ÿš€ Key Features

  • Universal Compatibility: Works with most DirectX 11 games (Unity, Unreal Engine, proprietary engines).
  • Zero-Copy Pipeline: Data never leaves the GPU. Surfaces are shared directly between DirectX and the Video Encoder.
  • Compute Shader Stitching: Converts 6 cubemap faces to Equirectangular projection purely on the GPU.
  • Hardware Acceleration: Direct integration with FFmpeg's D3D11VA and NVENC/AMF for substantial performance.
  • Camera Hijacking: Heuristic analysis of Constant Buffers to identify and manipulate the game's camera for 6-axis rendering.

๐Ÿ› ๏ธ Architecture

WideCapture functions by injecting into the target process and hooking key graphics API calls:

  1. Injection: The DLL enters the process and spins up a capture thread.
  2. Hooking: Intercepts IDXGISwapChain::Present to control the frame cycle and ID3D11DeviceContext::VSSetConstantBuffers to manipulate the camera.
  3. Rendering: For every single game frame, the engine is tricked into rendering 6 times (Front, Back, Left, Right, Up, Down).
  4. Stitching: A Compute Shader (ProjectionShader.hlsl) samples these 6 views and writes to a single Equirectangular texture.
  5. Encoding: The texture is passed to FFmpeg via D3D11 hardware context for immediate H.264 encoding.

๐Ÿ“‹ Prerequisites

  • OS: Windows 10/11 (x64)
  • Compiler: MSVC v142+ (Visual Studio 2019/2022) with C++17 support.
    • Installation Requirement: You must install the Desktop development with C++ workload.
      1. Open the Visual Studio Installer.
      2. Select the Workloads tab.
      3. Check Desktop development with C++.
      4. Ensure the "Installation details" on the right include:
        • MSVC ... C++ x64/x86 build tools
        • Windows 10 (or 11) SDK
  • Tools: CMake 3.20+, Python 3.x (for injection scripts).

External Dependencies

Ensure the following libraries are placed in the external/ directory:

  • DirectXMath: microsoft/DirectXMath

    1. Download the source code or specific header files.

    2. Place the header files in external/DirectXMath/include.

    3. Ensure the structure looks like this:

      external/DirectXMath/
      โ””โ”€โ”€ include/
          โ”œโ”€โ”€ DirectXMath.h
          โ”œโ”€โ”€ DirectXMathConvert.inl
          โ”œโ”€โ”€ DirectXMathMatrix.inl
          โ”œโ”€โ”€ DirectXMathMisc.inl
          โ”œโ”€โ”€ DirectXMathVector.inl
          โ””โ”€โ”€ ...
      

    This external dependency is required to ensure full DirectXMath support on MinGW, which may have incomplete system headers.

  • FFmpeg (Static Libraries for MSVC):

    1. Download a static build from artryazanov/ffmpeg-msvc-prebuilt (e.g., ffmpeg-n8.0.1-gpl-amd64-static.zip).

      • Note: Standard builds from gyan.dev do not contain the necessary static libraries for MSVC.
    2. Extract the contents into external/ffmpeg.

    3. Ensure the structure matches:

      external/ffmpeg/
      โ”œโ”€โ”€ include/          # Header files (.h)
      โ”‚   โ”œโ”€โ”€ libavcodec/
      โ”‚   โ”œโ”€โ”€ libavformat/
      โ”‚   โ””โ”€โ”€ ...
      โ””โ”€โ”€ lib/              # Static libraries (.a)
          โ”œโ”€โ”€ libavcodec.a
          โ”œโ”€โ”€ libavformat.a
          โ”œโ”€โ”€ ...
          โ”œโ”€โ”€ pkgconfig/
          โ””โ”€โ”€ ...
      

    Note: This project is configured to link FFmpeg statically. You do not need to copy any FFmpeg DLLs to the output directory.

  • MinHook: TsudaKageyu/minhook

    1. Clone the repository or download the source code.

    2. Place the contents in external/minhook.

    3. Ensure CMakeLists.txt is located at external/minhook/CMakeLists.txt. Structure:

      external/minhook/
      โ”œโ”€โ”€ CMakeLists.txt
      โ”œโ”€โ”€ include/
      โ”‚   โ””โ”€โ”€ MinHook.h
      โ”œโ”€โ”€ src/
      โ””โ”€โ”€ ...
      

    The project will automatically build MinHook as part of the solution.

๐Ÿ”จ Build Instructions

  1. Clone the repository:

    git clone https://github.com/artryazanov/wide-capture.git
    cd WideCapture
  2. Configure with CMake:

    mkdir build
    cd build
    cmake .. -DCMAKE_BUILD_TYPE=Release
  3. Build:

    cmake --build . --config Release

    Artifacts WideCapture.dll and shaders/ will be generated in build/Release.

๐Ÿ”ง IDE Configuration: CLion

If you use JetBrains CLion, critical configuration is required to match the MSVC environment:

  1. Toolchain:

    • Go to Settings -> Build, Execution, Deployment -> Toolchains.
    • Add a Visual Studio toolchain (Click + -> Visual Studio).
    • Do not use MinGW or Cygwin. The static libraries are linked for MSVC.
    • Ensure Architecture is set to x64 (amd64).
  2. Set as Default:

    • In the Toolchains list, select the Visual Studio toolchain you created.
    • Use the Up Arrow button (or drag and drop) to move it to the very top of the list.
    • This ensures CLion automatically uses MSVC as the default compiler for all CMake profiles.

๐Ÿ“ฆ Deployment (Installation)

To use WideCapture with a target game, you must copy the built artifacts to the game's executable directory (where Game.exe is located).

Required Files:

  1. WideCapture.dll: The main library.
  2. RGBToNV12.hlsl: Shader for video conversion.
  3. shaders/ folder: Contains ProjectionShader.hlsl (Core compute shader).

Steps:

  1. Go to your build output folder (e.g., build/Release/).
  2. Copy WideCapture.dll and RGBToNV12.hlsl.
  3. Copy the shaders folder.
  4. Paste them all into the folder containing the game executable.

Folder Structure Example:

GameFolder/
โ”œโ”€โ”€ Game.exe
โ”œโ”€โ”€ WideCapture.dll
โ”œโ”€โ”€ RGBToNV12.hlsl
โ””โ”€โ”€ shaders/
    โ””โ”€โ”€ ProjectionShader.hlsl

๐ŸŽฎ Usage

1. Injection

Use the provided Python script to inject the DLL into your target game.

python scripts/inject.py <process_name.exe> <path/to/WideCapture.dll>

Example: python scripts/inject.py SkyrimSE.exe build/Release/WideCapture.dll

2. Controls

  • Automatic Start: Recording begins immediately upon successful initialization of the graphics hooks.
  • Unload: Press the END key to stop recording, finalize the MP4 file, and unload the DLL safely.

3. Post-Processing (Metadata)

To allow video players (YouTube, VLC) to recognize the file as 360ยฐ video, inject the spatial media metadata:

# Requires Google's spatial-media tool
python spatial_media_injector.py -i record_360.mp4 -o final_output.mp4

๐Ÿ“‚ Project Structure

WideCapture/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ Core/           # Hooks, Logger, Entry Point
โ”‚   โ”œโ”€โ”€ Graphics/       # DX11 Management, Cubemap Logic
โ”‚   โ”œโ”€โ”€ Compute/        # Shaders & Compilation
โ”‚   โ”œโ”€โ”€ Camera/         # Matrix Math & Camera Control
โ”‚   โ””โ”€โ”€ Video/          # FFmpeg D3D11VA Backend
โ”œโ”€โ”€ external/           # Dependencies (MinHook, FFmpeg, DirectXMath)
โ”œโ”€โ”€ scripts/            # Injection & Utility scripts
โ””โ”€โ”€ CMakeLists.txt      # Build Configuration

โš ๏ธ Disclaimer

This software is for educational and research purposes only. Using this tool in multiplayer games may trigger anti-cheat software (VAC, BattlEye, EasyAntiCheat) resulting in bans. Use only in single-player modes or controlled environments.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

Third-Party Licenses

This project makes use of the following third-party libraries:

About

WideCapture is an experimental utility designed to capture 360-degree (equirectangular) gameplay video from DirectX 11 applications.

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages