Automatización de carga de video → Miniatura automática → Google Drive

Intermedio

Este es unContent Creation, Multimodal AIflujo de automatización del dominio deautomatización que contiene 9 nodos.Utiliza principalmente nodos como If, Webhook, GoogleDrive, ExecuteCommand, ReadBinaryFile. Automatizar la subida de videos y generación de miniaturas con FFmpeg y Google Drive

Requisitos previos
  • Punto final de HTTP Webhook (n8n generará automáticamente)
  • Credenciales de API de Google Drive
Vista previa del flujo de trabajo
Visualización de las conexiones entre nodos, con soporte para zoom y panorámica
Exportar flujo de trabajo
Copie la siguiente configuración JSON en n8n para importar y usar este flujo de trabajo
{
  "id": "W69y1dllbQpuNZQ0",
  "meta": {
    "instanceId": "14e4c77104722ab186539dfea5182e419aecc83d85963fe13f6de862c875ebfa",
    "templateCredsSetupCompleted": true
  },
  "name": "Automate Video Upload → Auto-Thumbnail → Google Drive",
  "tags": [],
  "nodes": [
    {
      "id": "0f0dc32f-cadc-4001-9ded-4049186ed556",
      "name": "Nota adhesiva",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -570,
        -180
      ],
      "parameters": {
        "width": 1600,
        "height": 340,
        "content": "## Video Upload → Auto-Thumbnail → Google Drive\n\n### **What it does (high level)**\nAccepts a video via HTTP upload, validates it’s a real video file, extracts a thumbnail at the 5-second mark using FFmpeg (auto-installs if missing), saves the thumbnail to a designated Google Drive folder, and returns a JSON response with the new file’s details."
      },
      "typeVersion": 1
    },
    {
      "id": "9e6b7fcd-2c7a-4762-8dd7-efa102ad9599",
      "name": "Nota adhesiva1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        180
      ],
      "parameters": {
        "width": 1580,
        "height": 660,
        "content": "# **Node Breakdown & Descriptions:**\n\n### \\* The workflow starts with a **Webhook** node named **“Accept Video Upload”**, which activates on an HTTP **POST** to `/mediaUpload`. It expects `multipart/form-data` with the file in the `media` field and defers responding until the last node, so the API reply can include the uploaded thumbnail’s metadata.\n\n### \\* The next node, **IF** named **“Validate Upload is Video”**, checks `{{$binary.media.mimeType}}` contains `video/`. Only true (video) items proceed. If it ever receives a non-video, the false branch can return a **400** (optional improvement).\n\n### \\* The **Write Binary File** node named **“Persist Upload to /tmp”** writes the incoming `media` binary to disk at `/tmp/<originalFilename or input.mp4>`. This produces a stable file path for FFmpeg to read from.\n\n### \\* The **Execute Command** node named **“Extract Thumbnail with FFmpeg (Auto-Install)”** runs FFmpeg to grab a single frame at **5 seconds**:\n\n* If FFmpeg exists in the environment, it uses it.\n* Otherwise it **downloads a static FFmpeg** build into `/tmp/ffmpeg` (no root needed) and uses that.\n* Command outputs `/tmp/thumbnail.jpg` (`-ss 5 -frames:v 1 -q:v 2`).\n\n### \\* The **Read Binary File** node named **“Load Thumbnail from Disk”** reads `/tmp/thumbnail.jpg` back into the item’s binary data, preparing it for upload (thumbnail is now available as the node’s binary output).\n\n### \\* The **Google Drive** node named **“Upload Thumbnail to Drive”** uploads the thumbnail image to your target folder (folder ID you configured). The file name is derived from the original video name with a `-thumb.jpg` suffix. On success, it returns Drive metadata such as `id` and `name`.\n\n### \\* Finally, the **Respond to Webhook** node named **“Return API Response”** sends a JSON response to the caller indicating success, including the Drive `thumbnailFileId` and `thumbnailName`, so the client can reference or share the thumbnail immediately."
      },
      "typeVersion": 1
    },
    {
      "id": "eb68ca4d-93d6-4535-a009-be7a129e18f3",
      "name": "Aceptar carga de video (Disparador Webhook)",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -480,
        0
      ],
      "webhookId": "53a1804d-fde6-4e38-abd4-f22f5cf2e4b2",
      "parameters": {
        "path": "mediaUpload",
        "options": {},
        "httpMethod": "POST",
        "responseData": "allEntries",
        "responseMode": "lastNode"
      },
      "typeVersion": 1
    },
    {
      "id": "22cf7a78-1f4b-4dac-83b6-718476d74c11",
      "name": "Validar que carga sea video (Si)",
      "type": "n8n-nodes-base.if",
      "position": [
        -260,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "string": [
            {
              "value1": "={{$binary.file.mimeType}}",
              "value2": "video/",
              "operation": "contains"
            }
          ],
          "boolean": []
        }
      },
      "typeVersion": 2
    },
    {
      "id": "9bc950c0-4ffd-4c86-9345-7aa2bb682625",
      "name": "Guardar carga en /tmp (Write Binary File)",
      "type": "n8n-nodes-base.writeBinaryFile",
      "position": [
        -40,
        0
      ],
      "parameters": {
        "options": {},
        "fileName": "={{$('Accept Video Upload (Webhook)').item.binary.media.fileName ? \"/tmp/\" + $('Accept Video Upload (Webhook)').item.binary.media.fileName : \"/tmp/input.mp4\"}}",
        "dataPropertyName": "media"
      },
      "typeVersion": 1
    },
    {
      "id": "b8ecc2ac-ddca-42cb-a735-ec3e79e02f1c",
      "name": "Extraer miniatura con FFmpeg (Auto-Install) (Ejecutar comando)",
      "type": "n8n-nodes-base.executeCommand",
      "position": [
        180,
        0
      ],
      "parameters": {
        "command": "=set -e\n\nVIDEO=\"{{ $('Persist Upload to /tmp (Write Binary File)').item.json.fileName }}\"\nOUT=\"/tmp/{{ $('Accept Video Upload (Webhook)').item.binary.media.fileName }}_thumbnail.jpg\"\n\n# 1) locate ffmpeg\nif command -v ffmpeg >/dev/null 2>&1; then\n  FFMPEG_BIN=\"$(command -v ffmpeg)\"\nelif [ -x /tmp/ffmpeg/ffmpeg ]; then\n  FFMPEG_BIN=\"/tmp/ffmpeg/ffmpeg\"\nelse\n  # 2) fetch a static ffmpeg (no root). Works on most Linux hosts/containers.\n  ARCH=\"$(uname -m)\"\n  case \"$ARCH\" in\n    x86_64|amd64)  URL=\"https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz\" ;;\n    aarch64|arm64) URL=\"https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-arm64-static.tar.xz\" ;;\n    armv7l|armhf)  URL=\"https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-armhf-static.tar.xz\" ;;\n    i686|i386)     URL=\"https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-i686-static.tar.xz\" ;;\n    *) echo \"Unsupported CPU arch: $ARCH\" >&2; exit 1 ;;\n  esac\n\n  mkdir -p /tmp/ffmpeg && cd /tmp/ffmpeg\n\n  # downloader: prefer curl, else wget\n  if command -v curl >/dev/null 2>&1; then\n    curl -fsSL \"$URL\" -o ffmpeg.tar.xz\n  elif command -v wget >/dev/null 2>&1; then\n    wget -qO ffmpeg.tar.xz \"$URL\"\n  else\n    echo \"Need curl or wget to fetch ffmpeg\" >&2\n    exit 1\n  fi\n\n  # extract (xz support required by most tars on Linux)\n  tar -xJf ffmpeg.tar.xz --strip-components=1\n  chmod +x ./ffmpeg ./ffprobe\n  FFMPEG_BIN=\"/tmp/ffmpeg/ffmpeg\"\nfi\n\n# 3) do the work\n\"$FFMPEG_BIN\" -y -ss 5 -i \"$VIDEO\" -frames:v 1 -q:v 2 \"$OUT\"\n",
        "executeOnce": false
      },
      "typeVersion": 1
    },
    {
      "id": "736a61c2-bfeb-4821-8ca2-a0e54ddfb04d",
      "name": "Cargar miniatura desde disco (Read Binary File)",
      "type": "n8n-nodes-base.readBinaryFile",
      "position": [
        400,
        0
      ],
      "parameters": {
        "filePath": "=/tmp/{{ $('Persist Upload to /tmp (Write Binary File)').item.binary.media.fileName }}_thumbnail.jpg"
      },
      "typeVersion": 1
    },
    {
      "id": "8b2760d0-22f8-4291-9663-71f01e3c397b",
      "name": "Subir miniatura a Drive (Google Drive)",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        620,
        0
      ],
      "parameters": {
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1AXMk_yyq3sD_Oc9f5eRLuqtJevbX-d1i",
          "cachedResultUrl": "",
          "cachedResultName": "Video_Thumbnail"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "LzEW2SwCQjcSdvdB",
          "name": "Google Drive account 6"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "418127d5-2902-472c-b4dc-5f9628c7c6b7",
      "name": "Devolver respuesta API (Respond to Disparador Webhook)",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        840,
        0
      ],
      "parameters": {
        "options": {
          "responseCode": 200
        },
        "respondWith": "json",
        "responseBody": "={\n  \"ok\": true,\n  \"fileName\": \"{{ $json.name || $json.originalFilename }}\",\n  \"type\": \"{{ $json.mimeType || $json.fullFileExtension || $json.fileExtension }}\",\n  \"sizeBytes\": \"{{ $json.size }}\",\n  \"sizeHuman\": \"={{ (Number($json.size) >= 1048576 ? (Number($json.size)/1048576).toFixed(2) + ' MB' : (Number($json.size)/1024).toFixed(2) + ' KB') }}\",\n  \"url\": \"={{ $json.webViewLink || ('https://drive.google.com/file/d/' + $json.id + '/view') }}\",\n  \"downloadUrl\": \"={{ $json.webContentLink || ('https://drive.google.com/uc?id=' + $json.id + '&export=download') }}\",\n  \"createdTime\": \"{{ $json.createdTime }}\",\n  \"modifiedTime\": \"{{ $json.modifiedTime }}\",\n  \"image\": {\n    \"width\": \"{{ $json.imageMediaMetadata && $json.imageMediaMetadata.width }}\",\n    \"height\": \"{{ $json.imageMediaMetadata && $json.imageMediaMetadata.height }}\",\n    \"rotation\": \"{{ $json.imageMediaMetadata && $json.imageMediaMetadata.rotation }}\"\n  },\n  \"owner\": \"{{ $json.owners && $json.owners[0] && $json.owners[0].displayName }}\"\n}"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "8797b44a-f6aa-4043-9997-84a2147ae0aa",
  "connections": {
    "Aceptar carga de video (Webhook)": {
      "main": [
        [
          {
            "node": "Validar que carga sea video (IF)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validar que carga sea video (IF)": {
      "main": [
        [
          {
            "node": "9bc950c0-4ffd-4c86-9345-7aa2bb682625",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8b2760d0-22f8-4291-9663-71f01e3c397b": {
      "main": [
        [
          {
            "node": "Devolver respuesta API (Respond to Webhook)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9bc950c0-4ffd-4c86-9345-7aa2bb682625": {
      "main": [
        [
          {
            "node": "Extraer miniatura con FFmpeg (Auto-Install) (Execute Command)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "736a61c2-bfeb-4821-8ca2-a0e54ddfb04d": {
      "main": [
        [
          {
            "node": "8b2760d0-22f8-4291-9663-71f01e3c397b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extraer miniatura con FFmpeg (Auto-Install) (Execute Command)": {
      "main": [
        [
          {
            "node": "736a61c2-bfeb-4821-8ca2-a0e54ddfb04d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Preguntas frecuentes

¿Cómo usar este flujo de trabajo?

Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.

¿En qué escenarios es adecuado este flujo de trabajo?

Intermedio - Creación de contenido, IA Multimodal

¿Es de pago?

Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.

Información del flujo de trabajo
Nivel de dificultad
Intermedio
Número de nodos9
Categoría2
Tipos de nodos8
Descripción de la dificultad

Adecuado para usuarios con experiencia intermedia, flujos de trabajo de complejidad media con 6-15 nodos

Autor
WeblineIndia

WeblineIndia

@weblineindia

A Leading Software Engineering, Consulting & Outsourcing Services Company in USA & India serving Clients Globally since 1999.

Enlaces externos
Ver en n8n.io

Compartir este flujo de trabajo

Categorías

Categorías: 34