{
  "id": "UjlWmUcLcqmqB9a7",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "FFmpegAPI GIF to MP4",
  "tags": [],
  "nodes": [
    {
      "id": "15422c19-dcf3-4e88-8e33-004d1cbc5ad0",
      "name": "Get Upload URL",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        240,
        32
      ],
      "parameters": {
        "url": "https://api.ffmpeg-api.com/file",
        "method": "POST",
        "options": {
          "response": {
            "response": {
              "responseFormat": "json"
            }
          }
        },
        "jsonBody": "={\n  \"file_name\": \"{{ $item(\"0\").$node[\"Attach file\"].json[\"file\"][\"filename\"] }}\"\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Basic {{ $vars.FFMPEG_API_KEY }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "496ff022-cd76-4dc7-9825-280e6db11e0f",
      "name": "Upload File",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        672,
        -32
      ],
      "parameters": {
        "url": "={{ $('Get Upload URL').item.json.upload.url }}",
        "method": "={{ $('Get Upload URL').item.json.upload.method }}",
        "options": {
          "response": {
            "response": {
              "fullResponse": true
            }
          }
        },
        "sendBody": true,
        "contentType": "binaryData",
        "inputDataFieldName": "file"
      },
      "typeVersion": 4.2
    },
    {
      "id": "300a02ee-e6b9-4a6f-8291-446bd81e1a1a",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        448,
        -32
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineAll"
      },
      "typeVersion": 3.2
    },
    {
      "id": "a34bb626-08a9-4066-9859-80bf7fa0c520",
      "name": "Process File",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        896,
        -32
      ],
      "parameters": {
        "url": "https://api.ffmpeg-api.com/ffmpeg/process",
        "method": "POST",
        "options": {
          "response": {
            "response": {
              "fullResponse": true,
              "responseFormat": "json"
            }
          }
        },
        "jsonBody": "={\n  \"task\": {\n    \"inputs\": [{ \"file_path\": \"{{ $('Get Upload URL').item.json.file.file_path }}\" }],\n    \"outputs\": [\n      { \"file\": \"output.mp4\" }\n    ]\n  }\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Basic {{ $vars.FFMPEG_API_KEY }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "75e67302-8417-4072-b3f8-be8a8f386996",
      "name": "Attach file",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        0,
        -32
      ],
      "parameters": {
        "options": {
          "buttonLabel": "Convert",
          "respondWithOptions": {
            "values": {
              "formSubmittedText": "=Done"
            }
          }
        },
        "formTitle": "Convert GIF",
        "formFields": {
          "values": [
            {
              "fieldType": "file",
              "fieldLabel": "file",
              "multipleFiles": false,
              "requiredField": true,
              "acceptFileTypes": ".gif"
            }
          ]
        },
        "responseMode": "lastNode",
        "formDescription": "Upload a GIF to convert into MP4 using FFmpegAPI"
      },
      "executeOnce": true,
      "typeVersion": 2.3,
      "alwaysOutputData": false
    },
    {
      "id": "c9288a0b-d0f5-4c74-a37b-539c7788e896",
      "name": "Download URL",
      "type": "n8n-nodes-base.form",
      "position": [
        1120,
        -32
      ],
      "parameters": {
        "options": {},
        "operation": "completion",
        "completionTitle": "Done!",
        "completionMessage": "=Please download the file:\n[Download]({{ $json.body.result[0].download_url }}"
      },
      "typeVersion": 2.3
    },
    {
      "id": "0108216e-7d4b-441d-8a4b-90b4c874d926",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        448,
        -448
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 240,
        "content": "## Step 1\nCreate an account on [FFmpegAPI](https://ffmpeg-api.com/) and copy your API Key from the dashboard.\n\nGo to the **Variables** section from the left sidebar of this page. and use **FFMPEG_API_KEY** name to store that key you copied."
      },
      "typeVersion": 1
    },
    {
      "id": "01dc723d-8075-4bc3-a7b4-2564c332fad8",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        992,
        -464
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 256,
        "content": "## Step 2\nClick the 'Execute workflow' button at the bottom. A pop-up window will open where you can select a GIF file from your PC. \n\nOnce you click convert, the workflow will:\na. get an upload file path\nb. upload that gif\nc. convert that to mp4\n\nYou'll get the final download URL when it's done."
      },
      "typeVersion": 1
    },
    {
      "id": "bce121a2-0b71-41e4-b270-9bcf0f5f8c26",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        -448
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 240,
        "content": "## Intro\n\nThis is an example workflow that demos the [FFmpegAPI](https://ffmpeg-api.com/) for file conversion. It only shows GIF to MP4 conversion, but you're free to modify it for your use case."
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "9f1d3b17-4b13-48f5-9207-4027ba8a5af6",
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Upload File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Attach file": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Upload URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload File": {
      "main": [
        [
          {
            "node": "Process File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process File": {
      "main": [
        [
          {
            "node": "Download URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Upload URL": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    }
  }
}