Skip to content

kevinnadar22/mkvstreamer

Repository files navigation

MKV Streamer

Direct MKV streaming is not supported in many browsers (like Safari). This Flask application transcodes MKV files to HLS format on-the-fly as users request them, making MKV videos playable in any browser.

Screenshot

MKV Streamer Demo

Quick Start

# Clone the repository
git clone https://github.com/kevinnadar22/mkvstreamer.git
cd mkvstreamer

# Install dependencies using uv
uv sync

# Install FFmpeg (required)
# Ubuntu/Debian:
sudo apt update && sudo apt install ffmpeg

# macOS:
brew install ffmpeg

# Windows:
# Download from https://ffmpeg.org/download.html or use chocolatey:
choco install ffmpeg

# Run the application
python main.py

How it works

  • Uses FFmpeg for real-time MKV to HLS transcoding
  • Flask backend server handles requests
  • Supports HTTP range requests for video seeking
  • Works great on Safari and Chrome

Configuration

You can customize the segment duration in config.py:

SEGMENT_DURATION = 6 

Set the PORT environment variable to change the default port (5000):

export PORT=8080
python main.py

Deployment Options

Local Development

# Install FFmpeg first (see Quick Start above)
python main.py

Docker

docker build -t mkvstreamer .
docker run -p 5000:5000 mkvstreamer

Heroku

# Add FFmpeg buildpack (required)
heroku buildpacks:add --index 1 https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git
heroku buildpacks:add heroku/python

# Deploy
git push heroku master

Usage

Web Interface

Visit http://localhost:5000/index.html for the web interface.

API Endpoint

GET /transcode?url=<mkv_url>

Example:

curl "http://localhost:5000/transcode?url=https://example.com/video.mkv"

Links

About

MKV videos playable in any browser.

Topics

Resources

Stars

Watchers

Forks

Contributors