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.
Obtain security credentials for storage account S3 access:
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.
Following these instructions, install the Red5 Pro Server.
# Cloudstorage Plugin Properties # # JetS3t library configuration option info: http://jets3t.s3.amazonaws.com/toolkit/configuration.html # # Plugin Services services=com.red5pro.media.storage.s3.S3Uploader,com.red5pro.media.storage.s3.S3BucketLister # Path streams.dir=/tmp/ # Full path to the ffmpeg executable ffmpeg.path=/usr/bin/ffmpeg # Time max.transcode.minutes=5 # 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 aws.access.key=YOUR_AWS_ACCESS_KEY aws.secret.access.key=YOUR_AWS_SECRET_ACCESS_KEY # Bucket name aws.bucket.name=red5provod # Valid locations are: US for United States, EU for Europe, and AS for Asia aws.bucket.location=US # Google Storage Configuration gs.access.key=YOUR_GOOGLE_STORAGE_ACCESS_KEY gs.secret.access.key=YOUR_GOOGLE_STORAGE_SECRET_ACCESS_KEY # Bucket name gs.bucket.name=red5provod
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.
aws.bucket.name= 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.
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="org.red5.io.flv.impl.FLV"> <property name="cache"> <ref bean="object.cache"/> </property> <property name="writerPostProcessors"> <set> <value>com.red5pro.media.processor.S3UploaderPostProcessor</value> </set> </property> </bean>
This configuration indicates that the S3 upload writerPostProcessor which implements IPostProcessor will be executed after a file is finalized by the FLVWriter.
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="com.red5pro.media.storage.s3.S3FilenameGenerator"/> -->
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
Change the forceVODRecord value from "false" to "true".
<!-- Force VOD recording --> <property name="forceVODRecord" value="false"/>
This will create, in
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.
You can view the HLS live or VOD stream using our HTML5 example here.
To use this example:
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
https://s3.amazonaws.com/red5-s3/live/streams/stream1471289267434.flv after the upload is completed.