Skip to content

WlayerX/ObscuraRT

Repository files navigation

Platform Language Graphics Build Status License: AGPL v3 Commercial GitHub Repo stars GitHub issues

ObscuraRT: Real-Time Video Anonymization at the Edge

Overview

ObscuraRT is a GPU-accelerated, privacy-preserving video anonymization system for real-time edge processing. It uses Vulkan compute shaders to anonymize video locally without sending raw frames to the cloud.

Buy Me a Coffee

Star History

Star History Chart

Key Architecture

Camera/Video Source
    ↓
FrameGrabber (CPU)
    ↓ [zero-copy if possible]
GPU Memory
    ├─ Input Buffer (YUV420/RGB)
    ├─ Compute Pipeline
    │  └─ Pixelation Shader
    └─ Output Buffer
    ↓
Display (GLFW + Vulkan)

Why Vulkan Compute?

Alternative Issue
OpenCV CPU 30 FPS @ 1080p = bottleneck
CUDA Vendor lock-in (NVIDIA only)
OpenCL Ecosystem dead
Vulkan ✅ Cross-GPU, low-level, <10ms latency

Project Structure

ObscuraRT/
├── CMakeLists.txt
├── include/
│   ├── vulkan_context.h       # Vulkan instance/device management
│   ├── frame_grabber.h         # Input: camera/file
│   ├── compute_pipeline.h      # GPU compute shaders
│   └── display_pipeline.h      # Output: GLFW window
├── src/
│   ├── main.cpp
│   ├── vulkan_context.cpp
│   ├── frame_grabber.cpp
│   ├── compute_pipeline.cpp
│   └── display_pipeline.cpp
├── shaders/
│   ├── pixelation.comp         # Main compute shader
│   ├── display.vert
│   └── display.frag
├── build/                       # (generated by CMake)
└── README.md

MVP Features (Current Phase)

  • ✅ Vulkan context + device selection
  • ✅ Test pattern frame generation (FrameGrabber)
  • ✅ Compute pipeline skeleton
  • ✅ Pixelation compute shader (GLSL)
  • ⏳ Display pipeline (GLFW window)
  • ⏳ Frame upload/download GPU memory
  • ⏳ Full shader execution & synchronization

Build & Run

Prerequisites

# Ubuntu/Debian
sudo apt-get install \
    vulkan-tools vulkan-headers libvulkan-dev \
    libglfw3-dev libglfw3 \
    libopencv-dev \
    glslc

# macOS (with homebrew)
brew install vulkan-headers glfw opencv

Build

cd ObscuraRT
mkdir -p build && cd build
cmake ..
make -j$(nproc)

Run

./obscura_rt

Next Steps (V1 Roadmap)

Phase 1: Core MVP

  • Complete display pipeline (swapchain, renderpass)
  • GPU buffer allocation & memory barriers
  • Compute shader execution + synchronization
  • Real-time pixelation on test pattern
  • FPS monitoring

Status:
Phase 1 is fully completed. The application has a functional Vulkan render + compute pipeline with real-time processing and performance metrics.

Phase 2: Real Input

  • V4L2 webcam integration
  • YUV420 → RGBA conversion (GPU or CPU)
  • Frame metadata (width, height, timestamp)

Phase 3: Face Detection

  • Haar cascade or lightweight CNN
  • Selective pixelation (face region only)
  • Multi-face support

Phase 4: Advanced

  • Video file output (H.264/H.265)
  • Temporal smoothing (motion-aware blur)
  • CLI + config file
  • Performance profiling (GPU timestamps)

Technical Notes

Memory Model

  • Zero-copy goal: V4L2 mmap → GPU via VkBuffer mapped memory
  • Fallback: CPU staging buffer → GPU transfer
  • Double-buffering: Ping-pong textures for pipeline parallelism

Synchronization

Frame N-1: GPU compute
Frame N:   CPU grab + memory barrier
Frame N+1: GPU present

Use:

  • VkMemoryBarrier between compute passes
  • VkFence for CPU-GPU sync
  • VkSemaphore for queue submissions

Shader Compilation

GLSL → SPIR-V (via glslc):

glslc -o shaders/pixelation.comp.spv shaders/pixelation.comp

CMake does this automatically.


Debugging

Validation Layers

Enable in release builds:

// In vulkan_context.cpp
const char* validationLayers[] = {"VK_LAYER_KHRONOS_validation"};

GPU Debug Tools

# Use RenderDoc or NVIDIA Nsight
renderdoc ./build/obscura_rt

Logs

All components emit [ComponentName] prefixed logs to stdout.


Performance Targets

  • Latency: <15ms per frame @ 1080p
  • Throughput: 60+ FPS @ 1080p
  • GPU Memory: <500 MB
  • CPU Usage: <20% (frame grab + sync)

Contributing

  1. Follow C++20 standard
  2. Use vk:: prefix for Vulkan types (optional; currently using raw Vulkan)
  3. Validate shaders with glslangValidator
  4. Test on iGPU + discrete GPU

License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0).

You are free to use, modify, and distribute this software, including for commercial purposes,
provided that any modified version or service using this software is also licensed under AGPL-3.0 and the complete corresponding source code is made available.


Network Use Disclosure (AGPL Notice)

If you run this software as a network service (e.g. SaaS, web app, API, hosted service), you are required to provide the complete source code of your modified version to all users interacting with it over the network, as required by the AGPL-3.0.


References

Contributing

By contributing to this project, you agree that your contributions will be licensed under the AGPL-3.0, unless explicitly stated otherwise

Disclaimer

This software is provided "as is", without warranty of any kind. See the AGPL-3.0 license for details.

Commercial Licensing

If you require a license that does not impose AGPL-3.0 obligations (e.g. closed-source or proprietary use), please contact the author.

Copyright

Copyright © 2025 Semih Taha Aksoy (aka WlayerX)

Original authorship and copyright notices must be preserved in all copies and derived works, as required by the license.

About

Real-time GPU video anonymization using Vulkan compute shaders, designed for edge processing.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors