Sign inSign up

salmutt/jellyfin-pretranscode

By salmutt

•Updated 7 months ago

Jellyfin with pre-transcode plugin — auto-transcodes next episodes for instant playback

Image
0

336

salmutt/jellyfin-pretranscode repository overview

⁠Jellyfin Pre-Transcode Plugin

CI

A Jellyfin plugin that automatically pre-transcodes the next episode when you reach the credits, so it starts playing instantly with zero buffering delay.

⁠How It Works

  1. Credits Detection — When you're watching a TV episode, the plugin monitors your playback position. It detects credits using chapter markers (if available) or a configurable time threshold (default: 90% of runtime).

  2. Next Episode Resolution — Once credits are detected, the plugin finds the next episode in the series, handling season boundaries automatically.

  3. Background Transcoding — The next episode is transcoded in the background using FFmpeg at below-normal CPU priority, so it doesn't impact your current stream.

  4. Direct-Play Injection — The cached MP4 is registered as a direct-play media source via Jellyfin's IMediaSourceProvider API. The client sees it as the preferred source and plays it instantly with zero transcode delay.

  5. Seamless Resume — When the cached segment ends, the client resumes from the original source at the correct position. Jellyfin transcodes from that point forward with -ss seeking.

⁠Installation

Use the pre-built Jellyfin image with the plugin included:

docker pull salmutt/jellyfin-pretranscode:latest

Or in a docker-compose.yml:

services:
  jellyfin:
    image: salmutt/jellyfin-pretranscode:latest
    ports:
      - 8096:8096
    volumes:
      - ./config:/config
      - ./media:/media
    restart: unless-stopped
⁠From Release
  1. Download the latest Jellyfin.Plugin.PreTranscode.dll from the releases page⁠
  2. Create a directory: <jellyfin-data>/plugins/PreTranscode/
  3. Copy the DLL into that directory
  4. Restart Jellyfin
⁠From Source
git clone https://github.com/SalMutt/jellyfin-pretranscode.git
cd jellyfin-pretranscode

dotnet build Jellyfin.Plugin.PreTranscode -c Release

cp Jellyfin.Plugin.PreTranscode/bin/Release/net9.0/Jellyfin.Plugin.PreTranscode.dll \
   <jellyfin-data>/plugins/PreTranscode/

⁠Configuration

After installation, go to Dashboard > Plugins > Pre-Transcode in the Jellyfin web UI.

SettingDefaultDescription
Enable Pre-TranscodingOnMaster toggle for the plugin
Credits Threshold (%)90Fallback percentage of runtime to trigger credits detection
Pre-Transcode Duration5 minHow many minutes of the next episode to pre-transcode
Max Concurrent Jobs1Maximum simultaneous background transcodes
Max Cache Size10 GBDisk space limit for cached transcodes
Cache Directory(auto)Custom cache path (defaults to Jellyfin's cache folder)
Enable Direct-Play InjectionOnServe cached files as direct-play sources for instant playback
Skip Watched EpisodesOffSkip pre-transcoding episodes you've already watched

⁠API Endpoints

The plugin exposes REST endpoints for monitoring and management:

EndpointMethodAuthDescription
/PreTranscode/StatusGETUserActive jobs, queue size, cache stats
/PreTranscode/QueueGETUserDetailed active and queued job list
/PreTranscode/HealthGETUserHealth check for monitoring
/PreTranscode/CacheDELETEAdminClear the entire cache
/PreTranscode/Cache/{episodeId}DELETEAdminRemove a specific episode from cache

⁠Requirements

  • Jellyfin Server 10.11+
  • .NET 9.0 runtime (included with Jellyfin)
  • FFmpeg (included with Jellyfin)
  • NVIDIA GPU with NVENC support (optional, for hardware-accelerated transcoding)

⁠Building & Testing

# Build
dotnet build

# Run tests
dotnet test

# Publish release
dotnet publish Jellyfin.Plugin.PreTranscode -c Release

⁠License

Apache License 2.0. See LICENSE⁠ for details.

Tag summary

Content type

Image

Digest

sha256:51ef2e8fc…

Size

659.6 MB

Last updated

7 months ago

docker pull salmutt/jellyfin-pretranscode