Skip to main content
tip

Playlist input is meant for custom .pls files, not for HLS/CMAF M3U8 playlists!

Playlist input

Enables Playlist Input

Playlist Core

Every input within MistServer requires a Stream name and Source to understand what these mean exactly we recommend reading up on Stream settings

Playlist Support Matrix

CategorySupport
Input URLs*.pls,
playlist:*

Usage and need to knows

The playlist input will require a text document ending on .pls containing the media files in order to loop through. It should also always end on at least one white line. MistServer will loop through the file, line for line and then start from the beginning. Should changes be made while MistServer is reading the file they will only be implemented in the current loop should it take place in a line that is further than the current line MistServer is serving.

Each file in the playlist should have the exact same init data for the video/audio tracks otherwise there will be interruptions on the ingest & viewers might receive a disconnect/offline message when switching between files. Each file will be played through in real time as if it's a live stream. You cannot skip forward in a playlist stream and can only seek back for the build up DVR buffer. Invalid file paths, unsupported files and white lines are ignored during a loop.

The very first time an input is used within a loop it might be skipped if the creation of the DTSH file takes too long.

The file type of the media files does not matter.

Building a PLS file

Building the pls file can be done through any text editor, as long as the eventual format is saved with a .pls extention it will work. Every line that does not contain an #X-STARTTIME or file will be ignored & skipped when encountered.

Adding Media

Media can be added by writing down the filename.ext or /path/filename.ext

(path/)filename.ext`

If a media file is given without an /path/ it will look in the same folder for the file. Should the file not exist, or be incompatible with MistServer the ingest will be skipped and the next line will be read.

As an example:

playlist.pls

blue_10.mp4
red_10.mp4
/media/recordings/yellow_10.mp4

The above would:

  • Start playback with blue_10.mp4 in the same folder as the .pls
  • Once blue_10.mp4 is finished red_10.mp4 in the same folder will be played
  • After blue_10.mp4 it will then look for yellow_10.mp4 in /media/recordings/
  • After yellow_10.mp4 it will loop back to blue_10.mp4

Scheduling

Scheduling can be done through #X-STARTTIME:HH:MM

#X-STARTTIME:HH:MM

The HH:MM notation follows the 24h clock notation.

If an X-STARTTIME is encountered this will be considered the stop if the current time is before the given time. If the current time is beyond the X-STARTTIME anything below that given time will be seen as the start instead. As a simple example:

scheduled_playlist.pls

red_10.mp4

#X-STARTTIME:11:15

blue_10.mp4

#X-STARTTIME:15:45

yellow_10.mp4


The above would:

  • Loop red_10.mp4 from 00:00 to 11:14
  • Loop blue_10.mp4 from 11:15 to 15:44
  • Loop yellow_10.mp4 from 15:45 to 23:59

If the server reaches the given #X-STARTTIME it will interrupt whatever it is currently playing and switch to the first stream below the #X-STARTTIME line.

Tricks for live editing

MistServer keeps track of the line it's currently playing. Should it be important to edit the current loop you can insert a stream as long as it's below the current line. However this also means that should you add a line above where it's currently playing you'll cause MistServer to re-ingest the same file immediately after. If you're planning to make changes to a pls file we recommend adding a few white lines so you can do so without interrupting the current playback list too much. When removing a file from the list we recommend making it a white line instead of removing the entire line as well.

Example PLS

The following would play the media file red_10.mp4 then green_10.mp4 until it reaches green_10.ts and starts anew at red_10.mp4. Since no path is given for the files all files should be in the same folder as the .pls containing this list. A few white lines are kept in the middle for adding new files later on.

playlist.pls

red_10.mp4
green_10.mp4
blue_10.mp4
cyan_10.mkv
yellow_10.mkv
purple_10.mkv



blue_10.ts
red_10.ts
green_10.ts


Example PLS with Unix time

This one is slightly more complex:

  • From 00:00 to 12:39 loop green_10.mp4
  • From 12:40 to 12:49 loop red_10.mp4
  • From 13:54 to 14:59 loop blue_10.mp4
  • From 15:00 to 15:04 loop cyan_10.mkv
  • From 15:05 to 15:24 loop red_10.mp4, green_10.mp4, blue_10.mp4, cyan_10.mp4, yellow_10.mkv and purple_10.mkv in order
  • From 15:25 to 15:26 loop red_30.mkv, red_60.mkv
  • From 15:26 to 16:04 loop red_10.mp4, green_10.mp4 and blue_10.mp4
  • From 16:05 to 16:29 loop red_10.mp4, green_10.mp4, blue_10.mp4, cyan_10.mp4, yellow_10.mkv and purple_10.mkv
  • From 16:30 to 23:59 loop bllue_30.mkv and red_60.mkv

scheduled_playlist.pls

green_10.mp4
#X-STARTTIME:12:40
red_10.mp4

#X-STARTTIME:12:50
green_10.mp4

#X-STARTTIME:13:55
blue_10.mp4

#X-STARTTIME:15:00
cyan_10.mkv

#X-STARTTIME:15:05
red_10.mp4
green_10.mp4
blue_10.mp4
cyan_10.mp4
yellow_10.mkv
purple_10.mkv


#X-STARTTIME:15:25
red_30.mkv
red_60.mkv
#X-STARTTIME:15:26
red_10.mp4
green_10.mp4
blue_10.mp4

#X-STARTTIME:16:05
red_10.mp4
green_10.mp4
blue_10.mp4
cyan_10.mp4
yellow_10.mkv
purple_10.mkv


#X-STARTTIME:16:30
blue_30.mkv
red_60.mkv


Making files with the same video/audio init data

This is easier than you'd expect, but it does require preparation. Generally speaking if you use the same encoder with the same output settings you will have done this. An easy way would be having every file go through ffmpeg while setting the video/audio codec parameters specifically. For example:

ffmpeg -i INPUT -c:v h264 -s 1920x1080 -c:a aac -ac 2 -ar 48000 -strict -2 OUTPUT.mp4

While not every audio/video parameter needs to be the same the more they're equal the easier combining them would be. While in theory that means apart from codec most other settings are optional we've found that video often needs a similar resolution and audio needs similar channels and audio rate to be the same.

You can check through ffprobe whether the init data is the same:

ffprobe FILE

Look for the Video/audio codec, directly behind is the init data

Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661),
Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D)

Playlist Optional configurations

OptionDescriptionTypeDefaultAPICommandline
debugThe debug level at which messages need to be printed.debugInherited from parent processdebug--debug
Memory page timeoutFor bufferless or live inputs like HLS, set the timeout in seconds for old, inactive pages to be deleted. A longer value results in more memory usage, but ensures that recently buffered data stays in memory for longerNumber (unsigned integer)15pagetimeout--pagetimeout
Simulated LiveMake this input run as a simulated live streamFlagUnsetrealtime--realtime
Always onAutomatically starts this stream, regardless of viewers requesting it or not. Only available if the source is set to one of:
*,
.,
p,
l,
s
Booleanfalsealways_onundefined