Note: Wowza Media Server 3.0.3.08 or higher is required.
Note: This package assumes you have the live stream you wish to record up and running.
The live stream recording API provides methods for starting and stopping recording of live streams.
This package includes two variations: 1) A Wowza application module that can be controlled with the Flash application included in the /client folder, and 2) A Wowza HTTProvider that can be controlled with the HTML form in the /clientHTML folder or using a simple HTTP url with querystring parameters, which is ideal for integration with other processes. See Install HTTProvider section below.
- startRecording(streamName, recordOptions);
- stopRecording(streamName);
Source code for the application module, HTTProvider, Flash client and HTML form are included. You are free to use and modify these examples. The Javadoc documentation for the live recording API is included in the documentation folder.
The live streaming recording API can record in two formats: FLV and MP4 (Quicktime container). There are a number of other available settings:
- append Append recordings if a file exists. This is false by default
- version/overwrite Start new recordings and version existing recording like myStream_0.flv, or overwrite the existing file. Default is version
- startonkeyframe Start recording on key frame. This is false by default
- recorddata Include cuepoints and metadata. This is true by default.
- output An absolute path + stream name + extension to save the recording to. This is empty by default, recordings are saved to the Application's content folder using the stream name as the file name, and adding appropriate extension (.flv or .mp4)
You can set the above record options in the Flash application or the HTML form or through HTTP url querystring parameters, or they can be set and modified in the source for application module and HTTProvider.
1. Copy file lib/wms-plugin-integrationrecord.jar and lib/wms-plugin-livestreamrecord.jar to the [install-dir]/lib/ folder.
2. Edit [install-dir]/conf/[application]/Application.xml and add the following <Module> item as the last item in the <Modules> list:
<Module> <Name>ModuleLiveStreamRecord</Name> <Description>ModuleLiveStreamRecord</Description> <Class>com.wowza.wms.plugin.livestreamrecord.ModuleLiveStreamRecord</Class> </Module>
- Run using Flash client
Double click client\livestreamrecord.html and change the Server and Stream fields to the RTMP URL and Stream name of your live stream and click the Play button. Once you have the live stream playing, click the Start Recording button to start recording the stream. Click Stop Recording when you want to stop recording the stream.
- To use this method, first follow all the steps above including configuring an application with the LiveStreamRecord Module.
- Then add this HTTProvider to /conf/VHost.xml /HostPort (Port 8086) /HTTProviders container. Put it above the last HTTProvider in that group, 2nd from last
<HTTPProvider> <BaseClass>com.wowza.wms.plugin.livestreamrecord.HTTPLiveStreamRecord</BaseClass> <RequestFilters>livestreamrecord*</RequestFilters> <AuthenticationMethod>none</AuthenticationMethod> </HTTPProvider>
- You can use this HTML form but the real strength of this method is the potential for integration using HTTP get method and querystring parameters. This is the minimum necessary.
Required parameters:http://[wowza-address]:8086/livestreamrecord?app=live&streamname=myStream&action=startRecording
- app=[app-name]
- streamname=[stream-name] (Must be a live stream)
- action=startRecording|stopRecording
Optional settings and their defaults:
- append=true|false (Default is false)
- version=true|false (Default is true. If set to false, and append is false, an existing file will be overwritten)
- startonkeyframe=true|false (Default is false)
- recorddata=true|false (Default is true)
- output=[path]/[filename].[ext] (Default is empty, files are recorded to content folder)
- format=1|2 (1 = flv, 2 = mp4. Default is 1)
- You can add security by change the AuthenticationMethod to "admin-basic"
<AuthenticationMethod>admin-basic</AuthenticationMethod>Then add username and password inline:http://username:password@[wowza-address]:1935/livestreamrecord?app=live&streamname=myStream&action=startRecording
Note: Only H.264 video and either AAC or MP3 audio can be recorded to the .mp4 format.
Note: This API can also be called server side to control the recording process.
Note: There are three operations exposed through JConsole/JMX: recordStream, stopRecording, getRecorderNames. This enables starting and stopping of recording through the Module interface exposed in JMX. The second parameter of recordStream (format) has the following values: 0=Use original stream format, 1=Record in FLV container, 2=Record in MP4 container.