Using AWS S3 for Video On Demand

The use of the Cloudstorage Plugin requires configuration in both the server and in each application utilizing the plugin features. The plugin configuration consolidates the majority of properties required to access cloud storage on Amazon S3. The server configuration must identify the post-processor implementations to use in conjunction with the FLVWriter. An application which will utilize cloud storage for recording and playback has to contain the bean entry for custom file name generator or it will use the Red5 Pro default location.

Create Security Account

Obtain security credentials for storage account S3 access:

  • Go to the Amazon Identity and Access Management Dashboard
  • From the left-hand navigation, choose Users
  • Click on Add user
  • Enter a User name: (for example, "s3accessuser"); Select AWS Access type Programmatic access; click on Next: Permissions
  • Choose Attach existing policies directly; Search for and choose AmazonS3FullAccess; click on Next: Review
  • Click Create user
  • Click Show under Secret access key to reveal the key generated. It is critical that you make a note of this, as you will not be able to retrieve it from the AWS console after you close the creation screen.
  • Click “download Credentials” button to download a csv file with the credentials to your computer. You will not have this option again, so keep this file in a safe place!
  • Click “close” to close the window and return to IAM Users screen.
  • You should be able to see the user you recently created - “s3accessuser” in the list on the page.

Set up an S3 Storage Bucket to be Used for VOD

Navigate to S3 Storage on AWS.

Click on the Create Bucket button.

Enter a bucket name and choose the region you wish it to be hosted in. (Note: bucket names must contain only lowercase characters. Also the bucket name cannot include any periods (.) or spaces, otherwise the playback feature will fail). The click on Create. Also note - at this time, buckets must be in either US or Asian regions. EU regions are not supported. No additional permissions need to be set.


Install Red5 Pro Server

Following these instructions, install the Red5 Pro Server.

Modify Cloudstorage Plugin Properties File

Edit the {red5pro}/conf/ file:

# Cloudstorage Plugin Properties
# JetS3t library configuration option info:

# Plugin Services,

# Path
# Full path to the ffmpeg executable

# Time

# FFMpeg command line for transcoding flv to mp4
## add the '-report' parameter after '-y' to get a log for debugging if problems occur
## Variables: 0=replaced with ffmpeg path, 1=input file path, 2=output file path

### LGPL command template
#ffmpeg.template=%s -y -async 1 -i %s -acodec aac -b:a 128k -ar 44100 -strict -2 -vcodec libopenh264 -pix_fmt yuv420p -profile:v baseline -level 3.0 %s

### GPL command template
ffmpeg.template=%s -y -async 1 -i %s -acodec aac -b:a 128k -ar 44100 -strict -2 -vcodec libx264 -pix_fmt yuv420p -profile:v baseline -level 3.0 %s

# AWS Configuration
# Bucket name
# Valid locations are: US for United States, EU for Europe, and AS for Asia

# Google Storage Configuration
# Bucket name

Plugin Properties

  • streams.dir = The base directory from which read from and recorded to. A streams application / scopes are appended to this path.
  • aws.access.key = Your AWS access key.
  • aws.secret.access.key = Your AWS secret access key.
  • = The S3 bucket in which files will be stored.
  • aws.bucket.location = Geographic location of the S3 bucket.
  • ffmpeg.path = Full path to the FFMpeg executable (Transcoding processor only).
  • ffmpeg.template = FFMpeg command line to use for transcoding.
  • max.transcode.minutes = Maximum time in minutes allotted for transcoding to run per file.

Server Configuration

The writer post processors used by FLVWriter are configured in the server's common configuration file: conf/red5-common.xml. The example below displays the configuration with the S3 post-processors (note - this bean exists in the file, you just need to modify & add the writer post processors value):

<bean id="flv.impl" class="">
  <property name="cache">
    <ref bean="object.cache"/>
  <property name="writerPostProcessors">

This configuration indicates that the S3 upload writerPostProcessor which implements IPostProcessor will be executed after a file is finalized by the FLVWriter.

Application Configuration

Every server application that will utilize S3 for storage must have its configuration file modified to use the FilenameGenerator features. The live webapp (red5pro)/webapps/live/WEB-INF/red5-web.xml now contains this line which can be un-commented:

    <!-- Enable this if you're using S3 storage -->
    <bean id="streamFilenameGenerator" class=""/>

Red5 server applications use the streamFilenameGenerator bean when specified for locating media files for Playback or Recording; if the bean is not specified in an applications red5-web.xml, the default generator will be used which plays from and records to an applications streams directory.


By default, Red5 Pro mobile clients record FLVs and HLS files; Flash clients record FLVs only. If you want to record HLS for Flash VOD as well, modify (red5pro)/conf/hlsconfig.xml

Change the forceVODRecord value from "false" to "true".

    <!-- Force VOD recording -->
    <property name="forceVODRecord" value="false"/>

This will create, in (red5pro)/webapps/live/streams, the streamname.m3u8 file and a number of streamname_#.ts files. In addition, if you are copying up to a storage bucket, then in the live directory, there will be a streamname sub-directory which contains the m3u8 and ts files.

Red5 Pro HTML5 HLS Example

You can view the HLS live or VOD stream using our HTML5 example here.

To use this example:

  1. Stream URL or IP - Enter your server IP or URL (if your solution is clustered then enter the Origin IP address).
  2. Stream Port - enter port if using a different one than the Red5 Pro default 5080.
  3. Stream Websocket Port - enter port if using a different one than the Red5 Pro default 6262.
  4. Stream Context - enter if using different webapp than the default live.
  5. Stream Name - enter the stream name you want to subscribe to (do not incude the m3u8 extension), or leave blank for VOD.
  6. Subscribe via Red5 Pro Cluster? - check here if your servers are clustered.
  7. Subscribe to Red5 Pro VOD? - check here to initiate playlists search for your VOD. The Stream Name box will change to a drop-down list of available HLS VOD streams.
  8. Click on the Save button. This will generate the Stream URL and Stream WebSocket URL for the stream you've selected.
  9. Click on the PLAY button that will appear at the top left of the black video preview.

Note that HLS latency is generally between 10 and 12 seconds, so you will not be able to view your live video right away.


The S3UploaderPostProcessor simply uploads a supplied FLV file to an S3 bucket with a public read ACL and mime type of video/x-flv. For example, a file named stream1471289267434.flv recorded to the application live using a bucket named red5-s3 would be made available at after the upload is completed.