{
  "name": "🎥 Gemini AI Video Analysis",
  "nodes": [
    {
      "id": "f5c9faf8-441a-49ef-a0de-0daa08c3bbfa",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        400,
        160
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "c0336074-a30f-4fc0-aa57-7142cea1a3da",
      "name": "Download video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -40,
        160
      ],
      "parameters": {
        "url": "={{ $json.video_url }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "8b04c774-7a02-43ff-bac9-d19a427d514e",
      "name": "Upload video Gemini",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        180,
        160
      ],
      "parameters": {
        "url": "=https://generativelanguage.googleapis.com/upload/v1beta/files?key=REPLACE_WITH_CREDENTIAL $vars.GeminiKey }}",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "binaryData",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Goog-Upload-Command",
              "value": "start, upload, finalize"
            },
            {
              "name": "X-Goog-Upload-Header-Content-Length",
              "value": "={{ $binary.data.fileSize }}"
            },
            {
              "name": "X-Goog-Upload-Header-Content-Type",
              "value": "=video/{{ $binary.data.fileExtension }}"
            },
            {
              "name": "Content-Type",
              "value": "video/mp4"
            }
          ]
        },
        "inputDataFieldName": "=data"
      },
      "typeVersion": 4.2
    },
    {
      "id": "eacf4317-18bc-441a-a415-488b65bb9545",
      "name": "Analyze video Gemini",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        620,
        160
      ],
      "parameters": {
        "url": "=https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-exp:generateContent?key=REPLACE_WITH_CREDENTIAL $vars.GeminiKey }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n    \"contents\": [\n        {\n            \"role\": \"user\",\n            \"parts\": [\n                {\n                    \"fileData\": {\n                        \"fileUri\": \"{{ $json.file.uri }}\",\n                        \"mimeType\": \"{{ $json.file.mimeType }}\"\n                    }\n                },\n                {\n                    \"text\": \"Describe in detail what is visually happening in the video, including key elements, actions, colors, and branding. Note the style, tone, and any notable creative techniques being used.\"\n                }\n            ]\n        }\n    ],\n    \"generationConfig\": {\n        \"temperature\": 1.4,\n        \"topK\": 40,\n        \"topP\": 0.95,\n        \"maxOutputTokens\": 8192,\n        \"responseModalities\": [\"Text\"]\n    }\n}\n",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "ff204f3f-947e-4b6a-a9a3-822d6d57064b",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -480,
        160
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d842a85d-121d-46ed-9df7-44d2c7849c03",
      "name": "Set Input",
      "type": "n8n-nodes-base.set",
      "position": [
        -260,
        160
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "6e1728e0-4749-47b9-92ae-4d1c0b7008c8",
              "name": "video_url",
              "type": "string",
              "value": "https://video-gru2-1.xx.fbcdn.net/v/t42.1790-2/469342405_958689216107669_4819692307529683812_n.mp4?_nc_cat=109&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=DMM4-vR_LwoQ7kNvwGFIAOW&_nc_oc=AdkqAUzPHupjN-yAD8AGHbbnsMLQptad7NFTL-fuRa3Kq12boE6Ar_elagnzmgR87uU&_nc_zt=28&_nc_ht=video-gru2-1.xx&_nc_gid=ikICtUIUUCoHz775L2uRBw&oh=00_AfHlScWo8zXllEsqzl3wabxNva8z_qiFuA2g-hWzvnlVdg&oe=681596F3"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "efb6ed9b-5f65-4bf3-8ea9-00430abdb247",
      "name": "Get Result",
      "type": "n8n-nodes-base.set",
      "position": [
        840,
        160
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "1ea390b9-3371-4a3a-8741-bd6ec74dc64b",
              "name": "videoDescription",
              "type": "string",
              "value": "={{ $json.candidates[0].content.parts[0].text }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "fc917016-b2f3-4d69-8924-0aa16b4b43bc",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -920,
        -380
      ],
      "parameters": {
        "color": 7,
        "width": 560,
        "height": 520,
        "content": "## Video Analysis with Gemini AI\n\nThis workflow demonstrates how to analyze video content using Google's Gemini 2.0 Flash API:\n1. Download a video from a URL\n2. Upload it to Gemini's servers\n3. Process the video with AI to generate a detailed description\n4. Extract the analysis results\n\nUse cases: Content moderation, video cataloging, accessibility features, etc.\n\nOUTPUT: The workflow produces a detailed text description of the video content in the \"MediaDescription\" variable.\nYou can use this data for content tagging, searchable descriptions, accessibility, moderation, or cataloging.\n\n⚙️ **Before using this workflow**, make sure to set the `GeminiKey` environment variable with your Gemini API key.  \nThis ensures your API key is securely managed and not hardcoded in the workflow.\n\n__SECURITY NOTE__: This workflow contains an API key in the workflow data.  \nFor production use, store your API keys in Credentials or use environment variables (like `GeminiKey`) instead of hardcoding them.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "8854f039-f23f-4174-8821-7acfbc5ecfab",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -320,
        20
      ],
      "parameters": {
        "color": 5,
        "width": 220,
        "height": 300,
        "content": "## Configuration\nDefine the video URL you want to analyze.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "189ede99-f80f-4f41-8481-c9ba518fd0e7",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -70,
        -140
      ],
      "parameters": {
        "color": 4,
        "width": 820,
        "height": 460,
        "content": "## Video Processing Pipeline\n\nThis section handles the complete video processing workflow:\n\n1. DOWNLOAD: First, we fetch the video from the provided URL, converting it to binary data that Gemini can process\n\n2. UPLOAD: Next, we send the binary video data to Gemini's servers where it's stored temporarily for AI processing\n\n3. ANALYZE: Finally, we request Gemini's AI to analyze the video content. You can customize the prompt in the \"Analyze video Gemini\" node to focus on specific aspects of the video content you're interested in\n\nThe Wait node ensures the video is fully processed before analysis begins.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "2c31e2a6-0daf-527f-8533-d46632bd5039",
      "name": "Publication · Overview and setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -1720,
        -380
      ],
      "parameters": {
        "content": "# 🎥 Gemini AI Video Analysis\n\n## Purpose and structure\nThis folder contains the **🎥 Gemini AI Video Analysis** workflow. Its executable nodes use `httpRequest`, `manualTrigger`, `set`, `wait`. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.\n\n## Setup\nImport inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.\n\n## Entry points\nWhen clicking ‘Test workflow’\n\n## Verification\nSanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.\n\n## Attribution\nhttps://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Http/1876_HTTP_Manual_Automation_Webhook.json\nMIT; preserve source notices.",
        "width": 700,
        "height": 800,
        "color": 1
      }
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "Analyze video Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Input": {
      "main": [
        [
          {
            "node": "Download video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download video": {
      "main": [
        [
          {
            "node": "Upload video Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload video Gemini": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze video Gemini": {
      "main": [
        [
          {
            "node": "Get Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Set Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
