I’m trying to create an online tv where users can come in and watch tv shows. I don’t want to use one stream or restream. Is there a way I can Livestream prerecorded videos on my website without using platforms like restream & one stream? Any suggestion will be greatly welcomed.
I tried looking for suggestions and didn’t find
2
Let me say up front that I have no experience doing this. But it is an area of interest for me, and indications are that it should be possible using well-accepted open source tools. I have done some research and will share the results here.
I believe the best currently-available protocol for implementing streaming on the web is HTTP Live Streaming (HLS). According to its inventor (Apple), you can deploy this on your own website.
An HLS stream may either be live or on-demand (VOD).
The requirements
for deploying an HLS stream are:
- Either an HTML page for browsers or a client app to act as a receiver
- A web server or CDN to act as a host
- A way to encode your source material or live streams as fragmented
MPEG-4 media files containing HEVC or H.264 video and AAC or AC-3
audio.
I recommend starting with a single video. Convert it to HLS format, serve it from your web server and create a web page to play it. Here is an overview of that process. Essentially you will use ffmpeg to take your .mp4
video and segment it into a set of .ts
files and an .m3u8
playlist file. You will then upload the .ts
and .m3u8
files to your web server, then create a web page containing a <video>
element whose src
is set to the .m3u8
file.
The next step would be to get ffmpeg to generate an HLS stream, so performing continuous conversion rather than a one-time conversion. The stream output is essentially a set of .ts
and m3u8
files which are frequently updated, rather than being static. The easiest setup would therefore be to run ffmpeg on the web server itself. The following resources may be helpful:
- Simulate a live stream of a video playlist
- How to loop videos
I do not yet know how to implement the final step, which would be to supply ffmpeg with an updatable timed playlist in order to support a 24×7 linear stream.
Another possible approach would be to use OBS Studio to manage your video playlist, then set it up to send an HLS stream to your web server. OBS Studio uses a built-in copy of ffmpeg to do the HLS conversion.