
Wowza Streaming Engine can use HLS instead of RTMP for YouTube Live streaming. Explains how to use the HLStoYTB custom module and the benefits of using HLS instead of RTMP.
Why should we integrate with HLS?
When sending video or audio data using a real-time streaming protocol like RTMP, normal playback becomes impossible if even one of the following three conditions fails.
- Data must be delivered at the exact time.
- Data must be delivered in the correct order.
- Data must be delivered without corruption.
Furthermore, when transmission delays occur, the affected data accumulates in server memory. This can lead to insufficient available memory, causing Out of Memory issues on the streaming server.
The problem is, It’s not easy to satisfy those conditions on public internet environment. For these reasons, various alternatives have been proposed, one of which is the HLS protocol, which transmits video and audio using the HTTP protocol commonly used in web services
Unlike RTMP’s real-time transmission, the HLS protocol works by segmenting live stream data into video files at dedicated intervals and then uploading them to a target server. As a result, it is less impacted by network conditions, enabling stable transmission of the live stream. This characteristic of HLS offers many benefits when YouTube’s ingest point is located at overseas..
So, the writer developed the module.
The problem is that for Wowza Streaming Engine, the only built-in PUSH method is RTMP. HLS PUSH is available exclusively for Wowza service targets. The YouTube option under Stream Targets also uses RTMP.
If you need a something, make it yourself.
-EQMaker
For this reason, the writer developed the HLStoYTB module, which enables YouTube HLS PUSH on Wowza Streaming Engine. With this module, it is possible to set up a live stream to YouTube using HLS without worrying about the Wowza server crashing or internet connection issues.
HLStoYTB Module Installation Steps
Step 1 – Prerequisites
- Check that the Wowza Streaming Engine version is 4.5.0 or later.
- Get the HLS ingest URL from YouTube.
Step 2 – Download and Installation
- Download the
HLStoYTB
module. - Copy the downloaded
HLStoYTB.jar
file to the[Wowza install dir]/lib
directory. - Restart the Wowza Streaming Engine service.
HLStoYTB
module does not require a separate registration process. Wowza Streaming Engine will automatically load the module from the library upon restarting.
Step 3 – Configure the Environment
- Enable Apple HLS
Check that Apple HLS is enabled under Playback Types for the desired live application. If not, enable it.
- Adjust Chunk size
Select the
Properties
tab in the live application. Under theCupertino Streaming Packetizer section
, clickEdit
. Set cupertinoChunkDurationTarget to 4000 and click Save. This sets the duration of chunk to 4 seconds. (YouTube recommends a duration of 1 to 4 seconds, and the developer (the writer) also recommends using 4 seconds.) - Enable the Stream Target
Select Stream Target from the application menu, then click Enable Stream Targets to activate the feature. (If it is already enabled, you can skip this step.)
Stream Targets being enabled in Wowza Streaming Engine - Verify Custom PUSH Profile Path
Navigate to Server > Server Setup > Properties. Then, check for the following entry in the Custom section at the bottom. If it does not exist, add it.
- Path
- /Root/Server
- Name
- pushPublishProfilesCustomFile
- Type
- String (may be blank if a default setting exists)
- Value
- ${com.wowza.wms.ConfigHome}/conf/PushPublishProfilesCustom.xml
- Add a Custom Profile
Referencing the example below, add the
<PushPublishProfile>
block to the<PushPublishProfiles>
section of the[Wowza install dir]/conf/PushPublishProfilesCustom.xml
file. If the file does not exist, create it.<?xml version="1.0" encoding="UTF-8"?> <Root> <PushPublishProfiles> <PushPublishProfile> <Name>HLS-Youtube</Name> <Protocol>HTTP</Protocol> <BaseClass>kr.eqmaker.wms.hls.push.youtube.HLStoYTB</BaseClass> <UtilClass></UtilClass> <HTTPConfiguration> </HTTPConfiguration> <Properties> </Properties> </PushPublishProfile> </PushPublishProfiles> </Root>
Step 4 – Configure Stream Target
Enter the HLS ingest URL obtained from YouTube into the module. This guide assumes the ingest URL is https://a.upload.youtube.com/http_upload_hls?cid=eqma-kere-qmak-ereq-make©=0&file=
.
- Open PushPublishMap.txt
Open the
PushPublishMap.txt
file located at[Wowza install dir]/conf/[application name]/
. For example, if using an application namedlive
, the default paths are as follows:.
- Windows :
C:\Program Files\Wowza Media Systems\conf\live\PushPublishMap.txt
- Linux :
/usr/local/WowzaStreamingEngine/conf/live/PushPublishMap.txt
- Windows :
- Enter the Ingest URL
Following the explanation below, add the following content to the
PushPublishMap.txt
file.InputStream={"entryName":"HLStoYTB1", "profile":"HLS-Youtube", "streamName":"HLStoYTB1", "host":"a.upload.youtube.com/http_upload_hls?cid=eqma-kere-qmak-ereq-make©=0&file=", "sendSSL":"true"}
- InputStream
- The name of the input stream that will be sent to YouTube.
- entryName
- The name of the entry in the PushPublishMap.txt file. It must be unique within this file. It is recommended to use the same name as the
streamName
below. - streamName
- The name of the output stream. This name must also be unique. It is recommended to use the same name as the
entryName
above. - host
- Enter the HLS ingest URL obtained from YouTube. Exclude
https://
. - sendSSL
- Since YouTube uses HTTPS, set this to true.
- profile
HLS-Youtube
(Required)
If readers need to send a single stream to multiple targets, or send multiple streams from one application, they can simply add the required number of target entries to the PushPublishMap.txt
file.
Step 5 – Restart and Send Stream
Restart Wowza Engine to apply all changes. When an input stream is detected, the live application will automatically begin HLS transmission.
HLS targets configured this way will not appear in the Stream Target
section of the Wowza UI. The service status must be verified using the Wowza log files and the YouTube Live Control Room.
Conclusion
Although it can depend on the content type, using HLS for YouTube live streaming is highly advantageous for stability. The writer particularly recommends using HLS whenever possible to prevent entire service outages that can occur when using Wowza Engine.
It is unclear why Wowza does not offer a native HLS integration for YouTube, However, necessity is the mother of invention. With this module, it is now possible to set up HLS live streaming to YouTube from Wowza. The writer hopes this article and module will help the readers who may have given up on integrating Wowza with YouTube.
FAQ
- Why is HLS better than RTMP for YouTube Live streaming?
- Due to servers being located overseas, situations with unreliable network conditions can often occur. HLS is less affected by these conditions than RTMP, allowing for greater relative stability.
- Is HLStoYTB free?
- Yes. HLStoYTB is a free module distributed under the BSD 3-Clause License. It can be used for commercial purposes, and modification and redistribution are also permitted. However, the original copyright notice must be included in such cases.
- Can it be used for general-purpose HLS PUSH?
- It depends on the configuration of the receiving HLS server. This module’s output follows YouTube’s HLS ingestion specifications. It will work with servers that function identically to YouTube’s, but it cannot be used otherwise.
- Is there a limit to the number of stream targets?
- There is no specific limit.