# Wowza Media Server 3.5 Examples: Live Stream Record Example Module

The Live Stream Record API provides methods for starting and stopping recording of live streams.

This package includes an application module for Wowza Media Server 3.5 that can be controlled with the Adobe® Flash application that's included in the [package]/client folder.

Source code for the application module and Flash client is included in this package. You are free to use and modify these examples. The Javadoc documentation for the Live Stream Record APIs is included in the Wowza Media Server server-side API documentation under the LiveStreamRecord.model package

The Live Stream Record API can record in two formats: FLV and MP4 (QuickTime container). The following are additional settings:

- append - Append recordings if a file exists. Default is false.
- version/overwrite - Start new recordings and version existing recordings (like myStream_0.flv) or overwrite the existing file. Default is version.
- startonkeyframe - Start recording on a key frame. Default is false.
- recorddata - Include cuepoints and metadata. Default is true.
- output - An absolute path + stream name + extension to save the recording to. Default is empty, which means that recordings are saved to the application's content folder using the stream name as the filename, and adding the appropriate file extension (.flv or .mp4)

You can set the above record options in the Flash application or they can be set and modified in the source for the application module.

> Note: Wowza Media Server® 3.5 or later is required.

> Note: The live stream that you want to record must be up-and-running.

## Install Application Module

1. Copy the file lib/wms-plugin-wms-plugin-livestreamrecordexamplemodule_3.5.jar from this package to the Wowza Media Server installation folder [install-dir]/lib/.
2. Open [install-dir]/conf/[application]/Application.xml in a text editor 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.module.ModuleLiveStreamRecord</Class>
       </Module>

## Run using Flash client

Double-click [package]/client/LiveStreamRecord.html and change the Server and Stream fields to the RTMP URL and stream name of your live stream, then click the Play button. After the live stream begins playing, click the Start Recording button to start recording the stream. When you want to stop recording the stream, click the Stop Recording button.

## Notes

- Only H.264 video and either AAC or MP3 audio can be recorded to the MP4 format.
- The Live Stream Record API can also be called server-side to control the recording process.
- There are three operations exposed through JConsole/JMX: recordStream, stopRecording, getRecorderNames. This enables starting and stopping of recordings through the module interface that's 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.
- You can use the HTTP GET method and URL querystring parameters to record live streams. For more information, see Recording live streams using URL queries.

© 2013 Wowza Media Systems, LLC. All rights reserved.