Manage recorders by using the Wowza Streaming Engine
Posted By : Vipin Pokhriyal | 06-Dec-2017
Hi, I want to describe manage recorded video using Wowza streaming engine. You can use the Wowza Streaming Engine™ media server software to create and manage stream recorders in a Wowza Streaming Engine instance.
Contents
1).Get a list of recorders
2).Create a recorder
3).Split an active recording
4).Stop a recording
Get a list of recorders
View list of all stream recorders for an application (test, in this example) on a local Wowza Streaming Engine instance:
curl -X GET --header 'Accept:application/json; charset=utf-8' --header 'Content-Type:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/test/instances/_definst_/streamrecorders
If the stream and recording haven't started, command return a response like this in xml format:
<?xml version="1.0" encoding="UTF-8" ?>
<StreamRecorders serverName="_defaultServer_">
<InstanceName>_definst_</InstanceName>
</StreamRecorders>
If the stream and recording started then command returns a response like this in XML format:
<?xml version="1.0" encoding="UTF-8" ?>
<StreamRecorders serverName="_defaultServer_">
<InstanceName>_definst_</InstanceName>
<streamRecorders>
<RecorderName>Test.stream</RecorderName>
<InstanceName>_definst_</InstanceName>
<RecorderState>Recording in Progress</RecorderState>
<DefaultRecorder>false</DefaultRecorder>
<SegmentationType>None</SegmentationType>
<OutputPath>/home/vipin/Desktop/recordedVideo</OutputPath>
<BaseFile>Test.stream.mp4</BaseFile>
<FileFormat>MP4</FileFormat>
<FileVersionDelegate>com.wowza.wms.livestreamrecord.manager.StreamRecorderFileVersionDelegate</FileVersionDelegate>
<FileTemplate>Test1512558459422</FileTemplate>
<SegmentDuration>41730</SegmentDuration>
<SegmentSize>10485760</SegmentSize>
<SegmentSchedule>0 * * * * *</SegmentSchedule>
<RecordData>true</RecordData>
<StartOnKeyFrame>true</StartOnKeyFrame>
<SplitOnTcDiscontinuity>false</SplitOnTcDiscontinuity>
<BackBufferTime>0</BackBufferTime>
<Option>Version existing file</Option>
<MoveFirstVideoFrameToZero>true</MoveFirstVideoFrameToZero>
<CurrentSize>795490</CurrentSize>
<CurrentDuration>41730</CurrentDuration>
<CurrentFile>/home/vipin/Desktop/recordedVideo/Test1512558459422.mp4</CurrentFile>
<RecordingStartTime>2017-12-06-16.37.42.031-+05:30</RecordingStartTime>
</streamRecorders>
</StreamRecorders>
Create a recorder
When you create a recorder, it starts instantly if the stream is working. Otherwise, it starts after when you start the stream
Create a stream recorder named Test using the default settings (Note :-the stream recorder name matching with incoming stream name included the request URL and in the body of the request, and they must match):
curl -X POST --header 'Accept:application/json; charset=utf-8' --header 'Content-Type:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/test/instances/_definst_/streamrecorders/Test
{
"instanceName": "",
"fileVersionDelegateName": "",
"serverName": "",
"recorderName": "Test",
"currentSize": 0,
"segmentSchedule": "",
"startOnKeyFrame": false,
"outputPath": "",
"currentFile": "",
"saveFieldList": [
""
],
"recordData": false,
"applicationName": "",
"moveFirstVideoFrameToZero": false,
"recorderErrorString": "",
"segmentSize": 0,
"defaultRecorder": false,
"splitOnTcDiscontinuity": false,
"version": "",
"baseFile": "",
"segmentDuration": 0,
"recordingStartTime": "",
"fileTemplate": "",
"backBufferTime": 0,
"segmentationType": "",
"currentDuration": 0,
"fileFormat": "",
"recorderState": "",
"option": ""
}
The command returns a response like this in XML format:
<?xml version="1.0" encoding="UTF-8" ?>
<wmsResponse>
<success>true</success>
<message>Recorder Created</message>
</wmsResponse>
Split an active recording
When you segment, an active recording, the recorder keeps running but the current recording ends and a new recording start from the time of the split. Both recordings are stored in the specified output_path (by default,/Library/WowzaStreamingEngine/content) and are named according to the filenaming template (by default, [BaseFilename]_[RecordingStartTime]_[SegmentNumber].mp4).
Split a recording:
curl -X PUT --header 'Accept:application/json; charset=utf-8' --header 'Content-Type:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/test/instances/_definst_/streamrecorders/Test.stream/actions/splitRecording
The command returns a response like this in XML format:
<?xml version="1.0" encoding="UTF-8" ?>
<wmsResponse>
<success>true</success>
<message>Recording (Test.stream) split</message>
</wmsResponse>
Stop a recording
Stop a recording:
curl -X PUT --header 'Accept:application/json; charset=utf-8' --header 'Content-Type:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/test/instances/_definst_/streamrecorders/Test.stream/actions/stopRecording
The command returns a response like this in XML format:
<?xml version="1.0" encoding="UTF-8" ?>
<wmsResponse>
<success>true</success>
<message>Recording (Test.stream) stopped</message>
</wmsResponse>
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Vipin Pokhriyal
Vipin is Qualified in Master in computer Applicatins. He is an Active team player & having skills as Java Developer.