Results 1 to 4 of 4

Thread: Try to use REST API to start and stop recording from a live stream

  1. #1
    Join Date
    Jul 2015
    Posts
    1

    Default Try to use REST API to start and stop recording from a live stream

    Hi,

    I'm trying to build a web application that could start and stop recording from a Wowza stream through the REST API that wowza provides. First, I can retrieve the list of instances that are currently recording

    % curl http://192.168.1.126:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/streamrecorders
    <?xml version="1.0" encoding="UTF-8" ?>
    <StreamRecorders restURI="http://192.168.1.126:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/streamrecorders">
      <InstanceName></InstanceName>
      <streamRecorders restURI="/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances//streamrecorders/m.stream">
        <RecorderName>m.stream</RecorderName>
        <InstanceName></InstanceName>
        <RecorderState>Recording in Progress</RecorderState>
        <DefaultRecorder>false</DefaultRecorder>
        <SegmentationType>None</SegmentationType>
        <OutputPath>C:\Program Files (x86)\Wowza Media Systems\Wowza Streaming Engine 4.1.2\content</OutputPath>
        <BaseFile>2m.stream.mp4</BaseFile>
        <FileFormat>MP4</FileFormat>
        <FileVersionDelegate>com.wowza.wms.livestreamrecord.manager.StreamRecorderFileVersionDelegate</FileVersionDelegate>
        <FileTemplate>${SourceStreamName}_${RecordingStartTime}_${SegmentNumber}</FileTemplate>
        <SegmentDuration>832632</SegmentDuration>
        <SegmentSize>10485760</SegmentSize>
        <SegmentSchedule>0 1 * * * *</SegmentSchedule>
        <RecordData>false</RecordData>
        <StartOnKeyFrame>true</StartOnKeyFrame>
        <Option>Overwrite existing file</Option>
        <MoveFirstVideoFrameToZero>true</MoveFirstVideoFrameToZero>
        <CurrentSize>291399785</CurrentSize>
        <CurrentDuration>832632</CurrentDuration>
        <CurrentFile>C:\Program Files (x86)\Wowza Media Systems\Wowza Streaming Engine 4.1.2\content\2m.stream.mp4</CurrentFile>
        <RecordingStartTime>2015-07-03-10.00.50.491-EDT</RecordingStartTime>
      </streamRecorders>
    </StreamRecorders>%
    Now, I am trying to start and stop new recording with the API. Starting a recording does not work:

    curl -X POST http://admin:admin@192.168.1.126:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/streamrecorders
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
      <error>
        <wowzaServer>4.2.0</wowzaServer>
        <code>500</code>
        <message>The server encountered an unexpected condition which prevented it from fulfilling the request</message>
    </error>
    Neither does Stop recording:

    curl -X PUT http://admin:admin@192.168.1.126:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/streamrecorders/m.stream/actions/stopRecording
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
      <error>
        <wowzaServer>4.2.0</wowzaServer>
        <code>500</code>
        <message>The server encountered an unexpected condition which prevented it from fulfilling the request</message>
    </error>

    This seems to happen because of a Null exception:

    class com.wowza.wms.rest.vhosts.applications.instances.streamrecorders.StreamRecorderConfig.post : java.lang.NullPointerException
      |at com.wowza.wms.rest.ConfigBase.getObject(Unknown Source)
      |at com.wowza.wms.rest.ConfigBase.post(Unknown Source)
      |at com.wowza.wms.rest.ConfigBase.post(Unknown Source)
      |at org.restlet.resource.ServerResource.doHandle(ServerResource.java:454)
      |at org.restlet.resource.ServerResource.doNegotiatedHandle(ServerResource.java:683)|
    Even though the path says otherwise, the version of Wowza I'm trying this on is Engine Version 4.2.0 (build 15089)
    Last edited by pothibo; 07-03-2015 at 07:49 AM. Reason: Specifying Wowza's version

  2. #2
    Join Date
    Sep 2011
    Posts
    1,931

    Default

    Hi,
    This will be handled in the ticket that you created (133384).

    Regards,
    Jason

  3. #3

    Default

    I just had a similar issue , http://www.wowza.com/forums/showthre...ng-doesnt-work , checking if you found any solutions so far .

  4. #4

    Default

    Hi,

    You could try something like the following to instigate a recording of an existing live stream,

    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/live/instances/_definst_/streamrecorders/myStream -d '
    {
     "restURI":"http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/streamrecorders/myStream",
     "recorderName":"myStream",
    "instanceName":"_definst_",
    "recorderState":"Waiting for stream",
    "defaultRecorder":true,
    "segmentationType":"None",
    "outputPath":"/usr/local/WowzaStreamingEngine/content",
    "baseFile":"myrecord2.mp4",
    "fileFormat":"MP4",
    "fileVersionDelegateName":"com.wowza.wms.livestreamrecord.manager.StreamRecorderFileVersionDelegate",
    "fileTemplate":"${BaseFileName}_${RecordingStartTime}_${SegmentNumber}",
    "segmentDuration":900000,
    "segmentSize":10485760,
    "segmentSchedule":"0 * * * * *",
    "recordData":true,
    "startOnKeyFrame":true,
    "option":"Version existing file",
    "moveFirstVideoFrameToZero":true,
    "currentSize":0,
    "currentDuration":0,
    "recordingStartTime":""
    }'
    (replacing app, stream name, path etc accordingly).

    More details can be found here


    Paul

Similar Threads

  1. Start/stop MediaCasterStream via rest api?
    By maaark in forum General Forum
    Replies: 1
    Last Post: 05-26-2015, 06:02 AM
  2. API rest start/stop/restart application live tream
    By jormarcha in forum Wowza Streaming Engine REST API
    Replies: 1
    Last Post: 03-13-2015, 01:20 PM
  3. How to determine if a recording has completed processing with the rest api
    By sona1111 in forum Wowza Streaming Engine REST API
    Replies: 4
    Last Post: 01-07-2015, 03:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •