YouTube HLS PUSH Live streaming from Wowza Streaming Engine

A Server pushing HLS

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.

  1. Data must be delivered at the exact time.
  2. Data must be delivered in the correct order.
  3. 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.

Increased memory usage in Wowza Streaming Engine due to transmission delays
Increased memory usage in Wowza Streaming Engine due to transmission delays

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

  1. Check that the Wowza Streaming Engine version is 4.5.0 or later.
  2. Get the HLS ingest URL from YouTube.

Step 2 – Download and Installation

  1. Download the HLStoYTB module. HLStoYTB : YouTube live streaming HLS Push Publish module for Wowza Streaming Engine.
  2. Copy the downloaded HLStoYTB.jar file to the [Wowza install dir]/lib directory.
  3. 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

  1. Enable Apple HLS

    Check that Apple HLS is enabled under Playback Types for the desired live application. If not, enable it.

    Apple HLS and RTSP/RTP enabled in the Playback Types of Wowza Streaming Engine.
  2. Adjust Chunk size

    Select the Properties tab in the live application. Under the Cupertino Streaming Packetizer section, click Edit. 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.)

    HLS chunk length set to 4000 msec in Wowza Streaming Engine

  3. 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
    Stream Targets being enabled in Wowza Streaming Engine

  4. 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
    The Custom Properties section in Wowza Streaming Engine

  5. 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&copy=0&file=.

  1. Open PushPublishMap.txt

    Open the PushPublishMap.txt file located at [Wowza install dir]/conf/[application name]/. For example, if using an application named live, 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

  2. 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&copy=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.

Leave a Reply

Your email address will not be published. Required fields are marked *