A responsive, color-enabled ASCII video player for the terminal, optimized for Nix-based dotfiles environments.
- π¬ Video to ASCII conversion with multiple character sets
- π 24-bit True Color support for vibrant ASCII art
- π± Responsive terminal handling - automatically adapts to window resizing
- π Transparent background support for terminal backgrounds to show through
- β‘ Hardware-accelerated video decoding using FFmpeg
- ποΈ Playback controls - pause, speed adjustment, looping
- π SketchyBar integration for macOS status bar updates
- π οΈ Nix-first development with reproducible builds
- π¨ Multiple color palettes - ASCII, Grayscale, Full Color
# Install directly from GitHub
nix profile install github:gapul/ascii-player
# Or add to your system configuration
# In your flake.nix:
inputs.ascii-player.url = "github:gapul/ascii-player";# Clone the repository
git clone https://github.com/gapul/ascii-player.git
cd ascii-player
# Enter development environment
nix develop
# Build and install
cargo install --path .# Play a video file
ascii-player video.mp4
# Play with transparent background
ascii-player --transparent video.mp4
# Loop playback at 2x speed
ascii-player --loop --speed 2.0 video.mp4
# Use grayscale palette
ascii-player --palette grayscale video.mp4# Set custom terminal dimensions
ascii-player --width 80 --height 24 video.mp4
# Play specific time range
ascii-player --start-time 30 --end-time 90 video.mp4
# Enable SketchyBar integration
ascii-player --sketchybar-item media_player video.mp4
# Set maximum frame rate
ascii-player --fps 30 video.mp4
# Enable verbose logging
ascii-player --verbose video.mp4| Key | Action |
|---|---|
SPACE |
Pause/Resume |
Q / ESC |
Quit |
+ / = |
Increase speed |
- |
Decrease speed |
L |
Toggle loop |
R |
Restart video |
H / F1 |
Toggle help |
This project uses Nix for development environment management and builds.
# Clone the repository
git clone https://github.com/gapul/ascii-player.git
cd ascii-player
# Enter development shell
nix develop
# Or if using direnv
direnv allow# Show all available tasks
just --list
# Build the project
just build
# Run with a test video
just run tests/assets/sample.mp4
# Run tests
just test
# Format code
just fmt
# Run linting
just clippy
# Full quality check
just check
# Create test video (requires ffmpeg)
just create-test-videoThis project is designed to integrate seamlessly with Nix-based dotfiles. To add it to your dotfiles:
- Add as a flake input in your
flake.nix:
inputs.ascii-player.url = "github:gapul/ascii-player";- Include in your system packages:
environment.systemPackages = with pkgs; [
inputs.ascii-player.packages.${system}.default
# ... other packages
];- Configure SketchyBar integration in your SketchyBar config:
# In your sketchybarrc
sketchybar --add item media_player right \
--set media_player update_freq=1 \
script="echo ''"The player is built with a modular architecture:
- CLI Module (
src/cli.rs) - Command line argument parsing and validation - Decoder Module (
src/decoder.rs) - Video file decoding using FFmpeg - Converter Module (
src/converter.rs) - Frame to ASCII conversion with color support - Renderer Module (
src/renderer.rs) - Terminal rendering with crossterm - Main Application (
src/main.rs) - Orchestrates all modules with async event handling
- Memory Efficient: Streams video frames without loading entire files
- CPU Optimized: Efficient ASCII conversion algorithms
- Terminal Responsive: Sub-50ms response to terminal resize events
- Frame Rate Control: Adaptive timing to maintain smooth playback
Thanks to FFmpeg integration, ASCII Player supports virtually all video formats:
- MP4, AVI, MKV, MOV, WMV
- WebM, OGV, FLV
- And many more...
ASCII Player is optimized for WezTerm and supports:
- True color rendering
- Transparent backgrounds
- Font ligatures and Unicode
- High refresh rate displays
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes and add tests
- Run the full test suite:
just check - Commit your changes:
git commit -am 'Add feature' - Push to the branch:
git push origin feature-name - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.