Forums » Tutorial and setups »
How to add a stream from Open Broadcast Studio as a TV Channel
Added by chris jennings about 4 years ago
I would like to share the method I use to recieve a stream from Open Broadcast Studio and turn it into a TV channel.
This tutorial assumes readers are familiar with tvheadend basic config like creating networks, muxes etc.
I am using tvheadend 4.2.8-36 sourced from the official repo on a ubuntu 20.4 server with ffmpeg installed from the ubuntu repo
As OBS can only stream direct to rtmp servers you have to create one to forward the stream to Tvheadend. I used an enginx server using a linux box, very low specs required its not going to be cpu intensive just forwarding packets to TVheadend. Not tried it but apparently even a raspberry pi is suffiecient.
nginx server set up
1. Create a fresh Ubuntu server, a VM will do fine
2. Install nginx and libnginx-mod-rtmp ,both are in the ubuntu repo. you can use other distros I just found ubuntu the easiest for me
2. edit the nginx conf file to add the rtmp service sudo nano /etc/nginx/nginx.conf, or wherever the conf file is on your system
On line 2 change the worker_processes option from auto to 1, so it says: worker_processes 1;
add the following code at the end of the file:
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
record off;
}
}
}
Save and close
Configure OBS to stream to your nginx server
This is simple
go to settings - Stream
set your server as the destination thus
Streaming Service: Custom
Server: rtmp://<your server ip>/live
Play Path/Stream Key: test
You can add anything as the key, I just used test
No authentication required
Configure TVheadend
1. create a .sh file and save somewhere on the tvheadend server, with the following contents;
#!/bin/bash
/usr/bin/ffmpeg -loglevel quiet -i rtmp://your-nginx-server-ip/live/your-server-key -vcodec copy -acodec copy -f flv - | /usr/bin/ffmpeg -loglevel
quiet -i - -vcodec copy -acodec copy -f mpegts pipe:1
NB: your-server-key is whatever you put as the server key in the obs server settings
2. Create an IPTV network. (not automatic)
3. Create a Mux in the IPTV network using the url below, nothing else needs to be done other than mux name
pipe:///home/hts/.hts/tvheadend/your-sh-file.sh
NB: adjust the "/home/hts/" bit to your sh file location
3. finally save the mux, scan, map service etc
boom, channel created
I don't know if this is the best way to do this but it works fine, any comments gratefully received.
If anyone knows how to manually write and epg file for such a channel I would love to know.