Create a command
Creates a new command.
curl -X POST "https://api.fetchmedia.io/v1/commands" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-d '{
"ffmpeg_command": "ffmpeg -i {{in_1}} -c:v copy -c:a copy {{out_1}}",
"ffmpeg_commands": [
"ffmpeg -y -i {{in_1}} -c:v libx264 -b:v 2M -maxrate 3M -bufsize 1M -pass 1 -an -f mp4 /dev/null",
"ffmpeg -i {{in_1}} -c:v libx264 -b:v 2M -maxrate 3M -bufsize 1M -pass 2 {{out_1}}"
],
"input_files": {
"in_1": "https://www3.cde.ca.gov/download/rod/big_buck_bunny.mp4"
},
"output_files": {
"out_1": "output.mp4"
},
"webhook": "https://example.com/webhook"
}'
import requests
import json
url = "https://api.fetchmedia.io/v1/commands"
headers = {
"Content-Type": "application/json",
"X-API-KEY": "YOUR_API_KEY"
}
data = {
"ffmpeg_command": "ffmpeg -i {{in_1}} -c:v copy -c:a copy {{out_1}}",
"ffmpeg_commands": [
"ffmpeg -y -i {{in_1}} -c:v libx264 -b:v 2M -maxrate 3M -bufsize 1M -pass 1 -an -f mp4 /dev/null",
"ffmpeg -i {{in_1}} -c:v libx264 -b:v 2M -maxrate 3M -bufsize 1M -pass 2 {{out_1}}"
],
"input_files": {
"in_1": "https://www3.cde.ca.gov/download/rod/big_buck_bunny.mp4"
},
"output_files": {
"out_1": "output.mp4"
},
"webhook": "https://example.com/webhook"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.fetchmedia.io/v1/commands", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-KEY": "YOUR_API_KEY"
},
body: JSON.stringify({
"ffmpeg_command": "ffmpeg -i {{in_1}} -c:v copy -c:a copy {{out_1}}",
"ffmpeg_commands": [
"ffmpeg -y -i {{in_1}} -c:v libx264 -b:v 2M -maxrate 3M -bufsize 1M -pass 1 -an -f mp4 /dev/null",
"ffmpeg -i {{in_1}} -c:v libx264 -b:v 2M -maxrate 3M -bufsize 1M -pass 2 {{out_1}}"
],
"input_files": {
"in_1": "https://www3.cde.ca.gov/download/rod/big_buck_bunny.mp4"
},
"output_files": {
"out_1": "output.mp4"
},
"webhook": "https://example.com/webhook"
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"ffmpeg_command": "ffmpeg -i {{in_1}} -c:v copy -c:a copy {{out_1}}",
"ffmpeg_commands": [
"ffmpeg -y -i {{in_1}} -c:v libx264 -b:v 2M -maxrate 3M -bufsize 1M -pass 1 -an -f mp4 /dev/null",
"ffmpeg -i {{in_1}} -c:v libx264 -b:v 2M -maxrate 3M -bufsize 1M -pass 2 {{out_1}}"
],
"input_files": {
"in_1": "https://www3.cde.ca.gov/download/rod/big_buck_bunny.mp4"
},
"output_files": {
"out_1": "output.mp4"
},
"webhook": "https://example.com/webhook"
}`)
req, err := http.NewRequest("POST", "https://api.fetchmedia.io/v1/commands", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-API-KEY", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.fetchmedia.io/v1/commands')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['X-API-KEY'] = 'YOUR_API_KEY'
request.body = '{
"ffmpeg_command": "ffmpeg -i {{in_1}} -c:v copy -c:a copy {{out_1}}",
"ffmpeg_commands": [
"ffmpeg -y -i {{in_1}} -c:v libx264 -b:v 2M -maxrate 3M -bufsize 1M -pass 1 -an -f mp4 /dev/null",
"ffmpeg -i {{in_1}} -c:v libx264 -b:v 2M -maxrate 3M -bufsize 1M -pass 2 {{out_1}}"
],
"input_files": {
"in_1": "https://www3.cde.ca.gov/download/rod/big_buck_bunny.mp4"
},
"output_files": {
"out_1": "output.mp4"
},
"webhook": "https://example.com/webhook"
}'
response = http.request(request)
puts response.body
{
"command_id": "123e4567-e89b-12d3-a456-426614174000"
}
{
"error": "Unprocessable Entity",
"message": "The request was well-formed but contains semantic errors",
"code": 422,
"details": [
{
"field": "password",
"message": "Password must be at least 8 characters long"
}
]
}
/commands
API key (sent in header)
The media type of the request body
The ffmpeg command to execute. mutually exclusive with ffmpeg_commands.
Multiple ffmpeg commands to execute. mutually exclusive with ffmpeg_command.
The input files to use for the command.
The output files to use for the command.
The webhook to send the command payload once the job is completed.
Request Preview
Response
Response will appear here after sending the request
Authentication
API Key for authentication. Provide your API key in the header.
Body
The ffmpeg command to execute. mutually exclusive with ffmpeg_commands.
Multiple ffmpeg commands to execute. mutually exclusive with ffmpeg_command.
The input files to use for the command.
The output files to use for the command.
The webhook to send the command payload once the job is completed.
Responses
Last updated today