Skip to content

Video Streaming

RustyFile media player

Click a video file to open the built-in player. The player uses a native HTML5 <video> element with custom controls:

  • Scrubber — seek to any position
  • Play / Pause
  • Volume toggle
  • Fullscreen

Video is served via the download endpoint with HTTP range request support, enabling seeking without downloading the entire file.

Any format supported by the browser’s native <video> element:

FormatContainerCodec
MP4.mp4H.264, H.265 (browser-dependent)
WebM.webmVP8, VP9
Ogg.oggTheora

For formats not natively supported by the browser, RustyFile offers on-demand HLS transcoding via FFmpeg.

  1. Request the playlist: GET /api/hls/playlist/{path}
  2. RustyFile probes the video duration with ffprobe
  3. Generates an m3u8 playlist with 10-second segments
  4. Each segment is transcoded on-demand when requested
  5. Segments are cached to disk (keyed by file path + modification time)
SettingValue
Segment duration10 seconds
Video codeclibx264
Video presetveryfast
Video CRF23
Audio codecAAC
Audio bitrate128k
Output formatMPEG-TS
Max concurrent2 FFmpeg processes

Segments are cached at {data_dir}/cache/hls/{source_key}/{index}.ts. The cache key is a blake3 hash of the file path + modification time, so re-transcoding only happens if the source file changes.

RustyFile automatically detects subtitle files adjacent to video files. It looks for files with the same stem and these extensions:

  • .vtt (WebVTT)
  • .srt (SubRip)
  • .ass / .ssa (Advanced SubStation Alpha)

Example: If you have movie.mp4, RustyFile will find movie.vtt, movie.en.srt, etc.

EndpointCache-Control
File downloadprivate (auth-gated) with ETag + Last-Modified
HLS segmentspublic, max-age=86400, immutable
Thumbnailspublic, max-age=86400, immutable

The download endpoint uses private because it requires authentication. HLS segments and thumbnails use aggressive public caching since their cache keys change when the source file changes.