How to create your own IPTV channel (server-side playlist)¶
On the page:
- Overview of server-side playlist in Flussonic.
- How to create an IPTV channel from video files.
- How to create an IPTV channel from streams.
- Setting up the streaming schedule.
- How to configure ad insertion for server-side playlist.
As an IPTV operator, you can create a FAST (Free Ad-Supported streaming TV) channel—free to viewer channel with ads. For example, a movie channel or a barking channel—a channel dedicated to informing your subscribers and advertising new products and services. With Flussonic, you can create such a channel by assembling VOD files and live content into playout streams.
FAST channel with video files from local VOD location instead of streams received over the network helps to:
- Save the web traffic.
- Attract new subscribers. Viewers have free access to watch such a channel.
Note
Make sure that you aren't violating intellectual property rights.
Overview of server-side playlist in Flussonic¶
A custom channel is a playlist that contains links to sources, such as video files and streams on Flussonic Media Server. A custom playlist plays specified sources on a loop and can run on a schedule.
Server-side playlists can be used to:
- Broadcasting a TV channel to many simultaneous viewers in a local network.
- Switch between several streams. For example, you can create a playlist that switches between CCTV camera streams every other minute.
- Create a digital signage platform to display informational clips or commercials.
Disadvantages of server-side playlists¶
Server-side playlists have several disadvantages when used on the Internet to embed video into websites:
- You can't use targeting when inserting ads.
- You can't use AdRiver and other similar systems for ad analytics.
- Complexity of creating a multi-bitrate broadcasting: different files can contain different number of tracks of different bitrates.
- Rewinding, one of the major advantages of online streaming, is difficult to implement.
- The pause function is complex to implement.
The main disadvantage of such playlists is that they offer no means to create an adequate ad analytics system. Instead of server-side playlists, it's recommended to use client-side playlists. These playlists allow an IPTV subscriber to select channels and form a playlist.
However, server-side playlists can be used for purposes other than online broadcasting. Practice shows that users are more willing to watch predefined content rather than to search for videos themselves.
How to create an IPTV channel from video files¶
To create a server-side playlist from video files, follow these steps:
1) Prepare video files for further live streaming.
2) Set up a VOD location and upload the video files.
3) Create a server-side playlist.
4) Create a stream with the playlist://
source.
Step 1. Prepare video files¶
To ensure compatibility across devices and optimal playback, prepare video files. Video files in the playlist should have identical parameters, such as audio and video codecs, resolution, and bitrate.
Step 2. Set up a VOD location¶
1) The default directory for video files is /opt/flussonic/priv
. It already exists in the configuration file /etc/flussonic/flussonic.conf
:
vod vod {
storage /opt/flussonic/priv;
}
or:
vod vod {
storage priv;
}
The example uses the default directory that's specified in vod
. If you want to use another directory, create another VOD location or add the path to the existing VOD location. You can specify storage for playlist's files using the Flussonic UI.
1) Upload video files in the specified directory.
The example uses bunny.mp4
and beepbop.mp4
, which already exist in the /opt/flussonic/priv/
.
Step 3. Create a server-side playlist¶
A playlist is a text file with a list of links to sources. To edit the playlist, you can use nano—a text editor for Linux systems.
1) Install nano by running these commands:
apt-get update && apt-get install nano
2) In the directory with the video files, create a file playlist.txt
by using the following command:
nano /opt/flussonic/priv/playlist.txt
The editor immediately opens the file. Add the links to video files for streaming. The link consists of the name of the VOD location and the video file name:
vod/bunny.mp4
vod/beepbop.mp4
To exit and save the changes, press CTRL + X and then y.
Step 3. Create a stream with the playlist://
source¶
1) Create a static stream by going to the Media section in the navigation menu to the left and clicking + next to the Streams tab. Specify the stream name and the source URL. The source URL consists of the playlist://
setting and the path to the playlist file. For example, playlist:///opt/flussonic/priv/playlist.txt
, where /opt/flussonic/priv/playlist.txt
is the path to the playlist file.
You can also create a stream in the configuration file /etc/flussonic/flussonic.conf
or with an API request Flussonic-API: PUT /streams/{name}
.
2) If you edit the configuration file, reload the server configuration by running the following command in the Linux command line:
service flussonic reload
A new stream will appear in the list of streams in the web interface. The stream will play the specified files on a loop.
How to create an IPTV channel from streams¶
A server-side playlist from streams is similar to a playlist from video files except that you specify streams instead of VOD files.
To create a server-side playlist from streams, follow these steps:
1) In the VOD location directory, create a playlist playlist.txt
, and specify the names of the streams on the Flussonic server to broadcast. To manage the broadcasting schedule, use the tags. See the example playlist playlist.txt
:
#EXTINF:60
cam1
#EXTINF:60
cam2
where:
cam1
andcam2
are the stream names#EXTINF:60
is the tag that specifies the duration in seconds to play the stream
The playlist plays streams cam1
and cam2
sequentially, switching between the streams every 60 seconds.
2) In the Flussonic UI create a stream with playlist://
source, specifying the path to the playlist. Click Save to apply the settings:
You can also create a stream in the configuration file /etc/flussonic/flussonic.conf
or with an API request Flussonic-API: PUT /streams/{name}
.
Setting up the schedule¶
To set up a schedule in a playlist, use the following tags:
#EXT-X-MEDIA-SEQUENCE
. The serial number of the first element in the playlist. You can use it to correctly rotate through and update a playlist.#EXTINF
. The duration in seconds to play a playlist element. You can use it to embed live content into a playlist.#EXT-X-UTC
. The start time in UTC of a playlist element.#EXT-X-PROGRAM-DATE-TIME
. The start time in ISO 8601 format of a playlist element:2013-02-12T12:58:38Z
(GMT).#EXT-X-CUE-OUT:ID=SOME_ID
. The ad marker represents the splice start point.#EXT-X-CUE-IN
. The ad marker represents the splice end point.
Find the examples of applying tags in the Examples section.
Note
Every time a file in a playlist finishes playing, Flussonic re-reads the playlist.
Consider the following rules for processing playlists:
1) If you specify the tag #EXT-X-MEDIA-SEQUENCE
, the playlist remembers the last played element, and playback continues from the next element after re-reading. The playlist will be synced from the next number. If the new playlist has only numbers less than the last number, the playlist file will be re-read every second, waiting for the correct number.
2) If the tag #EXT-X-MEDIA-SEQUENCE
isn't specified and the playlist file hasn't been changed, then the next element will be played. If the file has been changed, playback starts from the beginning.
Examples¶
- With the
#EXTINF
tag, you can set the playback duration for each playlist item. For example, broadcast the first 30 seconds of the first file and the first 60 seconds of the second file:
#EXTINF:30
vod/bunny.mp4
#EXTINF:60
vod/beepbop.mp4
- With the tag
#EXT-X-UTC
, you can set the time in UTC when you want to play the playlist element:
#EXT-X-UTC:1522839600
vod/bunny.mp4
#EXT-X-UTC:1522843200
vod/beepbop.mp4
- With the
#EXT-X-PROGRAM-DATE-TIME
tag, you can set the start time in the ISO 8601 format of the playlist element:
#EXT-X-PROGRAM-DATE-TIME:2018-04-04T11:00:00Z
vod/bunny.mp4
#EXT-X-PROGRAM-DATE-TIME:2018-02-04T12:00:00Z
vod/beepbop.mp4
How to configure ad insertion for server-side playlist¶
The process of creating a server-side playlist to insert ads into a stream without ad markers is similar to creating a playlist from video files except for the following:
1) You should prepare both video files and ad clips and upload them to the VOD location.
Warning
Video files with content and ad clips in the server playlist must have the same video and audio codecs, resolution, and bitrate. Otherwise, the players won't handle it correctly.
2) The playlist name must end in .onlyvod.m3u8
. For example, ad_playlist.onlyvod.m3u8
. This enables the ad insertion mechanism.
3) The playlist must contain the splice start (#EXT-X-CUE-OUT:ID=SOME_ID
) and end (#EXT-X-CUE-IN
) point markers for the ad insertion. Playlist example:
vod/film_1.mp4
#EXT-X-CUE-OUT:ID=126
vod/ad_1.mp4
vod/ad_2.mp4
#EXT-X-CUE-IN
vod/film_2.mp4
#EXT-X-CUE-OUT:ID=127
vod/ad_3.mp4
#EXT-X-CUE-IN
vod/film_3.mp4
In HLS and DASH playlists, you'll see SCTE markers of when ads start, for example:
#EXT-OATCLS-SCTE35:/DAgAAAAAAAAAP/wDwUAAAB+f/8AABdmoAABAAAAAG1gDGA=
#EXT-X-CUE-OUT:DURATION=17.040
See also: