How to read VOD files from Amazon S3 on Standalone Wowza Server

UPDATE: Official documentation be available here:

http://www.wowza.com/forums/content.php?551-How-to-use-Amazon-S3-with-a-standalone-Wowza-Media-Server-and-the-MediaCache-AddOn

from this line all be outdated ——->

I’ll explain how to is possible read the files from Amazon S3 Storage but without using a EC2 instance.
For example your “localhost” or your Standalone Wowza server running on your own datacenter.

I did this for working on my local development environment, I’ll describe the steps for a Linux environment.

1- Download from this URL the 2 Jars, and copy this in /lib directories.

wms-plugin-amazonaws.jar (1691)
wms-plugin-mediacache.jar (1681)

2- Create the MediaCache folder:

mkdir /mnt/mediacache

3- Insert into the conf/Server.xml this lines:

<ServerListeners>
      <ServerListener>
                <BaseClass>com.wowza.wms.plugin.amazonaws.ec2.mediacache.MediaCacheServerListenerAmazonEC2</BaseClass>
       </ServerListener>
</ServerListeners>

4- Insert into the conf/vods3/Application.xml (create this first) this lines:

                <MediaReader>
                        <Properties>
                                <Property>
                                        <Name>randomAccessReaderClass</Name>
                                        <Value>com.wowza.wms.plugin.amazonaws.ec2.mediacache.MediaCacheRandomAccessReaderAmazonEC2</Value>
                                </Property>
                                <Property>
                                        <Name>bufferSeekIO</Name>
                                        <Value>true</Value>
                                        <Type>Boolean</Type>
                                </Property>
                        </Properties>
                </MediaReader>

And in the end of the file, add this properties (I don’t know is needed this for read Public content):

                <Properties>
                        <!-- Set these two properties to do S3 authentication -->
                        <Property>
                                <Name>awsAccessKeyId</Name>
                                <Value>KEY</Value>
                        </Property>
                        <Property>
                                <Name>awsSecretAccessKey</Name>
                                <Value>KEY</Value>
                        </Property>
                </Properties>

5- Restart the Wowza Server and try reading from S3 Bucket.

The URL can be like this:
rtmp://localhost/vods3/_definst_/mp4:amazons3/wmconsulting.content/Extremists.m4v

Tell me is I missing some step or need some extra help.

