Get your free API key

Register to Rendi, activate your account and get your API key

Run a command to generate a gif from the first minute of a video

We will want to run the following FFmpeg command:
ffmpeg -i https://storage.rendi.dev/sample/sample.avi -vf "select='lte(t,60)*gt(trunc(t/10),trunc(prev_t/10))',setpts='PTS*0.025',scale=trunc(oh*a/2)*2:320:force_original_aspect_ratio=decrease,pad=trunc(oh*a/2)*2:320:-1:-1" -an -vsync vfr output1.gif

Use the same command in Rendi

curl --location 'https://api.rendi.dev/v1/run-ffmpeg-command' \
--header 'X-API-KEY: <api-key>' \
--header 'Content-Type: application/json; charset=utf-8' \
--data '{
    "input_files": {
        "in_1": "https://storage.rendi.dev/sample/sample.avi"
    },
    "output_files": {
        "out_1": "output1.gif"
    },
    "ffmpeg_command": "-i {{in_1}} -vf \"select='\''lte(t,60)*gt(trunc(t/10),trunc(prev_t/10))'\'',setpts='\''PTS*0.025'\'',scale=trunc(oh*a/2)*2:320:force_original_aspect_ratio=decrease,pad=trunc(oh*a/2)*2:320:-1:-1\" -an -vsync vfr {{out_1}}"
}'
Running this command will return the command_id:
{
  "command_id": "089dd36c-723c-4a0a-b68a-8e8cbcc1afd2""
}
The command now runs in Rendi and you can check its status:

Poll the command_id until it reaches status SUCCESS

curl --request GET \
  --url https://api.rendi.dev/v1/commands/{command_id} \
  --header 'X-API-KEY: <api-key>'
While processing the command will pass from status QUEUED to PROCESSING to SUCCESS
{
    "command_id": "089dd36c-723c-4a0a-b68a-8e8cbcc1afd2",
    "status": "SUCCESS",
    "command_type": "FFMPEG_COMMAND",
    "total_processing_seconds": 8.333879,
    "ffmpeg_command_run_seconds": 5.734427452087402,
    "vcpu_count": 8,
    "output_files": {
        "out_1": {
            "file_id": "da09eaa7-904f-45e2-a727-74760b2696f6",
            "storage_url": "https://storage.rendi.dev/files/bb0e5c57-2721-4cc5-9453-ceeb2fa60e33/089dd36c-723c-4a0a-b68a-8e8cbcc1afd2/output1.gif",
            "status": "STORED",
            "rendi_store_type": "OUTPUT",
            "is_deleted": false,
            "size_mbytes": 0.3879680633544922,
            "file_type": "image",
            "file_format": "gif",
            "width": 568,
            "height": 320
        }
    },
    "original_request": {
        "input_files": {
            "in_1": "https://storage.rendi.dev/sample/sample.avi"
        },
        "output_files": {
            "out_1": "output1.gif"
        },
        "ffmpeg_command": "-i {{in_1}} -vf \"select='lte(t,60)*gt(trunc(t/10),trunc(prev_t/10))',setpts='PTS*0.025',scale=trunc(oh*a/2)*2:320:force_original_aspect_ratio=decrease,pad=trunc(oh*a/2)*2:320:-1:-1\" -an -vsync vfr {{out_1}}"
    }
}
When the status reaches SUCCESS Rendi will return the stored output file with it.

Get your output files

The result is hosted on Rendi’s storage, with a CDN - you can download it and you can serve it as is to your users