{
  "name": "FFmpegAPI GIF to MP4",
  "nodes": [
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.ffmpeg-api.com/file",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Basic {{ $vars.FFMPEG_API_KEY }}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"file_name\": \"{{ $item(\"0\").$node[\"Attach file\"].json[\"file\"][\"filename\"] }}\"\n}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "json"
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [240, 32],
      "id": "15422c19-dcf3-4e88-8e33-004d1cbc5ad0",
      "name": "Get Upload URL"
    },
    {
      "parameters": {
        "method": "={{ $('Get Upload URL').item.json.upload.method }}",
        "url": "={{ $('Get Upload URL').item.json.upload.url }}",
        "sendBody": true,
        "contentType": "binaryData",
        "inputDataFieldName": "file",
        "options": {
          "response": {
            "response": {
              "fullResponse": true
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [672, -32],
      "id": "496ff022-cd76-4dc7-9825-280e6db11e0f",
      "name": "Upload File"
    },
    {
      "parameters": {
        "mode": "combine",
        "combineBy": "combineAll",
        "options": {}
      },
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [448, -32],
      "id": "300a02ee-e6b9-4a6f-8291-446bd81e1a1a",
      "name": "Merge"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.ffmpeg-api.com/ffmpeg/process",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Basic {{ $vars.FFMPEG_API_KEY }}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "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}",
        "options": {
          "response": {
            "response": {
              "fullResponse": true,
              "responseFormat": "json"
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [896, -32],
      "id": "a34bb626-08a9-4066-9859-80bf7fa0c520",
      "name": "Process File"
    },
    {
      "parameters": {
        "formTitle": "Convert GIF",
        "formDescription": "Upload a GIF to convert into MP4 using FFmpegAPI",
        "formFields": {
          "values": [
            {
              "fieldLabel": "file",
              "fieldType": "file",
              "multipleFiles": false,
              "acceptFileTypes": ".gif",
              "requiredField": true
            }
          ]
        },
        "responseMode": "lastNode",
        "options": {
          "buttonLabel": "Convert",
          "respondWithOptions": {
            "values": {
              "formSubmittedText": "=Done"
            }
          }
        }
      },
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.3,
      "position": [0, -32],
      "id": "75e67302-8417-4072-b3f8-be8a8f386996",
      "name": "Attach file",
      "webhookId": "13584f40-2b5e-4b91-bcd4-79fa9fa36853",
      "alwaysOutputData": false,
      "executeOnce": true
    },
    {
      "parameters": {
        "operation": "completion",
        "completionTitle": "Done!",
        "completionMessage": "=Please download the file:\n[Download]({{ $json.body.result[0].download_url }}",
        "options": {}
      },
      "type": "n8n-nodes-base.form",
      "typeVersion": 2.3,
      "position": [1120, -32],
      "id": "c9288a0b-d0f5-4c74-a37b-539c7788e896",
      "name": "Download URL",
      "webhookId": "1e99e5c9-caab-4810-9fcd-ee7fbaf7e222"
    },
    {
      "parameters": {
        "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.",
        "height": 240,
        "width": 416,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [448, -448],
      "id": "0108216e-7d4b-441d-8a4b-90b4c874d926",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "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.",
        "height": 256,
        "width": 416,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [992, -464],
      "id": "01dc723d-8075-4bc3-a7b4-2564c332fad8",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "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.",
        "height": 240,
        "width": 416,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [-128, -448],
      "id": "bce121a2-0b71-41e4-b270-9bcf0f5f8c26",
      "name": "Sticky Note2"
    }
  ],
  "pinData": {},
  "connections": {
    "Get Upload URL": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Upload File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload File": {
      "main": [
        [
          {
            "node": "Process File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process File": {
      "main": [
        [
          {
            "node": "Download URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Attach file": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Upload URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "9f1d3b17-4b13-48f5-9207-4027ba8a5af6",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "3056841ed8537aa82b4f80b77f363341135b84998ef9d114230da41a68958569"
  },
  "id": "UjlWmUcLcqmqB9a7",
  "tags": []
}
