Skip to content
Bots!
Bots!
  • About
    • Myself
    • আমার দোয়া
  • Bookmarks
    • Bookmarks
    • My OCI Bookmarks
    • Useful Proxmox Commands & Links
    • Learning Nano
    • Useful Sites
    • Useful Virtualbox Command
    • Useful MySQL Command
    • Useful Linux Command
    • BTT-CAS
  • Resources
    • Webinar on Cloud Adoption for Project Managers
  • Photos
  • Videos
  • Downloads
Bots!

M3U Restream

Rumi, November 15, 2022

There’s a wonderful piece of microservice node.js based restream utility, that let you re-stream from a source and also do the ffmped transcoding if you’d like. I just liked the piece!

My installed OS was Ubuntu 18.x and I used node version 12.x.

The problem

You have an IPTV provider that provides an (extended) M3U playlist file. You want to:

  • Add HTTPS encryption to the streams (and probably move the unencrypted reception offsite).
  • Transcode the streams to a lower bitrate, or convert to a uniform video or audio format.

The solution

Run this software, preferably on an offsite host. It only requires a Node installation (No NPM modules are required!). To add HTTPS support, front it with nginx (or similar).

Getting it to run

Basic steps to get it running:

  • Install NodeJS via a mechanism of your choice.
  • Clone the repo.
  • Copy restream-cfg-example.json to restream-cfg.json.
  • Edit restream-cfg.json. See the section below for more details.
  • Run
    node restream.js

    There is no built-in daemon support, I recommend to run it in screen or use a daemonizer like start-stop-daemon.

  • Point your client software to http://<ip>:<port>/channels. This is the playlist URL for the default transcoding profile. To address another profile, use the profile URL parameter, like http://<ip>:<port>/channels?profile=mobile.

It is recommended to front the proxy with nginx to enable HTTPS. See the section on nginx below.

Configuration options
extUrl: The base URL that your proxy is reachable as, for example https://my.offsite.server/iptv/.

m3uSrc: The M3U URL from your IPTV provider. Will usually contain username and password as URL parameters.

port: TCP listening port that the proxy will use.

numWorkers: Amount of streaming workers to spawn. Since this proxy is designed for single clients, they are only needed when switching channels. Three are enough.

blacklist: A list of regular expression strings matching program names that you want filtered from the M3U list. Useful for skipping on crap that you don’t want.

profiles: Transcoding profiles. At least one profile called default must be present. Each profile has three sub-options:

contentType: The content type that is advertised for the resulting stream. Usually video/mp2t.
transcoder: Transcoder binary to spawn. If you want no transcoding, use /bin/cat. Otherwise, you’ll probably use ffmpeg. Whatever you use, it must be set up to read video from STDIN and output video to STDOUT.
transcoderOpts: Array of command-line options for the transcoder. The transcoder is spawned without a shell, so no escaping is needed.
 
Nginx setup (recommended, optional)

In any server (hopefully SSL-enabled), pick a path location for your IPTV service, and link the proxy in like this:

location /iptv/ {
proxy_pass http://127.0.0.1:3666/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
}

Here, the URL path is /iptv/ and the proxy port is 3666. That’s all.

I just uploaded the restream source which can be downloaded from here: iptv-m3u-restream-master 

Application Configurations (Linux) IPTVM3UNode.jsRestreamUbuntuUbuntu 18

Post navigation

Previous post
Next post

Comments (2)

  1. Peter Alfieri says:
    August 1, 2023 at 1:18 am

    Good afternoon,
    I’ve been trying to setup this script for a few days now.
    I can see the channels load, but, I can’t see the restream m3u. I’m running Kubuntu 23.04.
    This looks like it’s perfect for what I need it for, unfortunately, I just can’t get it to work.
    Would you be able to please help me?
    Thank you and have a nice day

    Reply
    1. Rumi says:
      August 2, 2023 at 9:52 pm

      You can get the playlist using like following format-
      http://:3666/channels.m3u8

      Notice- channels.m3u8 its the playlist generator of restream

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Myself…

Hi, I am Hasan T. Emdad Rumi, an IT Project Manager & Consultant, Virtualization & Cloud Savvyfrom Dhaka, Bangladesh. I have prior experience in managing numerous local and international projects in the area of Telco VAS & NMC, National Data Center & PKI Naitonal Root and CA Infrastructure. Also engaged with several Offshore Software Development Team.

Worked with Orascom Telecom-Banglalink, Network Elites as VAS partner, BTRC, BTT (Turkey) , Mango Teleservices Limited and Access to Informaiton (A2I-UNDP)

Currently working at Oracle Corporation as Principal Technology Solution and Cloud Architect.

You can reach me [h.t.emdad at gmail.com] and I will be delighted to exchange my views.

Tags

Apache Bind Cacti CentOS CentOS 6 CentOS 7 Debain Debian Debian 10 Debian 11 Debian 12 DKIM Docker endian icinga iptables Jitsi LAMP Letsencrypt Linux Munin MySQL Nagios Nextcloud NFS nginx pfsense php Postfix powerdns Proxmox RDP squid SSH SSL Ubuntu Ubuntu 16 Ubuntu 18 Ubuntu 20 Varnish virtualbox vpn Webmin XCP-NG zimbra

Topics

Recent Posts

  • Install Jitsi on Ubuntu 22.04 / 22.10 April 30, 2025
  • Key Lessons in life April 26, 2025
  • Create Proxmox Backup Server (PBS) on Debian 12 April 19, 2025
  • Add Physical Drive in Proxmox VM Guest April 19, 2025
  • Mount a drive permanently with fstab in Linux April 16, 2025
  • Proxmox 1:1 NAT routing March 30, 2025
  • Installation steps of WSL – Windows Subsystem for Linux March 8, 2025
  • Enabling Nested Virtualization In Proxmox March 8, 2025
  • How to Modify/Change console/SSH login banner for Proxmox Virtual Environment (Proxmox VE / PVE) March 3, 2025
  • Install Proxmox Backup Server on Debian 12 February 12, 2025

Archives

Top Posts & Pages

  • Install Jitsi on Ubuntu 22.04 / 22.10
©2025 Bots! | WordPress Theme by SuperbThemes