A Python utility that converts M3U playlists into STRM files for use with media servers like Jellyfin, Plex, or Kodi.
M3U2STRM takes your M3U playlist and:
- Categorizes content into series, movies, and live TV
- Creates STRM files that point to media streams
- Organizes content in a folder structure compatible with media servers
- Updates only when content changes
- Sends notifications when new content is available
- ✅ Converts M3U streams to organized STRM files
- 📁 Auto-detects content type from URL patterns (series, movies, live)
- 📺 Creates proper TV series structure with seasons and episodes
- 🎬 Organizes movies with year information when available
- 📡 Generates a clean live.m3u file for direct use
- 🔥 Shows recently added content (highest URL IDs)
- 🔄 Checks for content changes and updates efficiently
- 📱 Sends Telegram notifications for new content
- 🌐 Dark-themed Web UI for browsing and selecting content
- 🐳 Docker support for easy deployment
- 🔄 Optional Jellyfin library refresh integration
# 1. Clone the repository
git clone https://github.com/yourusername/m3u2strm.git
cd m3u2strm
# 2. Edit docker-compose.yml with your settings
# 3. Run with Docker Compose
docker-compose up -d# 1. Clone the repository
git clone https://github.com/yourusername/m3u2strm.git
cd m3u2strm
# 2. Install requirements
pip install -r requirements.txt
# 3. Run the application
python task.py| Variable | Description | Example |
|---|---|---|
M3U_URL |
URL to download M3U playlist | http://provider.com/playlist.m3u |
M3U_USER_AGENT |
User-Agent for the playlist download (default VLC/3.0.20 LibVLC/3.0.20) |
curl/8.0 |
M3U_FILE |
Path to local M3U file (alternative to URL) | /path/to/playlist.m3u |
Content type is now automatically detected from URL patterns:
- Series: URLs containing
/series/with.mkvextension - Movies: URLs containing
/movie/with.mkvextension - Live TV: Requires group filter (no URL pattern available)
| Variable | Description | Example |
|---|---|---|
LIVE_GROUPS |
Groups containing live TV (required for Live TV filtering) | LIVE,TV,CHANNELS,ULUSAL |
| Variable | Description | Default |
|---|---|---|
TASK_INTERVAL |
Minutes between updates | 5 |
WEB_UI_PORT |
Port for the web interface | 8475 |
RECENTLY_ADDED_LIMIT |
Number of items to show in "Son Eklenenler" section | 100 |
DEBUG_LOGGING |
Enable verbose logging | false |
NEW_CONTENT_NOTIFICATION |
Enable new content discovery notifications (sends highest ID items) | false |
| Variable | Description | Example |
|---|---|---|
TELEGRAM_BOT_TOKEN |
Telegram bot API token | 123456789:ABCdefGhIjKlmnOpQrsTUVwxyz |
TELEGRAM_CHAT_ID |
Telegram chat to receive notifications | 12345678 |
JELLYFIN_URL |
Jellyfin server URL | http://192.168.1.100:8096 |
JELLYFIN_API_KEY |
Jellyfin API key | 32character_api_key_from_jellyfin |
Titles marked with the ⬇ toggle in the web UI are downloaded as local files
instead of being streamed. Files are fetched one at a time into
<name>.mkv.part, resumed after interruptions, then renamed; the .strm for
that episode is removed and not recreated while the local file exists.
Turning the toggle off cancels pending downloads but keeps finished files.
IPTV accounts usually allow a single connection, so the downloader yields it:
it pauses while Jellyfin is playing a stream or live channel, and does not
start a file while the provider reports all connections in use (checked via
the Xtream player_api.php derived from M3U_URL).
| Variable | Description | Default |
|---|---|---|
DOWNLOAD_HOURS |
Local hours when downloads may run, start-end (end exclusive, may wrap midnight); empty = always |
empty |
DOWNLOAD_MIN_FREE_GB |
Pause when free space on the media disk drops below this | 20 |
DOWNLOAD_SPEED_LIMIT_KBPS |
Throttle in KB/s, 0 = unlimited |
0 |
DOWNLOAD_HOURS uses the container's local time; mount /etc/localtime
(see docker-compose.yml) or the hours are UTC.
GET /api/status returns a JSON health document for monitoring tools such as
a Home Assistant REST sensor: ok, a list of current problems (playlist not
refreshed for a while, failed run, failed Jellyfin refresh, failed downloads
in the last 24 h, downloads paused for disk space), the latest outcome of each
operation, download progress and the most recent warning/error log lines.
Provider credentials and bot tokens are masked there and in the container log.
Access the web UI at http://your-server-ip:8475 to:
- Browse all content from your M3U playlist
- Select specific series, movies, and channels to include
- Mark series and movies for download and follow the download queue
- Search for specific titles
- Save your selections for STRM generation
vods/
├── series/
│ └── Show Name/
│ └── Season 01/
│ ├── Show Name S01E01.strm
│ └── Show Name S01E02.mkv (downloaded)
├── movies/
│ └── Movie Name (2023)/
│ └── Movie Name (2023).strm
└── live.m3u
Content type is now automatically detected from URL patterns:
- Series: URLs containing
/series/with.mkvextension - Movies: URLs containing
/movie/with.mkvextension - Live TV: All other URLs (requires
LIVE_GROUPSfilter)
Episode detection patterns:
- "S01 E01" format
- "1x01" format
#EXTM3U
#EXTINF:-1 tvg-id="series1" tvg-name="Breaking Bad S01 E01" group-title="SERIES",Breaking Bad S01 E01
http://example.com/series/user/pass/12345.mkv
#EXTINF:-1 tvg-id="movie1" tvg-name="Inception (2010)" group-title="MOVIES",Inception (2010)
http://example.com/movie/user/pass/67890.mkv
#EXTINF:-1 tvg-id="live1" tvg-name="CNN" group-title="LIVE",CNN HD
http://example.com/user/pass/11111
Note: Series and Movies are detected from /series/ and /movie/ URL paths. Live TV uses group-title filter.
- Adding IPTV to Jellyfin/Plex/Kodi: Convert streams to structured libraries
- Organizing VOD Content: Sort series and movies automatically
- Managing Live TV: Create a single file for all channels
- Content Selection: Use the web UI to pick which content to include
- No content appearing? Check your filters in the web UI - you must select specific series, movies, or channels
- Live TV not detected? Verify
LIVE_GROUPSenvironment variable matches your M3U group titles - Series not detected? Ensure titles follow "S01 E01" or "1x01" naming patterns
- Docker issues? Verify volume mappings and environment variables
For more detailed examples and a sample M3U file, see example.m3u included in the repository.
This project is licensed under the MIT License - see the LICENSE file for details.
