A powerful Python library for sequential torrent downloading with MOOV atom detection and built-in HTTP streaming.
pip install pyflix
pip install git+https://github.com/animeshkundu/pyflix.git
Requires Python 3.9+ and libtorrent. Full installation guide →
Built for streaming, designed for simplicity
Intelligently prioritizes video pieces for immediate playback while downloading the rest in the background.
Automatically detects and handles MP4 MOOV atoms, ensuring videos can be streamed before fully downloaded.
Includes a threaded HTTP server with range request support, ready for VLC or any media player.
Customize download strategies, priorities, and chunk sizes to match your network and storage.
Direct VLC integration out of the box, with support for custom player configurations.
Simple YAML-based configuration for settings, paths, limits, and player preferences.
Clean architecture for reliable streaming
Coordinates all torrent operations, manages session lifecycle, and exposes streaming APIs.
torrent/__init__.py
Implements DefaultStrategy for intelligent piece prioritization based on playback position.
torrent/strategy.py
Detects MP4 atom positions using qtfaststart to ensure streamability.
torrent/moov.py
Threaded HTTP server with range request support for seamless video playback.
utils/streamer.py
Get streaming in minutes
from pyflix.torrent import DownloadManager
# Create manager with magnet link
magnet = "magnet:?xt=urn:btih:..."
manager = DownloadManager(
magnet,
port=8888,
serve=True
)
# Start downloading and serving
manager.start()
# Video available at http://localhost:8888
# ~/.pyflix/settings.yaml
save_path: "/downloads/torrents"
strategy:
piece_st: 4
last_piece_st: 4
chunks_strat: 10
always_sequential: false
limits:
upload: 0 # KB/s, 0 = unlimited
download: 0
players:
default: "vlc"
Get up and running in minutes
pyflix requires libtorrent with Python bindings:
# Ubuntu/Debian
sudo apt install python3-libtorrent
# macOS (Homebrew)
brew install libtorrent-rasterbar
Install via pip or from source:
# From PyPI
pip install pyflix
# From GitHub
pip install git+https://github.com/animeshkundu/pyflix.git
Test that everything works:
python -c "from pyflix.torrent import DownloadManager; print('✓ pyflix installed')"
pyflix is open source and free to use