Execute Commands
Create a task to execute a command. Currently, ffmpeg
, imagemagick
and
graphicsmagick
commands re supported.
You can access the files from the input task in the /input/{taskName}/
(For example: /input/import-1/
) directory.
All files that are created in the /output/
directory are available for following tasks (e.g. export tasks).
Arguments | |
---|---|
input string or array, required | The ID of the input tasks for files used in the command. Multiple task IDs can be provided as an array. |
engine string, required |
Select the engine for the conversion.
|
engine_version string, optional |
Use a specific engine version for the conversion.
|
capture_output boolean, optional | Capture the console output of the command and return it in the results object. |
timeout integer, optional | Timeout in seconds after the task will be cancelled. By default, tasks time out after 5 hours. |
{{ option.name }} required, {{ option.type }} |
Defaults to {{ option.default }} .
Possible values: , .
|
Returns
The created task. You can find details about the task model response in the documentation about the show tasks endpoint.
Endpoint
POST https://api.cloudconvert.com/v2/command
Example Request
$ curl -X POST "https://api.cloudconvert.com/v2/command" \ -H "Authorization: Bearer API_KEY" \ -H "Content-type: application/json" \ -d '
{ "input": [ "73df1e16-fd8b-47a1-a156-f197babde91a" ], "engine": "ffmpeg", "command": "ffmpeg", "arguments": "-i /input/import-1/file.mp4 -vcodec libx264 -acodec copy /output/output.mp4" }
'
Example Response
{
"data": {
"id": "c85f3ca9-164c-4e89-8ae2-c08192a7cb08",
"operation": "command",
"status": "processing",
"message": null,
"created_at": "2018-09-19T14:42:58+00:00",
"started_at": "2018-09-19T14:42:58+00:00",
"ended_at": null,
"depends_on_tasks": {},
"engine": "ffmpeg",
"engine_version": "3.3.3",
"payload": {
"input": [
"73df1e16-fd8b-47a1-a156-f197babde91a"
],
"command": "ffmpeg",
"arguments": "-i /input/file.mp4 -vcodec libx264 -acodec copy /output/output.mp4"
},
"result": null
}
}