11 pensamientos sobre “How to read VOD files from Amazon S3 on Standalone Wowza Server”

  1. I have tried to follow your tutorial but my question is how did you set the ${com.wowza.wms.context.VHostConfigHome}/content in your application.xml.

    Thanks

  2. CJ, in this case don’t need change the content directory. Why? With the module you need send the file name with the ‘amazons3’ on the path, like ‘mp4:amazons3/bucketName/fileName.mp4’ this way the module detect than the file is located on S3 and load this file from amazon or the mediacache implemented by wowza

    Don’t hesitate to ask if have any doubt.
    Regards,
    Alejandro

  3. CJ, one question.
    The issue is how to integrate Stream Class Controller reading files from S3? if this the question I’ll prepare one post for explain in more detail this point a soon as posible, but basically only need replace de standard filename like ‘mp4:Extremists.mp4’ with this ‘mp4:amazons3/BucketName/Extremists.mp4’

    Tell me if this tip help you or need more detail explanation, I’ll be happy to help…
    Regards,
    Ale

  4. Many thanks for being so helpful. The use of streamschedule.smil means that the files i.e. Extremists.mp4 etc does not need to be streamed using something like ‘mp4:amazons3/BucketName/Extremists.mp4 but rather the name of the stream is what is needed as stated in the .smil file. So it should be something like amazons3/BucketName/application/streamname or something of some sort.

    Not sure if you got my logic.

    Thanks.

  5. Cj, you need put the path with amazons3 inside of the .smil file but for play you need call with the streamName declared in the .smil file.

    I’ll post one example tomorrow.

    Ale

  6. Thanks again Ale,

    Typically the .smil does not include any path. The example is:

    The Playlist contains 2 files but the path is set in the application.xml and not in the .smil.

    Anyway will await the examples you mentioned.

    On another note, have you been able to save your EC2 images so that when you terminate or reboot, you will not have to start everything all over again the next time you start up the image.

    Many thanks.

  7. Cja, about save your AMI, the unique way is rebundle the AMI image and register your own AMI.
    I’m doing this all the time for save my setting :(
    Other way, is save the “WowzaMediaServer” folder on S3, and mount this folder on the AMI Startup with Startup script and s3fs.

    T



    Where for play this stream use this link’s depend of your device:

    Android/Blackberry
    rtsp://ec2.wmconsulting.info/live/mobile

    Flash player
    rtmp://ec2.wmconsulting.info/live/mobile

    iPhone
    http://ec2.wmconsulting.info:1935/live/mobile/playlist.m3u8

    Tell me if this example is more useful :)
    Ale

  8. Hi guys, just to add.

    To read non-public files from S3, the url should be something like this:

    rtmp://localhost/vods3/_definst_/flv:amazons3/BUCKETNAME/path/to/file/videofile.flv

    and as you said in your post that the properties awsAccessKeyId and awsSecretAccessKey to the conf/Server.xml (because I tried in conf/vods3/Application.xml and didn’t work and struggled a bit with it).

  9. Any tips for running on windows? Im using the stream class to stream vod. Seems that something is wrong with my configuration:

    INFO server comment – Stream.switch[MMCVideo/_definst_/tony]: index: 0 name:mp4:amazons3/MMCMain/Videos/Extremists.m4v start:0 length:-1
    INFO server comment – MediaCacheHTTPAmazonEC2.init url:http://MMCMain.s3.amazonaws.com/Videos/Extremists.m4v <—- why

    INFO server comment – LivePlayer.play[MMCVideo/_definst_/tony]: Dynamic Stream Markers are on.
    WARN server comment – MediaCacheHTTPAmazonEC2.getItemInfo: Status 404: Path not found [/Videos/Extremists.m4v].
    WARN server comment – MediaCacheItemBase.init: Error: Length is zero[0]: amazons3/MMCMain/Videos/Extremists.m4v
    INFO server comment – MediaCacheHTTPAmazonEC2.init url:http://MMCMain.s3.amazonaws.com/Videos/Extremists.m4v
    WARN server comment – MediaCacheHTTPAmazonEC2.getItemInfo: Status 404: Path not found [/Videos/Extremists.m4v].
    WARN server comment – MediaCacheItemBase.init: Error: Length is zero[0]: amazons3/MMCMain/Videos/Extremists.m4v
    WARN server comment amazons3/MMCMain/Videos/Extremists.m4v MediaReaderH264.open[1]: java.io.IOException: MediaCacheRandomAccessReader.open: Item not in cache: amazons3/MMCMain/Videos/Extremists.m4v <— Item not in cache

    Id appreciate any pointers
    -tony

  10. Hi,
    I tried to setup and run mediacache in my local wowza as above, but I am getting below error message:

    ERROR server comment – MediaCacheStore.getNextItem: java.io.IOException: No such file or directory
    ERROR server comment – MediaCacheStore.getNextItem: java.io.IOException: No such file or directory
    ERROR server comment – MediaCacheStore.getNextItem: java.io.IOException: No such file or directory
    ERROR server comment – MediaCacheStore.getNextItem: java.io.IOException: No such file or directory
    ERROR server comment – MediaCacheStore.getNextItem: java.io.IOException: No such file or directory
    ERROR server comment – MediaCacheStore.getNextItem: java.io.IOException: No such file or directory
    ERROR server comment – MediaCacheStore.getNextItem: java.io.IOException: No such file or directory
    ERROR server comment – MediaCacheStore.getNextItem: java.io.IOException: No such file or directory

    Thanks in Advance,
    Birendra

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos necesarios están marcados *


*