Create Job

A job consists of input file name or URL, output file name and optionally preset XML file for configurations. When the state is set to “encoding”, the job is immediately started after creation. Configurations can be adjusted by prefs on top of default settings or settings from preset file.

Request (POST)

URL: http://server/mc/transcoder

Payload

{
        "preset": "settings.xml",
        "input": "input.avi",
        "output": "output.mp4",
        "begin": 0,
        "end": 0,
        "state": "encoding",
        "prefs": {
            "overall": {
                "video": {
                    "enabled": true,
                    "bitrate": 500,
                },
                "audio": {
                    "enabled": true,
                }
            }
}

Response (success)

{"result":"done"}

Response (erroneous)

{"result":"failed","error":"..."}


Altering Configurations

Configurations can be altered by key/value pairs. The configuration pairs are represented in JSON format.

Request (POST)

URL: http://server/mc/prefs

Payload

{
"overall":{
    "video":{
        "format":"H.265",
        "bitrate":1000,
        "mode":"Average Bitrate",
        "autoEncoder":true,
         ...
    },
    "audio":{
        "format":"LC-AAC",
        "bitrate":128,
        "mode":"ABR",
        ...
    },
    ...
},
"videoenc":{
    "x264":{
        "profile":"Main",
        "bframes":2,
    },
    ...
},
...
}

Response

{"success":<number of successfully applied settings>,"failure":<number of errors>}

Control a Task

Request (POST)

URL: http://server/mc/transcoder

Payload (stop a job)

{"state":"stopping"}

Payload (pause a job)

{"state":"paused"}

Payload (start/resume a job)

{"state":"encoding"}

Response (success)

{"result":"done"}

Response (erroneous)

{"result":"failed","error":"Invalid server key"}
{"result":"failed","error":"Invalid command"}

Monitor a Task

Request (GET)

URL: http://server/mc/stats

Response

{
"state":"encoding",
"percent":38,
"remainTime":21,
"elapsedTime":21,
"throughput":47,
"speed":"5.26",
"audioBitrate":66,
"audioData":19,
"duration":282148,
"estimatedSize":19820,
"fps":"193.59",
"frames":2867,
"pos":114,
"videoBitrate":496,
"videoData":346
}

state indicates the state of current task which can be one of following.

  • ready
  • encoding
  • paused
  • stopping
  • done