Veo 3.1 Image-to-Video API — "Unable to process input image" error (400) when sending base64 image from n8n

Hi everyone,

I’m building a workflow that generates a LinkedIn banner image (using Gemini image generation) and then animates it into a short video using the Veo 3.1 predictLongRunning API. The image generation works fine, but the Veo API call always fails with a 400 error.

What I’m trying to do:

  1. Generate an image using the Gemini gemini-3-pro-image-preview node (image edit mode with reference images)
  2. Take the output binary (edited) and send it to Veo 3.1 for image-to-video generation
  3. The Veo endpoint is: POST https://generativelanguage.googleapis.com/v1beta/models/veo-3.1-generate-preview:predictLongRunning

The request body I’m sending:

{
“instances”: [{
“prompt”: “Animate this static image with smooth motion…”,
“image”: {
“bytesBase64Encoded”: “”,
“mimeType”: “image/png”
}
}],
“parameters”: {
“aspectRatio”: “9:16”,
“durationSeconds”: 8,
“personGeneration”: “allow_adult”
}
}

Errors I’ve encountered:

  1. “referenceImages isn’t supported by this model” — When I tried using parameters.referenceImages with inlineData format and referenceType: “asset” (as shown in the Veo 3.1 docs), the API rejected it.

  2. “Unable to process input image” (400 INVALID_ARGUMENT) — When using the instances.image.bytesBase64Encoded format instead, I get this error.

  3. Binary data issue on n8n Cloud — Since n8n Cloud uses binaryDataMode: filesystem, the Code node’s JS sandbox only gets a short file reference (~13 chars) in binary.data instead of actual base64. I worked around this by adding a Set node with expression {{ $binary.edited.data }} to extract the real base64 into a JSON field before the Code node reads it. The base64 data now appears to be the correct length, but the Veo API still rejects it.

My setup:

  • n8n version: 1.123.22 (Cloud)
  • Auth: x-goog-api-key header
  • Image source: output of Gemini gemini-3-pro-image-preview image edit node (binary property “edited”, PNG format)

What I’ve tried:

  • Stripping data URI prefixes from base64
  • Validating base64 length (it’s substantial, not empty)
  • Both bytesBase64Encoded (in instances) and inlineData (in referenceImages) formats
  • Ensuring mimeType is image/png

Questions:

  1. Has anyone successfully sent a Gemini-generated image to Veo 3.1 for image-to-video in n8n?
  2. Is there a specific image format/size requirement for Veo 3.1 image-to-video?
  3. Could the issue be that the base64 from n8n’s expression engine includes padding or encoding artifacts that Veo doesn’t accept?
  4. Is veo-3.1-generate-preview the correct model ID for image-to-video, or is there a different endpoint?

Any help is greatly appreciated!