Play VOD file as a Live Stream from S3

In summary, here’s what I need help with:

  • Be able to play a VOD file as a live stream

  • Be able to control the start and stop events of the VOD file playing on the live stream

  • The file is hosted on Amazon S3

    Ultimately, I want to be able to publish a live stream, then trigger a VOD file to play from Amazon S3 during the live event, all while recording them to a single file using the Live Stream Recording Module.

    Thanks.

You can create a live stream from static content, but not a file stored on S3. The only way is use s3fs to mount a bucket and make it a content location, but that’s not recommended, it might not work well. Otherwise you would have to use MediaCache (or vods3 on ec2 instance) and I don’t think there is a way to mix vod MediaCache stream with Stream class, it has to be local content. (steps below)

Here are various Stream Class links:

https://www.wowza.com/docs/stream-class-example

https://www.wowza.com/docs/how-to-schedule-streaming-with-wowza-streaming-engine-streampublisher

https://www.wowza.com/docs/how-to-control-stream-class-streams-dynamically-modulestreamcontrol

https://www.wowza.com/docs/how-to-switch-streams-using-stream-class-streams

For finer control, take a look at the IPublishingProvider API

https://www.wowza.com/forums/showthread.php?16460-How-to-use-IPublishingProvider-API-to-publish-server-side-live-stream

Richard

I might be wrong about s3 limitation… I will test that and return.

Richard

Yes, correction, you can use MediaCache resource in live application as a source for Stream class streams.

Install MediaCache Addon, add the MediaCache randomAccessReaderClass Property to the /conf/live/Application.xml /MediaReader /Properties, or whatever application you are running the scheduler on. Then you can reference resource located on a web server in the schedule.smil:

<smil>
    <head>
    </head>
    <body>
        <stream name="Stream1"></stream>        
        <playlist name="pl1" playOnStream="Stream1" repeat="true" scheduled="2009-12-11 16:24:00">
            <video src="mp4:http/[web-content-server]/sample.mp4" start="0" length="-1"/>
        </playlist>
    </body>
</smil>

Playback in Wowza LiveVideoStreaming player:

Server: rtmp://[wowza-address]:1935/live

Stream: Stream1

Richard

Turning off DEBUG logging should help. Set it back to default INFO level.

Richard

The file is there.

Is StreamType set to “live”?

Zip up conf folder and current access and error log and send to support@wowza.com

Richard

We need the access and error log in the /logs folder. Make sure you restart Wowza and do some testing first, then send the logs that show that.

Richard

MediaCache randomAccessReaderClass Property to the /conf/live/Application.xml /MediaReader /Properties

can you give exact xml example of it please

I got it…:

com.wowza.wms.plugin.collection.mediacache.MediaCacheLocalFirstRandomAccessReader

Yes, correction, you can use MediaCache resource in live application as a source for Stream class streams.

Install MediaCache Addon, add the MediaCache randomAccessReaderClass Property to the /conf/live/Application.xml /MediaReader /Properties, or whatever application you are running the scheduler on. Then you can reference resource located on a web server in the schedule.smil:

<smil>
    <head>
    </head>
    <body>
        <stream name="Stream1"></stream>        
        <playlist name="pl1" playOnStream="Stream1" repeat="true" scheduled="2009-12-11 16:24:00">
            <video src="mp4:http/[web-content-server]/sample.mp4" start="0" length="-1"/>
        </playlist>
    </body>
</smil>

Playback in Wowza LiveVideoStreaming player:

Server: rtmp://[wowza-address]:1935/live

Stream: Stream1

Richard

Thanks - I was able to create live streams from static content and record from there. There is about 5 seconds of black though when I append live streams to an already existing file. Any idea why that’s happening?

Bummer on the S3 limitation though. Any plans to make this work in the future? For now, I’ll have to find a way to get specific files from S3 and FTP them over to origin somehow… makes it harder when there are redundant streaming servers too.

Hi

