DEV Community

Cover image for Why I Built ani-sync: The Zero-Buffering Terminal Anime Streamer with Multi-Cloud Sync
Blakie
Blakie

Posted on

Why I Built ani-sync: The Zero-Buffering Terminal Anime Streamer with Multi-Cloud Sync

If you have ever tried streaming anime directly from your terminal, you have probably used tools like ani-cli or simple web scrapers. While minimalist bash scripts are great, they frequently hit three major bottlenecks:

  1. Buffering & Connection Throttling: Single-threaded HTTP streams choke when remote anime CDNs throttle transfer rates to ~50 KB/s.
  2. Manual Scrobbling Friction: After finishing an episode, you still have to switch windows to update MyAnimeList, AniList, or Kitsu manually.
  3. Browser Bloat: Running heavy browser tabs consumes 2–3 GB of RAM, spins laptop fans, and exposes users to intrusive ad trackers.

To solve this, I built ani-sync — an open-source, hardware-accelerated terminal anime streaming player and downloader with automated multi-platform synchronization.


⚡ Architecture: Achieving Zero-Buffering Playback

Instead of streaming video sequentially through a single slow TCP socket, ani-sync uses a 4-tier acceleration pipeline:

[ Remote HLS Stream ]
       │
       ▼  (64 Concurrent Parallel Sockets via yt-dlp)
[ ⚡ Turbo Multi-Thread Engine ]
       │
       ▼  (10,000+ MB/s Shared Memory Bus)
[ 💾 RAM Disk (/dev/shm) Cache ] ◄── (Background Pre-fetch of Episodes N+1, N+2)
       │
       ▼  (GPU Hardware Acceleration: Intel VAAPI / NVDEC / AMD)
[ 🎬 MPV Player (Zero-Buffer Local Stream) ]
       │
       ▼  (On Window Close / Finish)
[ 🔄 Multi-Cloud OAuth API Scrobbler ]
Enter fullscreen mode Exit fullscreen mode
  1. 64-Connection Parallel Swarm: By pulling 64 segments concurrently across multiple TCP sockets, entire 25-minute episodes load in 3–5 seconds, completely saturating available bandwidth.

  2. Linux RAM-Disk Caching (/dev/shm): Video fragments stream straight into tmpfs shared RAM at 10,000+ MB/s, eliminating disk I/O bottlenecks and preventing SSD write wear.

  3. Predictive Dual Pre-Fetching: While you watch Episode 1, Episodes 2 and 3 preload silently in a background thread, enabling instant 0.00s transitions between episodes.

  4. Hardware Video Offloading: Video decoding is offloaded to the GPU via --hwdec=auto-safe, keeping CPU utilization under 5% and RAM usage around 30 MB.


📊 Performance Benchmark

  • 💾 RAM Footprint: 1,800 MB – 3,500 MB (Browser) ➔ 28 MB – 45 MB (ani-sync)
  • CPU Utilization: 30% – 60% (Browser) ➔ 2% – 5% GPU Decoded (ani-sync)
  • 🛡️ Telemetry & Trackers: 40+ JS Pixels (Browser) ➔ 0 Telemetry (ani-sync)
  • ⏱️ Seek & Start Latency: 10s – 30s Buffering (Browser) ➔ 0.00s Instant RAM Cache (ani-sync)
  • 🔄 Progress Auto-Sync: ❌ Manual (Browser) ➔ ✅ MAL + AniList + Kitsu (ani-sync)
  • Opening / Ending Skip: ❌ Manual scrubbing (Browser) ➔ ✅ AniSkip [Tab]/[o] (ani-sync)

✨ Standout Features

  • 🔄 Multi-Platform Background Sync: Marks progress simultaneously across MyAnimeList, AniList (GraphQL), and Kitsu (JSON:API) the moment an episode finishes.

  • ⏩ Frame-Accurate AniSkip Integration: Integrates with api.aniskip.com timestamps to automatically skip intros/outros or skip on demand with Tab or o.

  • 🔍 Interactive FZF Search: Built-in fuzzy filtering across episode pickers, seasons, and local watch history.

  • 💬 Discord Rich Presence: Broadcasts current episode progress and title directly over local IPC without third-party bloat.


🚀 Quick Install

Linux & macOS (One-Liner):

Bash

curl -fsSL [https://raw.githubusercontent.com/idrisharis12/ani-sync/main/install.sh](https://raw.githubusercontent.com/idrisharis12/ani-sync/main/install.sh) | bash
Enter fullscreen mode Exit fullscreen mode

Arch Linux (AUR):

Bash

yay -S ani-sync
Enter fullscreen mode Exit fullscreen mode

Debian / Ubuntu (.deb):
Bash

curl -LO [https://github.com/idrisharis12/ani-sync/releases/latest/download/ani-sync_2.7.1_all.deb](https://github.com/idrisharis12/ani-sync/releases/latest/download/ani-sync_2.7.1_all.deb)
sudo apt install -y ./ani-sync_2.7.1_all.deb
Enter fullscreen mode Exit fullscreen mode

Windows (PowerShell):

PowerShell

irm [https://raw.githubusercontent.com/idrisharis12/ani-sync/main/install.ps1](https://raw.githubusercontent.com/idrisharis12/ani-sync/main/install.ps1) | iex
Enter fullscreen mode Exit fullscreen mode

🎮 CLI Usage Example

Bash

1. Search and stream

ani-sync "frieren"
Enter fullscreen mode Exit fullscreen mode

2. Resume last watched anime

ani-sync continue
Enter fullscreen mode Exit fullscreen mode

3. Stream with auto-skip enabled

ani-sync "attack on titan" --skip
Enter fullscreen mode Exit fullscreen mode

4. Batch download episodes for offline travel

ani-sync "jujutsu kaisen" -d -e 1-12
Enter fullscreen mode Exit fullscreen mode

⭐ Source Code & Documentation: ani-sync

Top comments (0)