Skip to content

XAOSTECH/video-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

License Issues Stars Contributors Maintenance

XAOSTECH video-tools

Professional Linux video capture, streaming, and HDR encoding toolset. Integrate low-cost USB capture devices, build P010 10-bit kernel support, and stream 4K HDR to YouTube with GPU acceleration. Some of these produce shims that conflict with secure boot unless enrolled with a MOK.

🎯 Project Modules

This monorepo contains standalone, production-ready modules:

op-cap β€” USB Capture Optimizationg

Linux capture device automation with v4l2loopback, auto-reconnect, and crash recovery.

  • βœ… v4l2loopback isolation & feed relay
  • βœ… Auto-reconnect on device disconnect
  • βœ… OBS crash recovery (auto-restart + auto-resume stream)
  • βœ… USB device reset & driver rebind
  • βœ… Wayland graphics optimisation
  • βœ… HDR passthrough (NV12)

Quick Start: make install && make optimise-drivers
Docs: op-cap/docs/README.md
Note: v42cl-loopback installation may require MOK enrolment or disabling secure boot


copt β€” Capture & Streaming Automation

FFmpeg-based capture relay with P010 HDR support, HLS streaming, and YouTube integration.

  • βœ… NV12 capture (immediate) / P010 10-bit (with kernel patch)
  • βœ… GPU encoding (NVIDIA NVENC HEVC Main10)
  • βœ… Full HDR metadata (BT.2020, SMPTE2084, mastering display)
  • βœ… HLS HTTP PUT relay to YouTube Live
  • βœ… Auto-reconnect on source disconnect
  • βœ… Bandwidth limiting & performance tuning

Quick Start: export COPT_FFMPEG_BIN=~/.local/bin/ffmpeg && copt-worker stream
Docs: copt/docs/README.md | P010_README.md


P010_for_V4L2 β€” Kernel HDR Support (Submodule)

Linux kernel patches for native 10-bit P010 video format capture.

  • βœ… 3 surgical kernel modifications (~20 lines)
  • βœ… DKMS auto-installer
  • βœ… Works with standard Linux USB UVC
  • βœ… Tested: Ubuntu 24.04, Raspberry Pi

Install: sudo copt/scripts/setup-p010-support.sh
Credits: @awawa-dev β€” upstream repo (licence)
Detailed Guide: P010 Kernel Support
Note: Installation requires MOK enrolment or disabling secure boot


πŸš€ Quick Start

Scenario 1: Stable OBS Capture (op-cap only)

cd op-cap
make install
make optimise-drivers
# Launch OBS, add /dev/video10 as source
# v42cl-loopback (video10) requires MOK enrolment or disabling secure boot

Scenario 2: YouTube HDR Streaming (op-cap + copt)

# Install op-cap
cd op-cap && make install && make optimise-drivers

# Install copt & custom FFmpeg
cd ../copt
bash scripts/build-ffmpeg-hevc.sh
export COPT_FFMPEG_BIN=~/.local/bin/ffmpeg

# Start streaming
copt-worker stream

Scenario 3: Full 10-bit Native P010 (all with kernel)

# Setup P010 kernel support (requires reboot and MOK enrolment or disabling secure boot)
sudo copt/scripts/setup-p010-support.sh

# After reboot, verify
v4l2-ctl -d /dev/video0 --list-formats-ext | grep -i p010

# Use P010 for capture
export COPT_USB_INPUT_FORMAT=p010
copt-worker stream

πŸ“š Comprehensive Guides

For OBS USB Capture Users

πŸ‘‰ op-cap README β€” Device setup, crash recovery, troubleshooting

For HDR Streaming to YouTube

πŸ‘‰ P010_README.md β€” Complete HDR pipeline, NV12 vs P010, verification checklist

For Advanced Configuration


✨ Key Features

Crash Recovery (op-cap)

  • Automatic OBS restart on USB device crash
  • Stream resumption (if streaming before crash)
  • No cumulative retry cap by default (optional per-crash limit)
  • 3-second recovery timeout

HDR Streaming (copt)

  • 4K @ 30fps native P010 capture
  • NVIDIA NVENC GPU encoding (HEVC Main10)
  • Full HDR metadata (colour space, tone curve, mastering display)
  • YouTube recognition verified working

USB Stability (op-cap)

  • Auto-reconnect on device disconnect
  • Device health monitoring
  • USB reset & driver rebind
  • Power optimisation (disable autosuspend)

πŸ”§ Module Integration

HDMI Source
    ↓
op-cap (USB Capture + OBS)
    ↓ [/dev/video10 loopback]
copt (FFmpeg relay)
    ↓ [P010 10-bit HEVC Main10]
YouTube Live HLS
    ↓
YouTube recognises as HDR βœ“

πŸ“‹ System Requirements