If you follow the steps above this should work fine, double check what you have done for MediaCache and check for typos or spelling mistakes.

Jason

Hi Richard,

I’m still finding my way around wowza so please forgive me if this is an easy fix. I’m trying to stream VoD content as live from an http source. I’ve gone through the installation of MediaCache Addon but it doesn’t seem to be working correctly. Here is the error I get on debug mode. Thanks again for the help

DEBUG server comment - MediaReaderH264.mp4ReadAheadSize: 65536
DEBUG server comment - MediaReaderH264.mp4ReadAheadTrigger: 32768
DEBUG server comment - MediaReaderH264.mp4IndexBufferSize: 16384
DEBUG server comment - MediaReaderH264.randomAccessReaderClass: com.wowza.wms.plugin.mediacache.impl.MediaCacheRandomAccessReader
DEBUG server comment - MediaCache.acquireReader[http://media2.ms.kitd.com/mm/flvmedia/73/i/0/1/i01y623g_ae0eg36n_h264_1328K.mp4]: createNew
DEBUG server comment - MediaCacheSourceBasic.canHandle[http]: false mediaName:http://media2.ms.kitd.com/mm/flvmedia/73/i/0/1/i01y623g_ae0eg36n_h264_1328K.mp4 prefix:http/
WARN server comment - MediaCache.createNewCachItem: Cannot find MediaCacheSource for (http://media2.ms.kitd.com/mm/flvmedia/73/i/0/1/i01y623g_ae0eg36n_h264_1328K.mp4).
DEBUG server comment - MediaCache.acquireReader[http://media2.ms.kitd.com/mm/flvmedia/73/i/0/1/i01y623g_ae0eg36n_h264_1328K.mp4]: createNew
DEBUG server comment - MediaCacheSourceBasic.canHandle[http]: false mediaName:http://media2.ms.kitd.com/mm/flvmedia/73/i/0/1/i01y623g_ae0eg36n_h264_1328K.mp4 prefix:http/
WARN server comment - MediaCache.createNewCachItem: Cannot find MediaCacheSource for (http://media2.ms.kitd.com/mm/flvmedia/73/i/0/1/i01y623g_ae0eg36n_h264_1328K.mp4).
WARN server comment http://media2.ms.kitd.com/mm/flvmedia/73/i/0/1/i01y623g_ae0eg36n_h264_1328K.mp4 MediaReaderH264.open[1]: java.io.IOException: MediaCacheRandomAccessReader.open: Item not in cache: http://media2.ms.kitd.com/mm/flvmedia/73/i/0/1/i01y623g_ae0eg36n_h264_1328K.mp4
INFO server comment - ServerListenerStreamPublisher PlayList Item Start: mp4:http://media2.ms.kitd.com/mm/flvmedia/73/i/0/1/i01y623g_ae0eg36n_h264_1328K.mp4
INFO server comment - Stream.switch[live/_definst_/Stream1]: index: 0 name:mp4:http://media2.ms.kitd.com/mm/flvmedia/73/i/0/1/i01y623g_ae0eg36n_h264_1328K.mp4 start:0 length:-1

I have checked for spelling mistakes and I don’t see anything. The server runs its just that using live client player when it connects to the stream I get no video or audio. I’m running the server with ./startup.sh and it keeps saying that it cannot find the mp4 from the link but if you go to the link directly it is there.

WARN server comment - MediaCache.createNewCachItem: Cannot find MediaCacheSource for (http://www.mediacollege.com/video/format/mpeg4/videofilename.mp4).
WARN server comment - MediaCache.createNewCachItem: Cannot find MediaCacheSource for (http://www.mediacollege.com/video/format/mpeg4/videofilename.mp4).
WARN server comment http://www.mediacollege.com/video/format/mpeg4/videofilename.mp4 MediaReaderH264.open[1]: java.io.IOException: MediaCacheRandomAccessReader.open: Item not in cache: http://www.mediacollege.com/video/format/mpeg4/videofilename.mp4
INFO server comment - ServerListenerStreamPublisher PlayList Item Start: mp4:http://www.mediacollege.com/video/format/mpeg4/videofilename.mp4
INFO server comment - Stream.switch[live/_definst_/Stream1]: index: 0 name:mp4:http://www.mediacollege.com/video/format/mpeg4/videofilename.mp4 start:0 length:-1

the StreamType is set to live. I have emailed the conf folder. But for the access and error log i’m assuming you want the ones from where the VoD content is located. I don’t actually have access to that. I can create a quick http server and send those logs if needed. But if I’m able to access the stream via http I don’t seen a reason why it would have trouble to access it.

I figured out the problem. It had to do with the prefix I was using. I was using the full http:// url instead of http/

thanks again for the help. great support

Hi,

To correctly setup the Media Cache feature, you should follow the steps from the “How to scale video on demand streaming with Media Cache” forum article.

Zoran

Hi,

I apologize for the late reply. You can configure Media Cache for a “live” application as well, but this is not possible through the Wowza manager user interface.

You can take your live application, have your setup configured as described in the “How to schedule streaming with Wowza Streaming Engine” forum article and then configure it to use the Media Cache feature directly in your application’s Application.xml configuration file.

A faster approach would be to have your current vod application that is already configured to use Media Cache, and in the …/conf/[applicationName]/Application.xml file change the /Root/Application/AppType to Live and the /Root/Application/Streams/StreamType to live. If you also wish to provide http based streams from your application, make sure to enable the respective LiveStreamPacketizers from the /Root/Application/Streams/ block as well.

After having this ready, you can follow the instructions from the “How to schedule streaming with Wowza Streaming Engine” forum article.

In the streamschedule.smil file, make sure to reference the video on demand content using the appropriate Media Cache prefix.

You would have something like this:

<smil>
    <head>
    </head>
    <body>
        <stream name="Stream1"></stream>
        
        <playlist name="pl1" playOnStream="Stream1" repeat="true" scheduled="2013-09-25 16:00:00">
            <video src="mp4:[MediaCachePrefix]/path/to/your/file1.mp4" start="5" length="5"/>
            <video src="mp4:[MediaCachePrefix]/path/to/your/file2.mp4" start="50" length="5"/>
            <video src="mp4:[MediaCachePrefix]/path/to/your/file3.mp4" start="150" length="5"/>
        </playlist>
    </body>
</smil>

Zoran

Hello,

I am having difficulties with this.

I tried both with HTTP and AmazonS3 source for MediaCache and none of them worked.

In the smil we don’t have to put the full url right? Just src=“mp4:amazons3/[bucketname]/[filename].mp4” … />

The Application is of type Live

The error I get is: MediaCacheRandomAccessReader.open: MediaCache source not permitted for this application [amazons3]

How do I configure my application to be able to use MediaCache?

Thank you for any help on this

Sébastien

Thanks for the help zoran

But there are 2 contradictory things:

For Schedule to work it need to be a Live Application (“Each application that runs a schedule must have a live stream type” : https://www.wowza.com/docs/how-to-schedule-streaming-with-wowza-streaming-engine-streampublisher

For MediaCache to work it needs to be a VOD Edge Application (as from the link you passed)…

I am a bit lost as to how to do Live VOD from S3 (and MediaCache) as the title says and Richard confirmed it was possible.

Hi,

To correctly setup the Media Cache feature, you should follow the steps from the “How to scale video on demand streaming with Media Cache” forum article.

Zoran

Hi Zoran,

Could you just confirm that it is indeed possible to Live stream from MediaCache (VOD Edge Application)?

I am able to do a VOD from AWS S3 perfectly. What I would like to do now is being able to schedule this same static file on S3 in my Schedule (Live Application) so all the viewer see the same moment of the video.

thanks for the support,

Sébastien

Hi Sebastien,

Is there any update to this issue you were facing? I seem to be running into a similar problem.

Thanks,

Harsha