Skip to content
All projects
Backend & APIOpen source

Smart TV Local Media Server: Rust & Axum Backend

A high-performance, asynchronous media streaming and indexing server built in Rust. It dynamically generates video thumbnails and temporal scrubbing previews via FFmpeg subprocesses while efficiently serving raw media files over HTTP.

Tech stack

Languages
Frameworks & libraries

Performance & metrics

  • Zero-overhead asynchronous I/O prevents thread starvation during simultaneous media streaming and FFmpeg execution
  • Headless, resource-minimal memory footprint compared to JVM or Node.js based media servers
  • Efficient localized frame extraction minimizes CPU thrashing by generating only surrounding frames during video scrubbing

Why I built it

Streaming massive local media files to a Smart TV requires a low-latency, zero-overhead backend. Off-the-shelf media servers like Plex or Jellyfin are inherently bloated and resource-intensive. I engineered this lightweight Rust backend to interface directly with a custom Flutter Smart TV client. It handles on-the-fly FFmpeg frame extraction for seek-bar scrubbing and provides static file serving without the massive CPU and RAM footprint of traditional media servers.

Architecture & decisions

The architecture is built on the Tokio asynchronous runtime and the Axum web framework. It utilizes tower-http for highly optimized, zero-copy static file serving. Media directory traversal and FFmpeg frame extraction (tokio::process::Command) are executed asynchronously, preventing I/O thread blocking during heavy loads. The server features a recursive boot-time preloader to cache standard thumbnails and an on-demand generator for temporal seek-bar scrubbing (extracting localized frame sequences for preview). Logging is strictly handled via the non-blocking tracing_appender to ensure zero I/O latency bottlenecks.

Key features

  1. 01Asynchronous media indexing and recursive directory traversal
  2. 02On-the-fly FFmpeg subprocess orchestration for temporal scrub thumbnail generation
  3. 03Zero-copy static media serving via the tower-http layer
  4. 04Recursive boot-time thumbnail preloader ensuring immediate cache readiness
  5. 05Non-blocking, daily rolling logs via the tracing ecosystem

Technical review

This backend demonstrates aggressive optimization in local media serving. By delegating static file delivery to the highly optimized tower-http layer and handling expensive ffmpeg extraction strictly via non-blocking Tokio tasks, the server maintains absolute memory safety and runs flawlessly on low-power NAS hardware or single-board computers, directly feeding the Flutter frontend.