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.

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 large 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 large 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

  • Asynchronous media indexing and recursive directory traversal
  • On-the-fly FFmpeg subprocess orchestration for temporal scrub thumbnail generation
  • Zero-copy static media serving via the tower-http layer
  • Recursive boot-time thumbnail preloader ensuring immediate cache readiness
  • Non-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 strict memory safety and runs reliably on low-power NAS hardware or single-board computers, directly feeding the Flutter frontend.

Need something similar?

I can build a system like this for you, too.

Describe your project in a few sentences, and we'll work out the right approach and an estimated scope together.