How to manage live-to-VOD nDVR stores by using the Wowza Streaming Engine REST API

Wowza nDVR allows you to record a live stream as Wowza Streaming Engine™ media server software broadcasts it to viewers with DVR playback controls (play, pause, rewind). Wowza nDVR records the stream as it's ingested so that it remains available for HTTP-based playback after the live stream ends, or you can convert the nDVR stream (called a store) to MP4 for VOD sharing and viewing. Learn how to use the Wowza Streaming Engine REST API to manage nDVR stores, convert nDVR stores to MP4 files, and manage the conversion cache.

Notes:

Contents


Get a list of nDVR stores
Get an nDVR store
Convert an nDVR store
Convert a group of nDVR stores
Refine conversion queries with optional parameters
Clear the conversion cache
More resources

Get a list nDVR stores


Get a list of all nDVR stores for the live application on a local instance of Wowza Streaming Engine:

curl  -X GET --header 'Accept:application/json; charset=utf-8' --header 'Content-Type:application/json; charset=utf-8' http://127.0.0.1:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/dvrstores

The command should return a response that looks something like this:

{
   "serverName": "_defaultServer_",
   "groupConversionStatusList": [],
   "dvrconverterstoresummary": [{
      "location": "/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/dvrstores/myStream.0",
      "name": "myStream.0"
   }] 
}

Get an nDVR store


View the details of an nDVR store, such as myStream.0:

curl -X GET --header 'Accept:application/json' --header 'Content-Type:application/json; charset=utf-8' http://127.0.0.1:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/dvrstores/myStream.0

The command should return a response that looks something like this:

{
  "serverName": "_defaultServer_",
  "dvrStoreName": "myStream.0",
  "DvrConverterStore": {
    "dvrStoreName": "myStream.0",
    "audioAvailable": true,
    "videoAvailable": true,
    "isLive": false,
    "dvrStartTime": 0,
    "dvrEndTime": 64002,
    "duration": 64002,
    "utcStart": 1489162716364,
    "utcEnd": 1489162780317,
    "outputFilename": null,
    "conversionStatus": {
      "storeName": null,
      "fileName": null,
      "state": "STOPPED",
      "statusCode": "NONE",
      "errorStrings": [],
      "startTime": 0,
      "endTime": 0,
      "duration": 0,
      "currentChunk": 0,
      "chunkCount": 0,
      "fileSize": 0,
      "fileDuration": 0
    }
  }
}

Convert an nDVR Store


Convert a single-bitrate nDVR store, such as myStream.0, to an MP4 VOD asset::

curl  -X PUT --header 'Accept:application/xml; charset=utf-8' --header 'Content-Type:application/json; charset=utf-8' http://127.0.0.1:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/dvrstores/myStream.0/actions/convert

The command should return a response that looks something like this:

{
  "success": true,
  "message":" Conversion started",
  "data": null
}

Convert a group of nDVR stores


Convert a group of ABR stream stores, such as myStream.0 and myStream.1, to MP4:

curl -X PUT --header 'Accept:application/json; charset=utf-8' --header 'Content-Type:application/json; charset=utf-8' "http://127.0.0.1:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/dvrstores/actions/convert?dvrConverterStoreList=myStream.0,myStream.1"

Refine conversion queries with optional parameters


nDVR store conversions can be customized by using any of several optional parameters:

Parameter Description
dvrConverterStartTime Starts the conversion at a specified UTC Unix timestamp in the store instead of at the first entry.
dvrConverterEndTime Stops the conversion at a specified UTC Unix timestamp in the store instead of at the end of the store.
dvrConverterDuration Stops the conversion after a specified amount of time (in milliseconds). Can't be used with dvrConverterStartTime or dvrConverterEndTime.
dvrConverterOutputFilename The filename of the converted MP4 file. If unspecified, the output filename is same as the name of the store being converted.
dvrConverterInterleaveDelay An interleave delay (in milliseconds) used to manage I/O saturation during conversion. This parameter is enabled by default with a value of 100. You can change the value to be anywhere from 0 to 2000. Higher values increase conversion time but enable other processes to access the storage system that contains the nDVR store between conversion operations, resulting in reduced I/O saturation.

Note: Supported in Wowza Streaming Engine 4.7.0.01 and later.

dvrConverterDebugConversions If true, includes debugging in the Wowza Streaming Engine Server access log file.
Note: See the Swagger reference documention for additional conversion parameters.

Specify the start and end time of a conversion:

curl -X PUT --header 'Accept:application/json; charset=utf-8' --header 'Content-Type:application/json; charset=utf-8' "http://127.0.0.1:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/dvrstores/myStream.0/actions/convert?dvrConverterStartTime=[unix-timestamp]&dvrConverterEndTime=[unix-timestamp]"
Note: Actual start and end times may vary from the specified dvrConverterStartTime and dvrConverterEndTime values if the framerate and keyframe frequency of your encoded live stream aren’t configured correctly. For a 30-fps stream, insert a keyframe at least once every 30 frames. If you insert a keyframe less frequently—every 60 frames on a 30-fps stream, for example—the start and end times may vary from your specified parameters by 1 or more seconds. Be sure to test your workflow to find the best settings.

Specify the duration of a conversion:

curl -X PUT --header 'Accept:application/json; charset=utf-8' --header 'Content-Type:application/json; charset=utf-8' "http://127.0.0.1:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/dvrstores/myStream.0/actions/convert?dvrConverterDuration=[number-of-milliseconds]"

Specify the end time of a conversion and the filename of the MP4 asset:

curl -X PUT --header 'Accept:application/json; charset=utf-8' --header 'Content-Type:application/json; charset=utf-8' "http://127.0.0.1:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/dvrstores/myStream.0/actions/convert?dvrConverterEndTime=[unix-timestamp]&dvrConverterOutputFilename=[outputfilename]"

Change the interleave delay between conversion operations:

curl -X PUT --header 'Accept:application/json; charset=utf-8' --header 'Content-Type:application/json; charset=utf-8' "http://127.0.0.1:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/dvrstores/myStream.0/actions/convert?dvrConverterInterleaveDelay=[number-of-milliseconds]"

Enable debugging of the conversion in the Wowza Streaming Engine access log file:

curl -X PUT --header 'Accept:application/json; charset=utf-8' --header 'Content-Type:application/json; charset=utf-8' "http://127.0.0.1:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/dvrstores/myStream.0/actions/convert?dvrConverterDebugConversions=true"

Clear the conversion cache


Conversion requests are cached so they can be reused. If you need to adjust your conversion parameters, clear the cache between requests.

Clear the conversion cache:

curl -X PUT --header 'Accept:application/json; charset=utf-8' --header 'Content-Type:application/json; charset=utf-8' http://127.0.0.1:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/dvrstores/actions/expire

More resources



If you're having problems or want to discuss this article, post in our forum.