Veo can start a clip in three ways. Text to video works from words alone. Image to video takes a still you supply and uses it as the opening frame. First and last frame takes two stills, one for the start and one for the end, and asks the model to make the movement between them. In code, the three routes differ by only one or two fields.
This lesson follows one product, a matte black tea tin on a grey slate shelf, down all three routes. It uses the folder, the .env file and the Google Cloud set-up from the last lesson.
Make two stills that match
The stills can come from a real shoot, a retouched packshot or an image model. This script makes them with Nano Banana Pro (gemini-3-pro-image) through Google's Interactions endpoint. It makes the closed tin first, then sends that picture back with an instruction to lift the lid and change nothing else.
make_stills.py: the closed tin and the open tinPython # make_stills.py: two stills of one tea tin, closed then open, for the video routes.import base64from dotenv import load_dotenvfrom google import genai load_dotenv()client = genai.Client()MODEL = "gemini-3-pro-image" # Nano Banana Pro; gemini-3.1-flash-image (cheaper) takes the same call# JPEG, because this endpoint refused PNG output when we called it. 16:9, so Veo has nothing to crop.FORMAT = {"type": "image", "mime_type": "image/jpeg", "aspect_ratio": "16:9", "image_size": "1K"} def save(interaction, filename): if interaction.output_image is None: print("No image came back for", filename) return with open(filename, "wb") as f: f.write(base64.b64decode(interaction.output_image.data)) print("Saved", filename) # Still 1: the closed tin, framed exactly as the video should open.closed = client.interactions.create( model=MODEL, input="Product photograph. A matte black tea tin with a plain paper label, lid closed, standing on a grey " "slate shelf. Soft window light from the left, shallow focus, quiet background.", response_format=FORMAT,)save(closed, "tin_closed.jpg") # Still 2: the SAME tin, opened. Send still 1 back so the model edits it and does not invent a new tin.with open("tin_closed.jpg", "rb") as f: first = base64.b64encode(f.read()).decode("utf-8")opened = client.interactions.create( model=MODEL, input=[ {"type": "text", "text": "The same tin in the same light and framing, with its lid lifted off and resting " "against its side. Loose tea leaves visible inside. Change nothing else."}, {"type": "image", "data": first, "mime_type": "image/jpeg"}, ], response_format=FORMAT,)save(opened, "tin_open.jpg")
The format asks for JPEG because this endpoint refused PNG output when the course called it, whatever the JavaScript sample in the docs suggests. It asks for 16:9 because Veo only makes 16:9 or 9:16 video, and fal's page for the same model warns that a still of any other shape is cropped to fit.
Run it with python make_stills.py. You should see "Saved tin_closed.jpg" and then "Saved tin_open.jpg". Open both and check that the open tin is the same tin on the same shelf in the same light. In the course's run it was, and if yours is not, run it again before you spend anything on video.
Send one tin down three routes
Save this as three_routes.py beside the two stills. It runs each route for 6 seconds on Veo 3.1 Fast at 720p, through Google Cloud.
three_routes.py: one tin, three routesPython # three_routes.py: one tea tin, three ways into Veo, each 6 seconds on Veo 3.1 Fast at 720p, on Google Cloud.import timefrom dotenv import load_dotenvfrom google import genaifrom google.genai import errors, types load_dotenv() # the project and region from the last lesson's .envclient = genai.Client(enterprise=True) # Google Cloud's Agent Platform, signed in as youMODEL = "veo-3.1-fast-generate-001" def run(label, source, last_frame=None): config = types.GenerateVideosConfig( aspect_ratio="16:9", resolution="720p", duration_seconds=6, last_frame=last_frame, # only route 3 sends one ) operation = client.models.generate_videos(model=MODEL, source=source, config=config) while not operation.done: time.sleep(10) operation = client.operations.get(operation) if operation.error or not operation.response or not operation.response.generated_videos: print(label, "did not come back:", operation.error or operation.response) return operation.response.generated_videos[0].video.save(label + ".mp4") # the clip comes back inside the answer print("Saved", label + ".mp4") closed = types.Image.from_file(location="tin_closed.jpg")opened = types.Image.from_file(location="tin_open.jpg") # Route 1, words only. Veo decides the tin, the shelf, the light and the move.run("1_text_only", types.GenerateVideosSource( prompt="A matte black tea tin with a plain paper label on a grey slate shelf, soft window light " "from the left. The camera pushes in slowly. Quiet room tone.")) # Route 2, image to video. Your approved still is frame one, so the words describe motion only.run("2_image_to_video", types.GenerateVideosSource( prompt="The camera pushes in slowly. Nothing else moves. Quiet room tone.", image=closed)) # Route 3, first and last frame. On 25 September 2026 the Gemini API refused it on every tier# ("400 INVALID_ARGUMENT: Your use case is currently not supported.") and charged nothing.# Google Cloud's Veo page lists it as supported. If it is refused here too, make this move with Omni.try: run("3_first_and_last", types.GenerateVideosSource( prompt="The lid lifts off the tin and comes to rest against its side. The camera holds still. " "A soft metal scrape.", image=closed), last_frame=opened)except errors.ClientError as e: print("Route 3 refused:", e)
Route 1 sends words only, so Veo decides the tin, the shelf, the light and the move. Route 2 adds the closed tin as the image in the same source object, so the still becomes frame one. Route 3 keeps that image and adds last_frame to the settings, with the open tin as the end.
When it works you get 1_text_only.mp4 and 2_image_to_video.mp4, and either 3_first_and_last.mp4 or a line starting "Route 3 refused". When the course ran route 3 on the Gemini API, it was refused on every tier with "Your use case is currently not supported", at no charge. Google Cloud's Veo page lists first and last frame as a feature, but the course has not yet run it there. If it is refused for you too, make the move with Gemini Omni Flash, two lessons on.
Write the motion prompt as motion only
Look at the prompts for routes 2 and 3. Neither describes the tin, because the still already shows it, and route 2 asks only for a slow push in, stillness and quiet room tone. If you describe the black tin on slate again, Veo is invited to reinterpret it, and the tin drifts.
For first and last frame, the two stills have to be joinable in the time you give. Replicate's notes for the same model ask for frames that are visually compatible and a transition that is physically plausible. A lid lifting off in six seconds is plausible. A closed tin turning into a different open tin is not, which is why the script edits the first still into the second instead of making the second from scratch.
Send stills correctly when you skip the library
If you ever send an image to Veo with curl instead of the Python library, put the picture in as bytesBase64Encoded with a mimeType beside it. Google's REST samples wrap it in inlineData, and the live API refused that on all three Veo 3.1 models with "inlineData isn't supported by this model". The bytesBase64Encoded shape is the same one the Python library sends.
A seed is a number meant to repeat a result exactly. The Python library refused to send one to the Gemini API, saying seeds work only on Google's enterprise platform, and the course has not tested one on Google Cloud. Until you have, keep every take you like as a file, with its prompt beside it.
The next lesson covers reference images and the sound Veo makes by itself.