Plantilla de video de cotización automática V2

Avanzado

Este es unAI, Marketingflujo de automatización del dominio deautomatización que contiene 28 nodos.Utiliza principalmente nodos como Code, Wait, GoogleDrive, HttpRequest, GoogleSheets, combinando tecnología de inteligencia artificial para lograr automatización inteligente. Creación automática de videos de cotización cinematográfica con IA y subida a YouTube

Requisitos previos
  • Credenciales de API de Google Drive
  • Pueden requerirse credenciales de autenticación para la API de destino
  • Credenciales de API de Google Sheets
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": "CvXjXG4SFnN0ioJQ",
  "meta": {
    "instanceId": "e2034325698638870d6b764285427bad9d79bf1e08a458be597c06e61ad7e545",
    "templateCredsSetupCompleted": true
  },
  "name": "AutoQoutesV2_template",
  "tags": [],
  "nodes": [
    {
      "id": "2ff58bb4-7079-44fe-a2ac-b4af9fa5b30e",
      "name": "Al hacer clic en 'Probar flujo de trabajo'",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        300,
        0
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "ec44d567-dfc8-4561-87df-903724225247",
      "name": "Generar Imagen",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        660,
        0
      ],
      "parameters": {
        "url": "https://api.piapi.ai/api/v1/task",
        "body": "={\n  \"model\": \"Qubico/flux1-dev\",\n  \"task_type\": \"txt2img\",\n  \"input\": {\n    \"prompt\": \"Ultra-realistic vertical nature landscape, {{ $json['Background (EN)'] }}, featuring {{ $json['Prompt (EN)'] }}, high detail, soft atmospheric lighting, cinematic golden hour glow, vertical composition, photorealistic texture, natural depth of field, calm and serene mood, no people, no buildings, HDR, 8k resolution, masterpiece\",\n    \"negative_prompt\": \"taking a photo of a room, recording a video of a room, photos app, video recorder, illegible text, blurry text, low quality text, DSLR, unnatural\",\n    \"width\": 540,\n    \"height\": 960\n  }\n}",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "raw",
        "sendHeaders": true,
        "rawContentType": "application/json",
        "headerParameters": {
          "parameters": [
            {
              "name": "X-API-Key",
              "value": "=[Your PiAPI Key]"
            }
          ]
        }
      },
      "retryOnFail": false,
      "typeVersion": 4.2
    },
    {
      "id": "ad260a51-e981-47cc-8600-967c1c748814",
      "name": "Obtener imagen",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1020,
        0
      ],
      "parameters": {
        "url": "=https://api.piapi.ai/api/v1/task/{{ $json.data.task_id }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-API-Key",
              "value": "=[Your PiAPI Key]"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "cddff673-15ce-47ec-a2d3-3d71437bfb1f",
      "name": "Nota adhesiva",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        600,
        -80
      ],
      "parameters": {
        "width": 820,
        "height": 240,
        "content": "## Create Image Background\nGenerate an image using prompt from Google Sheet via PiAPI Flux (Txt2img)."
      },
      "typeVersion": 1
    },
    {
      "id": "64132a39-ad42-4158-9eec-5b6bfdc7bca2",
      "name": "Actualizar URL de fondo de imagen",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1240,
        0
      ],
      "parameters": {
        "columns": {
          "value": {
            "Index": "={{ $('Get data from Google Sheet').item.json.Index }}",
            "Background Image": "={{ $json.data.output.image_url }}"
          },
          "schema": [
            {
              "id": "Index",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Index",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Quote (Thai)",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Quote (Thai)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Pen Name (Thai)",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Pen Name (Thai)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Background (EN)",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Background (EN)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Prompt (EN)",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Prompt (EN)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Background Image",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Background Image",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Background Video",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Background Video",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Video Status",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Video Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Index"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1p1iPoiu2uI3qGbHi0diS7QwsMcLuzDIqwo3AeSUVrGQ/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "1p1iPoiu2uI3qGbHi0diS7QwsMcLuzDIqwo3AeSUVrGQ"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "Ra2f1dlqOJ13jTtb",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "801dd794-4cf8-42f7-8102-a3a4853cae39",
      "name": "Imagen a Vídeo",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        260,
        280
      ],
      "parameters": {
        "url": "https://api.piapi.ai/api/v1/task",
        "body": "={\n  \"model\": \"kling\",\n  \"task_type\": \"video_generation\",\n  \"input\": {\n    \"prompt\": \"Cinematic vertical video from image of {{ $('Get data from Google Sheet').item.json['Background (EN)'] }}, with {{ $('Get data from Google Sheet').item.json['Prompt (EN)'] }}, animated subtly from image, with soft light, mist, swaying trees, slow zoom effect, no people or buildings\",\n    \"negative_prompt\": \"blurry motion, distorted faces, unnatural lighting, over produced, bad quality\",\n    \"cfg_scale\": 0.5,\n    \"duration\": 5,\n    \"mode\": \"std\",\n    \"image_url\": \"{{ $('Get image').item.json.data.output.image_url }}\",\n    \"version\": \"1.0\",\n    \"camera_control\": {\n      \"type\": \"simple\",\n      \"config\": {\n        \"horizontal\": 0,\n        \"vertical\": 0,\n        \"pan\": 0,\n        \"tilt\": 0,\n        \"roll\": 0,\n        \"zoom\": 5\n      }\n    }\n  }\n}",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "raw",
        "sendHeaders": true,
        "rawContentType": "application/json",
        "headerParameters": {
          "parameters": [
            {
              "name": "X-API-Key",
              "value": "=[Your PiAPI Key]"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "6f7d755f-73fb-474f-a2c4-4612317c4f5a",
      "name": "Esperar imagen 2 min",
      "type": "n8n-nodes-base.wait",
      "position": [
        840,
        0
      ],
      "webhookId": "ccf58c3e-f91d-4f58-a4a7-aff58c9be226",
      "parameters": {
        "unit": "minutes",
        "amount": 2
      },
      "typeVersion": 1.1
    },
    {
      "id": "d8de3a95-1a5b-4495-9a1f-8178c1be3d44",
      "name": "Esperar vídeo 5 min",
      "type": "n8n-nodes-base.wait",
      "position": [
        440,
        280
      ],
      "webhookId": "6df38e96-d5ec-4588-9569-db9b86539a34",
      "parameters": {
        "unit": "minutes"
      },
      "typeVersion": 1.1
    },
    {
      "id": "c3f97a19-9ea8-4489-8629-767542f0fddb",
      "name": "Obtener Vídeo",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        620,
        280
      ],
      "parameters": {
        "url": "=https://api.piapi.ai/api/v1/task/{{ $json.data.task_id }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-API-Key",
              "value": "=[Your PiAPI Key]"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "eefa224d-2e3d-459e-a16d-8e2584b59cf0",
      "name": "Nota adhesiva1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        200
      ],
      "parameters": {
        "color": 3,
        "width": 1180,
        "height": 240,
        "content": "## Create Video Background\nCreate a cinematic vertical video from the generated image using PiAPI Kling."
      },
      "typeVersion": 1
    },
    {
      "id": "8d2035a8-d4a0-4a33-bae3-c18b530487d4",
      "name": "Generar Audio",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        380,
        560
      ],
      "parameters": {
        "url": "https://api.elevenlabs.io/v1/sound-generation",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "text",
              "value": "={\n  \"text\": \"no voice, A peaceful soundscape unfolds as the sun begins to rise over misty {{ $('Get data from Google Sheet').item.json['Background (EN)'] }}, casting warm light across the scene. The crisp morning air is filled with ambient nature sounds like {{ $('Get data from Google Sheet').item.json['Prompt (EN)'] }} along with soft lofi beats, blending into a calm and immersive atmosphere.\",\n  \"duration_seconds\": 5,\n  \"model_id\": \"sound-effects-v1\",\n  \"output_format\": \"mp3\"\n}\n"
            },
            {
              "name": "duration_seconds",
              "value": "20"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "xi-api-key",
              "value": "[Your ElevenLab Key]"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "66af781a-2012-426e-a623-e90e21e8b2a1",
      "name": "Obtener datos de la Hoja Google",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        480,
        0
      ],
      "parameters": {
        "options": {
          "returnFirstMatch": true
        },
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "Video Status"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1p1iPoiu2uI3qGbHi0diS7QwsMcLuzDIqwo3AeSUVrGQ/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "1p1iPoiu2uI3qGbHi0diS7QwsMcLuzDIqwo3AeSUVrGQ"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "Ra2f1dlqOJ13jTtb",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "04074118-9f30-4648-8aab-9574156a76ba",
      "name": "Actualizar URL de fondo de sonido",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1220,
        480
      ],
      "parameters": {
        "columns": {
          "value": {
            "Index": "={{ $('Get data from Google Sheet').item.json.Index }}",
            "Music Background": "={{ $json.webContentLink }}"
          },
          "schema": [
            {
              "id": "Index",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Index",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Quote (Thai)",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Quote (Thai)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Pen Name (Thai)",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Pen Name (Thai)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Background (EN)",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Background (EN)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Prompt (EN)",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Prompt (EN)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Background Image",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Background Image",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Background Video",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Background Video",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Music Background",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Music Background",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Video Status",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Video Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Index"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1p1iPoiu2uI3qGbHi0diS7QwsMcLuzDIqwo3AeSUVrGQ/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "1p1iPoiu2uI3qGbHi0diS7QwsMcLuzDIqwo3AeSUVrGQ"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "Ra2f1dlqOJ13jTtb",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "35ca939b-fb27-48cf-8036-f35618ceaee0",
      "name": "Actualizar URL de fondo de vídeo",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1240,
        280
      ],
      "parameters": {
        "columns": {
          "value": {
            "Index": "={{ $('Get data from Google Sheet').item.json.Index }}",
            "Background Video": "={{ $json.data.output.video_url }}"
          },
          "schema": [
            {
              "id": "Index",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Index",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Quote (Thai)",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Quote (Thai)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Pen Name (Thai)",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Pen Name (Thai)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Background (EN)",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Background (EN)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Prompt (EN)",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Prompt (EN)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Background Image",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Background Image",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Background Video",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Background Video",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Video Status",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Video Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Index"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1p1iPoiu2uI3qGbHi0diS7QwsMcLuzDIqwo3AeSUVrGQ/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "1p1iPoiu2uI3qGbHi0diS7QwsMcLuzDIqwo3AeSUVrGQ"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "Ra2f1dlqOJ13jTtb",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "54c8badf-a99a-4e5c-ad96-e1d982eb6855",
      "name": "Nota adhesiva2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        480
      ],
      "parameters": {
        "color": 4,
        "width": 1180,
        "height": 240,
        "content": "## Create Sound Background\nGenerate ambient sound using ElevenLabs based on the scene prompt."
      },
      "typeVersion": 1
    },
    {
      "id": "15b9e2b1-72d9-42bf-a8a4-0ad0a01c5e5f",
      "name": "Subir Sonido a Drive Google",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        780,
        480
      ],
      "parameters": {
        "name": "={{ $('Get data from Google Sheet').item.json['Background (EN)'] }}.mp3",
        "driveId": {
          "__rl": true,
          "mode": "id",
          "value": "1Sfv2PvIHF0J3-5IOYFdZp2-4LNPOoSX1"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "root",
          "cachedResultName": "/ (Root folder)"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "OEWvSsY5xiUhqOnx",
          "name": "Google Drive account - PeakWave"
        }
      },
      "typeVersion": 3,
      "alwaysOutputData": true
    },
    {
      "id": "2a628e8a-077a-4999-9ef7-8d28ac4433ac",
      "name": "Guardar Fondo de Vídeo Localmente1",
      "type": "n8n-nodes-base.readWriteFile",
      "position": [
        1040,
        280
      ],
      "parameters": {
        "options": {},
        "fileName": "=VideoBackground.mp4",
        "operation": "write"
      },
      "typeVersion": 1
    },
    {
      "id": "fa5cce8d-4b50-4221-9446-050f497b30a9",
      "name": "Obtener Fondo de Vídeo Binario",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        820,
        280
      ],
      "parameters": {
        "url": "={{ $json.data.output.video_url }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "ea003577-5467-4acb-a33b-b4b30a03a35f",
      "name": "Guardar Fondo Musical Localmente1",
      "type": "n8n-nodes-base.readWriteFile",
      "position": [
        980,
        560
      ],
      "parameters": {
        "options": {
          "append": false
        },
        "fileName": "=SoundBackground.mp3",
        "operation": "write"
      },
      "typeVersion": 1
    },
    {
      "id": "b9332740-c4e0-40f9-bc0d-c550c8f0f96d",
      "name": "Preparar Texto Superpuesto (Cita y Autor)1",
      "type": "n8n-nodes-base.code",
      "position": [
        300,
        860
      ],
      "parameters": {
        "jsCode": "// Define separate configuration for the quote and the author\nconst quoteFont = \"Kanit-Italic.ttf\";      \nconst quoteFontSize = 70;\nconst authorFont = \"Kanit-Italic.ttf\";     \nconst authorFontSize = 50;\nconst fontColor = \"white\";\nconst lineHeightMultiplier = 1.1;\nconst videoWidth = 1080;\nconst margin = 40;  \n\n// Effective width for the quote text\nconst effectiveVideoWidth = videoWidth - 2 * margin;\n\n// Estimate average character width based on quoteFontSize\nconst avgCharWidth = quoteFontSize * 0.6;\nconst maxCharsPerLine = Math.floor(effectiveVideoWidth / avgCharWidth);\n\n// Retrieve the quote and author from \"Select Random Video, Music & Quote\"\nconst transcript = $('Get data from Google Sheet').first().json['Quote (Thai)'];\nif (!transcript) {\n  throw new Error(\"Quote not found\");\n}\n\nconst author = $('Get data from Google Sheet').first().json['Pen Name (Thai)'];\nif (!author) {\n  throw new Error(\"Author not found\");\n}\n\n// Split transcript into words and group them into lines\nconst words = transcript.split(' ');\nconst lines = [];\nlet currentLine = \"\";\nlet currentCharCount = 0;\n\nwords.forEach(word => {\n  const wordLength = word.length;\n  const additionalSpace = currentLine ? 1 : 0;\n  const potentialLength = currentCharCount + additionalSpace + wordLength;\n  if (potentialLength <= maxCharsPerLine) {\n    currentLine += (currentLine ? \" \" : \"\") + word;\n    currentCharCount = potentialLength;\n  } else {\n    lines.push(currentLine);\n    currentLine = word;\n    currentCharCount = wordLength;\n  }\n});\nif (currentLine) {\n  lines.push(currentLine);\n}\n\n// Calculate layout for the quote block\nconst lineHeight = quoteFontSize * lineHeightMultiplier;\nconst totalHeight = lines.length * lineHeight;\n\n// Build drawtext commands for quote lines\nconst quoteCommands = lines.map((line, index) => {\n  const escapedLine = line.replace(/'/g, \"\\\\'\");\n  return `drawtext=fontfile=${quoteFont}:text='${escapedLine}':fontsize=${quoteFontSize}:fontcolor=${fontColor}:x=(w-text_w)/2:y=((h-${totalHeight})/2)+(${index}*${lineHeight})`;\n});\n\n// Build the drawtext command for author\nconst authorY = `((h-${totalHeight})/2)+(${lines.length}*${lineHeight})+20`;\nconst escapedAuthor = author.replace(/'/g, \"\\\\'\");\nconst authorCommand = `drawtext=fontfile=${authorFont}:text='${escapedAuthor}':fontsize=${authorFontSize}:fontcolor=${fontColor}:x=w-text_w-${margin}:y=${authorY}`;\n\n// Combine all commands into one drawtext filter string\nconst fullDrawTextFilter = quoteCommands.concat(authorCommand).join(\", \");\n\n// Return the prepared filter string\nreturn {\n  json: {\n    drawText: fullDrawTextFilter\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "79764093-f6ca-459b-a73c-3326fe82fafa",
      "name": "Generar Clip de Vídeo Final1",
      "type": "n8n-nodes-base.executeCommand",
      "position": [
        480,
        860
      ],
      "parameters": {
        "command": "=ffmpeg -i {{ $('Save Video Background Locally1').item.json.fileName }} -i {{ $('Save Music Background Locally1').item.json.fileName }} -filter_complex \"[0:v]scale=1080:1920:force_original_aspect_ratio=increase,crop=1080:1920[vid]; color=black@0.3:size=1080x1920:d=10[bg]; [vid][bg]overlay=shortest=1[bgvid]; [bgvid]{{ $json.drawText }}[outv]; [1:a]volume=0.8[aout]\" -map \"[outv]\" -map \"[aout]\" -aspect 9:16 -c:v libx264 -c:a aac -shortest output.mp4 -y"
      },
      "typeVersion": 1
    },
    {
      "id": "3c301b6b-d6cb-41af-ac52-5722bed8470d",
      "name": "Iniciar Carga Reanudable YouTube",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        700,
        860
      ],
      "parameters": {
        "url": "=https://www.googleapis.com/upload/youtube/v3/videos?part=snippet,status&uploadType=resumable",
        "body": "={\n  \"snippet\": {\n    \"title\": \"{{ $('Get data from Google Sheet').item.json['Quote (Thai)'] }}\",\n    \"description\": \"{{ $('Get data from Google Sheet').item.json['Quote (Thai)'] }}\\n{{ $('Get data from Google Sheet').item.json['Pen Name (Thai)'] }}\",\n    \"defaultLanguage\": \"en\",\n    \"defaultAudioLanguage\": \"en\"\n  },\n  \"status\": {\n    \"privacyStatus\": \"public\",\n    \"license\": \"youtube\",\n    \"embeddable\": true,\n    \"publicStatsViewable\": true,\n    \"madeForKids\": false\n  }\n}",
        "method": "POST",
        "options": {
          "response": {
            "response": {
              "fullResponse": true
            }
          }
        },
        "sendBody": true,
        "contentType": "raw",
        "sendHeaders": true,
        "authentication": "predefinedCredentialType",
        "rawContentType": "RAW/JSON",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "X-Upload-Content-Type",
              "value": "video/webm"
            }
          ]
        },
        "nodeCredentialType": "youTubeOAuth2Api"
      },
      "credentials": {
        "youTubeOAuth2Api": {
          "id": "f9uNp5YNQMnXrNw2",
          "name": "YouTube account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "dbde06b3-e7ba-4b7e-9d58-0a06f88b5176",
      "name": "Leer archivo de salida",
      "type": "n8n-nodes-base.readWriteFile",
      "position": [
        880,
        860
      ],
      "parameters": {
        "options": {},
        "fileSelector": "=output.mp4"
      },
      "typeVersion": 1
    },
    {
      "id": "0b9b92e0-5500-4dca-a622-f63b3cdf0878",
      "name": "Subir Vídeo a YouTube",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1080,
        860
      ],
      "parameters": {
        "url": "={{ $('Initiate YouTube Resumable Upload').item.json.headers.location }}",
        "method": "PUT",
        "options": {},
        "sendBody": true,
        "contentType": "binaryData",
        "sendHeaders": true,
        "authentication": "predefinedCredentialType",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "video/webm"
            }
          ]
        },
        "inputDataFieldName": "data",
        "nodeCredentialType": "youTubeOAuth2Api"
      },
      "credentials": {
        "youTubeOAuth2Api": {
          "id": "f9uNp5YNQMnXrNw2",
          "name": "YouTube account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "721078b6-b1e2-4077-b1ff-696cb3765675",
      "name": "Actualizar Estado de Subida de Cita",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1280,
        860
      ],
      "parameters": {
        "columns": {
          "value": {
            "Index": "={{ $('Get data from Google Sheet').item.json.Index }}",
            "Video Status": "=https://www.youtube.com/watch?v={{ $json.id }}"
          },
          "schema": [
            {
              "id": "Index",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Index",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Quote (Thai)",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Quote (Thai)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Pen Name (Thai)",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Pen Name (Thai)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Background (EN)",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Background (EN)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Prompt (EN)",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Prompt (EN)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Background Image",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Background Image",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Background Video",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Background Video",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Music Background",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Music Background",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Video Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Video Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Index"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1p1iPoiu2uI3qGbHi0diS7QwsMcLuzDIqwo3AeSUVrGQ/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "1p1iPoiu2uI3qGbHi0diS7QwsMcLuzDIqwo3AeSUVrGQ"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "Ra2f1dlqOJ13jTtb",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "8900abd9-9f35-46a3-9b59-883ff16b0764",
      "name": "Nota adhesiva3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        660,
        760
      ],
      "parameters": {
        "color": 5,
        "width": 760,
        "height": 300,
        "content": "## Video Upload & Post-Processing\nUpload the final video to YouTube using the YouTube API and update your Google Sheets with upload statuses and YouTube links."
      },
      "typeVersion": 1
    },
    {
      "id": "07cdec2c-9677-46f0-8038-641c4c191059",
      "name": "Nota adhesiva4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        -80
      ],
      "parameters": {
        "color": 6,
        "width": 340,
        "height": 240,
        "content": "## Get Quote\nRetrieve quote data from Google Sheets including text, author, and background prompts."
      },
      "typeVersion": 1
    },
    {
      "id": "aeadbc59-13d7-4755-b38d-6d4946ecfa78",
      "name": "Nota adhesiva5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        760
      ],
      "parameters": {
        "color": 6,
        "width": 400,
        "height": 300,
        "content": "## Combine All\nMerge video, sound, and quote text into final clip using FFmpeg."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "2c56841d-3045-4d6d-b643-0f3804bf2c3e",
  "connections": {
    "c3f97a19-9ea8-4489-8629-767542f0fddb": {
      "main": [
        [
          {
            "node": "fa5cce8d-4b50-4221-9446-050f497b30a9",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ad260a51-e981-47cc-8600-967c1c748814": {
      "main": [
        [
          {
            "node": "64132a39-ad42-4158-9eec-5b6bfdc7bca2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8d2035a8-d4a0-4a33-bae3-c18b530487d4": {
      "main": [
        [
          {
            "node": "15b9e2b1-72d9-42bf-a8a4-0ad0a01c5e5f",
            "type": "main",
            "index": 0
          },
          {
            "node": "ea003577-5467-4acb-a33b-b4b30a03a35f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ec44d567-dfc8-4561-87df-903724225247": {
      "main": [
        [
          {
            "node": "6f7d755f-73fb-474f-a2c4-4612317c4f5a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "801dd794-4cf8-42f7-8102-a3a4853cae39": {
      "main": [
        [
          {
            "node": "d8de3a95-1a5b-4495-9a1f-8178c1be3d44",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "dbde06b3-e7ba-4b7e-9d58-0a06f88b5176": {
      "main": [
        [
          {
            "node": "0b9b92e0-5500-4dca-a622-f63b3cdf0878",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6f7d755f-73fb-474f-a2c4-4612317c4f5a": {
      "main": [
        [
          {
            "node": "ad260a51-e981-47cc-8600-967c1c748814",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d8de3a95-1a5b-4495-9a1f-8178c1be3d44": {
      "main": [
        [
          {
            "node": "c3f97a19-9ea8-4489-8629-767542f0fddb",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0b9b92e0-5500-4dca-a622-f63b3cdf0878": {
      "main": [
        [
          {
            "node": "721078b6-b1e2-4077-b1ff-696cb3765675",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "79764093-f6ca-459b-a73c-3326fe82fafa": {
      "main": [
        [
          {
            "node": "3c301b6b-d6cb-41af-ac52-5722bed8470d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "66af781a-2012-426e-a623-e90e21e8b2a1": {
      "main": [
        [
          {
            "node": "ec44d567-dfc8-4561-87df-903724225247",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "721078b6-b1e2-4077-b1ff-696cb3765675": {
      "main": [
        []
      ]
    },
    "fa5cce8d-4b50-4221-9446-050f497b30a9": {
      "main": [
        [
          {
            "node": "2a628e8a-077a-4999-9ef7-8d28ac4433ac",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "04074118-9f30-4648-8aab-9574156a76ba": {
      "main": [
        []
      ]
    },
    "64132a39-ad42-4158-9eec-5b6bfdc7bca2": {
      "main": [
        [
          {
            "node": "801dd794-4cf8-42f7-8102-a3a4853cae39",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "35ca939b-fb27-48cf-8036-f35618ceaee0": {
      "main": [
        [
          {
            "node": "8d2035a8-d4a0-4a33-bae3-c18b530487d4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "15b9e2b1-72d9-42bf-a8a4-0ad0a01c5e5f": {
      "main": [
        [
          {
            "node": "04074118-9f30-4648-8aab-9574156a76ba",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ea003577-5467-4acb-a33b-b4b30a03a35f": {
      "main": [
        [
          {
            "node": "b9332740-c4e0-40f9-bc0d-c550c8f0f96d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2a628e8a-077a-4999-9ef7-8d28ac4433ac": {
      "main": [
        [
          {
            "node": "35ca939b-fb27-48cf-8036-f35618ceaee0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3c301b6b-d6cb-41af-ac52-5722bed8470d": {
      "main": [
        [
          {
            "node": "dbde06b3-e7ba-4b7e-9d58-0a06f88b5176",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2ff58bb4-7079-44fe-a2ac-b4af9fa5b30e": {
      "main": [
        [
          {
            "node": "66af781a-2012-426e-a623-e90e21e8b2a1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b9332740-c4e0-40f9-bc0d-c550c8f0f96d": {
      "main": [
        [
          {
            "node": "79764093-f6ca-459b-a73c-3326fe82fafa",
            "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?

Avanzado - Inteligencia Artificial, Marketing

¿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
Avanzado
Número de nodos28
Categoría2
Tipos de nodos9
Descripción de la dificultad

Adecuado para usuarios avanzados, flujos de trabajo complejos con 16+ nodos

Autor
Jaruphat J.

Jaruphat J.

@jaruphatj

Project Manager who passionate about Automation & AI and continuously explore innovative ways to improve business processes through intelligent workflow automation. Let’s connect and automate the future!

Enlaces externos
Ver en n8n.io

Compartir este flujo de trabajo

Categorías

Categorías: 34