Minimum

  • Linux kernel 5.10+
  • NVIDIA GPU with NVENC (RTX 2060+) or compatible AMD/Intel
  • USB 3.0+ capture device (UGREEN 25173, Elgato HD60 S+, etc.)
  • 8GB RAM, 4 CPU cores

Recommended

  • Ubuntu 24.04 or later / Debian 12+
  • NVIDIA RTX 2060 SUPER or newer
  • Desktop environment: GNOME/KDE

Optional

  • P010_for_V4L2 kernel patches (for native 10-bit capture)
  • Custom FFmpeg build with NVENC (included script)

πŸ—οΈ Architecture

video-tools/
β”œβ”€β”€ op-cap/                          # USB capture & OBS stability
β”‚   β”œβ”€β”€ scripts/
β”‚   β”‚   β”œβ”€β”€ obs-safe-launch.sh      # ← Crash recovery wrapper
β”‚   β”‚   β”œβ”€β”€ auto_reconnect.sh       # ← Device monitoring
β”‚   β”‚   β”œβ”€β”€ optimise_drivers.sh     # ← GPU driver fixes
β”‚   β”‚   └── maintenance.sh          # ← Interactive recovery tools
β”‚   β”œβ”€β”€ lib/                        # Core libraries
β”‚   └── docs/
β”‚       β”œβ”€β”€ README.md              # Main op-cap guide
β”‚       β”œβ”€β”€ DRIVER_INFO.md         # Hardware specs
β”‚       └── USB_STABILITY.md       # Troubleshooting
β”‚
β”œβ”€β”€ copt/                            # Capture & streaming relay
β”‚   β”œβ”€β”€ scripts/
β”‚   β”‚   β”œβ”€β”€ build-ffmpeg-hevc.sh   # Custom FFmpeg builder
β”‚   β”‚   β”œβ”€β”€ setup-p010-support.sh  # ← Kernel patch installer
β”‚   β”‚   └── hls-upload-relay.sh    # YouTube HLS uploader
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   └── ffmpeg.sh              # HEVC Main10 encoder
β”‚   └── docs/
β”‚       β”œβ”€β”€ README.md
β”‚       └── P010_KERNEL_SUPPORT.md  # Kernel patching guide
β”‚
β”œβ”€β”€ P010_for_V4L2/                   # Submodule: Kernel patches
β”‚   β”œβ”€β”€ p010.patch                  # 3 kernel modifications
β”‚   β”œβ”€β”€ dkms-installer.sh          # DKMS installer
β”‚   └── README.md                   # Upstream docs
β”‚
└── docs/
    β”œβ”€β”€ README.md                    # ← You are here
    β”œβ”€β”€ P010_README.md              # Complete HDR guide
    └── [standard files]

πŸ”„ Latest Updates

op-cap (OBS Safety & Stability)

  • Crash Recovery β€” Auto-restart OBS + resume stream on disconnect
  • --no-device flag β€” Launch OBS without device requirement
  • --no-loopback option β€” Direct device mode (skip v4l2loopback)
  • Stream Detection β€” Monitors logs to detect active streams before crash
  • 3-second Recovery β€” Fast restart after device failure

copt (HDR Streaming)

  • Full HDR Metadata β€” BT.2020 colorspace + SMPTE2084 tone curve
  • Mastering Display Info β€” Content light level integration
  • HLS Playlist Upload β€” Fixed m3u8 relay to YouTube every 3-5 seconds
  • Bandwidth Control β€” Limit streaming bitrate dynamically

πŸ™ Credits & Attribution

Original Authors

  • XAOSTECH β€” Integration, testing, documentation
  • @awawa-dev β€” P010_for_V4L2 kernel patches, HyperHDR research

Standards & References

  • USB UVC 1.0+ specification
  • HEVC/H.265 Main10 profile (HDR10)
  • ITU-R BT.2100 (HDR colour space)
  • SMPTE ST 2084 (PQ tone curve)
  • YouTube HLS Live streaming API

πŸ“„ Licence

All modules distributed under GPL-3.0 Licence. See individual LICENCE files in each module.


πŸ’¬ Support & Contributing


πŸš€ Getting Help

OBS keeps crashing? β†’ op-cap README crash recovery section

YouTube not recognising HDR? β†’ P010_README.md verification checklist

Device not detected? β†’ op-cap troubleshooting

Building FFmpeg fails? β†’ copt FFmpeg builder β€” check script comments for common issues


Made with ❀️ by XAOSTECH
GitHub β€’ Releases β€’ Issues

Status: Production Ready βœ…
Last Updated: Feb 2026
Tested: Ubuntu 24.04, UGREEN 25173, NVIDIA RTX 2060 SUPER, YouTube Live

Git Tree Visualisation

Git Tree Visualisation

Full SVG Β· Interactive version Β· View data

Releases

No releases published

Packages

 
 
 

Contributors

Languages