Welcome to World of IPTV

Join us now to get access to all our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, and so, so much more. It's also quick and totally free, so what are you waiting for?

Forum Rules

Our Rules: Read to avoid getting banned!

Advertising

Introduce Yourself to the World with Us!

Resource Database

Find the newest resources around IPTV!

Account upgrade

Upgrade your account to unlock more benefits!

Tutorial Encode and share your own HLS IPTV channel using VLC, Debian 10 and FFMPEG

kimbrasil

Extended Member
Ext. Member
Joined
Apr 21, 2020
Messages
11
Reaction score
67
Points
14
Location
Brazil
This is a basic and simple tutorial to stream your own channel to the world using HLS streaming (.m3u8), using my own recent experience.

In this case I'll be using one computer (in my home) to generate the source using VLC and other (Cloud VM) as server to distribute the content, due to low bandwidth in the generator side,

I'm using Debian GNU/Linux 10 as example in the server side, but you can adapt to use in any other OS. I'm presuming who will use this tutorial already know at least the basics of Debian (or Ubuntu) and VLC. Check the local and server machine have full access to the internet and the desired ports open and forwarded, in this example I'm using HTTP port (80) in the web server and 30000 port in my home.

Firts, install Apache 2 HTTP server and FFMPEG in your Debian server side

$ sudo su # apt update # apt install apache2 ffmpeg

Now start the apache 2 server, go to your server http root, create a subfolder folder that we'll use for stream your live channel, make permissions.

# service apache2 start # cd /var/www/html # mkdir myiptv # chmod 775 myiptv -R

Install VLC in your home computer (I'm using Windows here) and open it, Go to Media > Stream

KnMwNF1.jpg


You can use capture devices like Webcam, Tuner Card, Network source, local file, or a Disc devices. I'm using my webcam in Windows side in this tutorial.

a5C4NB6.jpg


Press Next in the source and when in Destination Setup screen select HTTP and click on Add

SlujxIE.jpg


I'd changed the port to 30000 because my ISP blocks to serve lower ports usage.

BdGqHww.jpg


Change the profile to H.264 + MP3 TS and click in the tool icon

kdO9F06.jpg


Use H.264 as default video codec with desired bitrate

oE6oTVc.jpg


Use AC3 as default audio codec with desired bitrate, "Save"

dHY45iS.jpg


click on "Next" and on "Stream".

Check your Home PC address to the internet, in this example I'll use 123.45.67.89 , If your PC is behind a NAT, forward the port in your router to your PC.

Get back to the server and run the FFMPEG to re-stream your content in HLS format:

$ ffmpeg -i http://123.45.67.89:30000 -c:v copy -c:a copy -f hls -hls_time 10 -hls_list_size 6 -hls_wrap 10 /var/www/html/myiptv/stream.m3u8

As the FFMPEG is not encoding in this example, just restreaming the content, there is no extra CPU usage.

Now you can access the URL from your server in your browser, in the example I'll use 198.76.54.32 as the server IP

E4LRW93.jpg

Now it's running and UP! Now you are able to share your HLS URL "http://198.76.54.32/myiptv/stream.m3u8" with the world!

After this you can learn more about FFMPEG and how to use some of your hardware features to decode and use less CPU, stream more substreams, etc... how to configure other Apache2 features and automatize your server side to run the FFMPEG when start and try to reconnect when have disconnection.
 
Last edited:
very good tutorial, I will practice it, if it works I let you know right here, thanks
 
Channels MatchTime Unblock CDN Offshore Server Contact
100 cnx / 90€ 5Gbps / 180€ 48CPU-256GRAM 10Gbps 569€ Skype live:giefsl
500 cnx / 350€ 10Gbps / 350€ 48CPU-128GRAM 5Gbps / 349€ TG @changcdn
1000 cnx / 500€ 20Gbps / 700€ 40CPU-128GRAM 20Gbps / €980 http://coronaserver.com
https://prnt.sc/s3mlyv

I did it and if it works very well, will there be a way to transmit more channels from the same server?
Yes, it's possible if you have enough bandwidth! Only need to create more subfolders and FFMPEG instances


$ chmod /var/www/html/myiptv0 $ chmod /var/www/html/myiptv1 $ chmod /var/www/html/myiptv2


$ su #nano /opt/mystreams.sh
Code:
ffmpeg -i http://123.45.67.89:30000 -c:v copy -c:a copy -f hls -hls_time 10 -hls_list_size 6 -hls_wrap 10 /var/www/html/myiptv0/stream.m3u8 &
ffmpeg -i http://123.45.67.89:30001 -c:v copy -c:a copy -f hls -hls_time 10 -hls_list_size 6 -hls_wrap 10 /var/www/html/myiptv1/stream.m3u8 &
ffmpeg -i http://123.45.67.89:30002 -c:v copy -c:a copy -f hls -hls_time 10 -hls_list_size 6 -hls_wrap 10 /var/www/html/myiptv2/stream.m3u8
# chmod 777 /opt/mystreams.sh #./opt/mystreams.sh
 
a question friend, does the "xteve" program have the same function?
 
Channels MatchTime Unblock CDN Offshore Server Contact
100 cnx / 90€ 5Gbps / 180€ 48CPU-256GRAM 10Gbps 569€ Skype live:giefsl
500 cnx / 350€ 10Gbps / 350€ 48CPU-128GRAM 5Gbps / 349€ TG @changcdn
1000 cnx / 500€ 20Gbps / 700€ 40CPU-128GRAM 20Gbps / €980 http://coronaserver.com
You should write some error checking into these scripts though.

They will not auto restart if / when they die and simply running the main start script wont work as it will create dupes and spawn zombies.

I would suggest only using this as a framework to exand and code more functions into the work flow. Do NOT use this in a production setup.

Nice starting blocks though.
 
There might be a post like this already


I like to watch out for that hammer xD
 
Channels MatchTime Unblock CDN Offshore Server Contact
100 cnx / 90€ 5Gbps / 180€ 48CPU-256GRAM 10Gbps 569€ Skype live:giefsl
500 cnx / 350€ 10Gbps / 350€ 48CPU-128GRAM 5Gbps / 349€ TG @changcdn
1000 cnx / 500€ 20Gbps / 700€ 40CPU-128GRAM 20Gbps / €980 http://coronaserver.com
shape1
shape2
shape3
shape4
shape5
shape6
Back
Top