How to Create TV Channel-Style Streaming With Wowza Streaming Engine
December 18, 2017 by
With on-demand services such as Netflix dominating today’s digital video market and a growing number of sports teams taking their broadcasts online, everyone from major media companies to independent app creators are looking to incorporate OTT (over-the-top) content delivery in their offerings. What makes OTT channels most appealing is the availability of 24/7 programming, including broadcast-like, live-linear applications.
If you’re building a streaming video app, or integrating streaming into your existing product or service, you can use the Wowza Streaming Engine software to create 24/7 streaming “channels,” just like broadcast TV.
A complete tutorial is available in the Wowza documentation that walks you through how to configure TV-style streaming: “How to schedule streaming with Wowza Streaming Engine (StreamPublisher).” In this post, we’ll provide a deeper dive on configuring TV channel-style streaming using videos and live streams with Wowza Streaming Engine. You’ll learn how to schedule your programs and insert video ads into your live streams, as well as how this setup works with live encoding tools and media players.
Tools Used: Wowza Streaming Engine, Text Wrangler, Wirecast, Bitmovin Player
Enabling Advanced-Level Features
Before you start configuring TV channel-style streaming, you’ll need to enable your Wowza Streaming Engine Manager account as an Administrator, with access to advanced-level features. This means that “Allow access to advanced properties and features” should be selected from within your Admin account. This will give you the ability to configure items in the Server Listeners and Properties section of Server Setup, and the Properties and Modules section for an Application.
Understanding the ServerListenerStreamingPublisher
Let’s start with discussing the server listener, ServerListenerStreamingPublisher (listed at the bottom of the above image). This item gets added to the Server Setup, and allows live streaming using your SMIL schedule at startup. The gives you the ability to have videos and live streams played according to a specific schedule. However, the issue with only using this item is that it provides no way of loading new schedules. In this scenario, you would have to restart Wowza Streaming Engine every time you’d like to upload and use a new schedule for your channel—which is difficult and unrealistic.
Enter ModuleStreamPublisher. This module provides the option to reload and refresh your schedule. From a process standpoint, this cannot be done through the Wowza Streaming Engine Manager interface; instead, you must edit your SMIL file by hand, then upload the schedule file to the content location for your application (which is the default content folder, unless you’ve changed this for your application). Once your file is uploaded, you can reload the schedule.
How to Reload Schedules
To reload and update schedules, download the Module package, ModuleStreamPublisher, and unzip the files. Keep all the files in the same folder, and open the LoadSchedule.html page in a web browser. You’ll find the file in the ModuleScheduleClient folder.
Next, insert the address for your TV channel live stream into the text box (see the example above). A stream name is not needed. Then, click the Load Schedule button. The Message “Done!” should appear.
How to Edit Your SMIL Schedule
To edit your SMIL schedule file, you must use a text editor application. Editors such as Notepad++, Text Wrangler, and BBEdit work well for this.
Confirming the Correct Time on Your Server
Before you start creating the playlists for your channel, you should first confirm the correct time on your server. You can easily do this by remoting into your server and checking the time that appears in the user interface.
If you’re using Wowza Streaming Engine with Amazon EC2, keep in mind that this is likely in Coordinated Universal Time (UTC). Understanding this information from the start will save you a tremendous amount of troubleshooting time. You can also confirm the server time by checking your Wowza logs.
In addition, as you’re testing your playlists, schedule items 10 to 15 minutes into the future; this will give you time to configure items and update schedules.
To add videos, it’s best to use .MP4 files using the H.264/AVC codec. These files work well with Wowza Streaming Engine. A good approach to start with for testing would be to use a 360p file for playback, and encode all videos with the bitrate geared for CBR (constant bitrate) playback. The required data rate is not too high, and it will help you better understand how the TV channel style streaming setup works.
Here’s an example of what the formatting will look like in your SMIL file. You can add a snippet of code like this to your SMIL schedule to create a playlist of items with videos that loop. These videos will continue to loop as long as the playlist is playing. If this is the only playlist item, the videos will continue play to as long as the server is running.
The pl1 parameter is the name for the playlist number, and is considered a program that is playing on the channel. If you have three playlist items, pl1 would play first; pl2 would play next; and pl3 would appear last.
Now remember: You’re configuring items for a live stream. Therefore, the most important item to understand here is the playOnStream parameter, labeled Stream1. In the live-streaming space (and in many tools), this is known as the stream name for your TV channel. Since this is technically a live streaming channel, the Stream1 label could be changed to say whatever you’d like; you will use this when you get ready to play the live stream (more on that later).
To add videos to your playlist item, you can add the mp4: prefix before each video source, as you see above. Using start=“0” will allow the video to start and play from the beginning. You can also have a video start, for example, 10 seconds in, by using start=“10”. Setting length="-1" will play the entire video to the end, then move to the next source in the list.
The way pl1 is designed, with two videos, means that the videos will continue to loop until the next playlist item occurs. Please note that when the time and date is in the past, the playlist will start playing automatically. This usually works well for the first playlist item (pl1 in this example).
If you run into any issues with your videos playing properly, remove the “-1” value for length, and instead use the total time for the video (in seconds). This will play the video for the entire duration you specified. (Check out the videos in the third playlist, pl3, to see how this looks.)
Adding Video Ads
If you’d like to include video ads, you can insert them after the last video in your playlist. You can also include a playlist specifically for video ads.
Above is an example of what this would look like. Notice that the second playlist (pl2) and the fourth playlist (pl4) only have video ads that will be inserted into the live-streaming TV channel.
The benefit of inserting ad-only playlists is that you can easily add, remove and update your ads. In this example, there is a 60-second video ad named “VideoAd_1.mp4,” and a 30-second ad that follows named “VideoAd_2.mp4.” Since the repeat value is set to true, the two video ads will loop until the next playlist, at the scheduled time of 10:00:00 UTC.
How to Add Live Streams to Your Live Streaming Channel
With TV channel-style streaming, but you can insert other live streams into your own channel. You’ll treat these live streams like you normally would in your live encoder. In terms of the encoder setup, the following would be configured in a tool such as Wirecast:
In this example SMIL schedule, the live-streaming channel is working on the application called app_live. The stream name is samples. In this scenario, you can use any stream name you’d like—as long as it’s not “Stream1,” since that’s the name of the live TV channel, which can be found in the playlist.
The way the second playlist (pl2) of our SMIL schedule is configured, our stream will go live at 4:55:00 UTC. For live streams, start is set to “-2” and length is set to “-1”. In this case, the live stream will continue to play until another playlist item interrupts the playlist at 5:15:00 UTC.
Building Your Playlist Items
You can construct your playlist in almost any way you’d like. This channel has three playlists included in the schedule. The first playlist continues to loop through two videos, until it’s interrupted by the live stream for the second playlist at 4:55:00 UTC. The third playlist will start at 5:15:00 UTC, and will continue to loop through the two videos until the server stops, or until the schedule is updated or reloaded.
Notice that for the first playlist (pl1), the length is set to “-1”. This means the two videos in the list will play to the end. For the third playlist (pl3), the length is set in seconds, which means the first video will play for one minute and the second will play for 10 minutes. With the repeat value set to true, the channel will continue to only play these two videos.
This playlist has five playlist items, and the content changes at the top of every hour. It also has an ad playlist that occurs at 10:00:00 and 12:00:00 UTC. You can easily configure a 24/7 channel if you continue to use this pattern by adding a new playlist every hour.
Playing Your Live Streaming Channel
Now for the final step: Playing the channel. To play this live TV channel, you’ll format it as shown above in your media player. For the pictured player code, Bitmovin Player is being used. The media player will prioritize the MPEG-DASH version, and will play the HLS version second. Notice that the same information is used when sending a live stream to the channel; in this case, “Stream1” is used, because it’s the stream name for our live TV channel.
And that’s all there is to it! Hopefully this gives you a better understanding of how live TV channels work using Wowza Streaming Engine. Still have questions? Join our #livestreaming Slack channel, or check out the Wowza Forums.