wowza stream recorders
Wowza Media Server supports a wide variety of applications thanks to its extensible API. The media server API is exposed as a set of Java classes and interfaces to be implemented, so you can handle server side, application side and stream side events, metadata and media control routines. I’ve implemented a stream recorder because the live-record stream type records all streams on the configured application and also it do not have any configuration directive to control the recorded stream.
One of my current projects is to implement a time shifted stream scheduler for the Wowza Media Server. The difference between the original stream and the time shifted stream is large enough to flood the hard drive with recorded data if you leave configured the live-record stream type. Then I’ve coded a custom stream recorder. The API is very nice to do such task. I’ve created an application side module to record streams under certain conditions.
< Property > < Name >MediaFormat</ Name > < Value >1</ Value > </ Property > < Property > < Name >Append</ Name > < Value >false</ Value > </ Property > < Property > < Name >VersionFile</ Name > < Value >true</ Value > </ Property > < Property > < Name >StartOnKeyFrame</ Name > < Value >true</ Value > </ Property > < Property > < Name >RecordData</ Name > < Value >true</ Value > </ Property > < Property > < Name >RecordStreams</ Name > < Value >TV_STRM_CH_8,TV_STRM_CH_5,TV_STRM_CH_2</ Value > </ Property > |
The MediaFormat property allows you to record flv media when it’s set to 1 and mp4 media files when it’s set to 2. Otherwise, it records flv media files by default. If the Append property is set to true it must be used with VersionFile, StartOnKeyFrame and RecordData enabled. The Append property allows you to create one unique recorded media files for each stream. If you set Append to false, the module creates recorded media files with a timestamp suffix with the format yyyyMMddHHmm. And since the time shift module requires stream metadata information, I’m using Append as false and setting the full stream information with the other metadata information properties enabled too.
The RecordStreams property allows you to record only those configured streams, instead of recording all streams — by using the live-record stream type — and allowing you configure which information will be distributed along the media files.
The main trick to record streams is to use not early events. First I’ve tried using onAppStart() event method and then onStreamCreate() event method, but they didn’t work. Now I’m using the IMediaStreamActionNotify2 interface with the proper events to handle the stream creation and the stream metadata, such as stream name, stream media type and related stuff. Probably the disadvantage of using custom media recorders is the fact that the API only provides LiveStreamRecorderMP4 and LiveStreamRecorderFLV recording classes and if you want an open media format, such as OGG enabled streams, this will not work.
The stream recorder module uses the ModuleBase abstract class, the time shifter publisher implements the IServerNotify interface. You have a wide variety of classes and interfaces that can be used on different tasks, including some weird such as LDAP enabled authentication mechanisms. You just need to think and to architect your server extension a little.
Source/Credit: coder.cl
Recent Comments