Tools & Utilities
Open Source

Rust ASCII Terminal Video Engine

RustCrosstermRodioFFmpegyt-dlpImage-rs

A multithreaded Rust CLI engine that intercepts media streams, executes hardware-accelerated frame extraction via FFmpeg, and renders real-time ASCII-mapped video synchronized with an isolated audio thread directly within the terminal.

Tech Stack

RustCrosstermRodioFFmpegyt-dlpImage-rs

System Metrics

Zero-GUI overhead; rendering throughput is strictly CPU-bound, relying entirely on terminal `stdout` flushing speeds rather than GPU acceleration
Effectively mitigates audio drift by continuously recalculating elapsed epoch deltas (`duration_since(start)`) rather than relying on naive fixed-interval thread blocks

Why Did I Build This?

"Standard GUI media players introduce massive rendering overhead for basic media consumption. I engineered this utility to explore terminal-based rendering and concurrent Audio/Video (A/V) synchronization at a low level. It automates the pipeline from network ingestion to frame extraction, applying a custom luminance matrix to map raw pixels to ASCII characters, entirely bypassing traditional OS graphics pipelines."

Architecture & Decisions

The orchestrator utilizes system hooks to drive `yt-dlp` and `ffmpeg` sub-processes for network acquisition and discrete I/O extraction. To ensure precise A/V synchronization, the architecture branches execution into distinct OS threads: an isolated audio sink via `rodio` and a primary video rendering loop. The render loop calculates sub-millisecond deltas against a fixed frame rate (30 FPS) using `std::time::Instant`. It applies the Rec. 601 luma formula (`0.299R + 0.587G + 0.114B`) to map spatial pixel intensity to a predefined ASCII density array, pushing the resulting buffer directly to `stdout` utilizing `crossterm` ANSI escape sequences.

Key Features

  • 01.Automated OS-level media ingestion and decoding pipeline leveraging discrete `yt-dlp` and `ffmpeg` sub-processes
  • 02.Mathematical pixel-to-ASCII density mapping utilizing the Rec. 601 relative luminance standard
  • 03.Multithreaded A/V synchronization engine enforcing strict frame-time deltas via dynamic thread sleeping
  • 04.Hardware-agnostic terminal rendering executing frame-buffer clears and draws entirely within the CLI environment