Video generation access and usage - Amazon Nova

Video generation access and usage

Generating a video with Amazon Nova Reel is an asynchronous process that typically takes about 3 minutes per 6 second video. After initiating the generation of a video, the video is written to an Amazon S3 bucket in your account. Because Amazon Bedrock writes a file to an Amazon S3 bucket on your behalf, the AWS role that you use needs permissions configured to allow the appropriate Amazon Bedrock and Amazon S3 actions and the s3:PutObject action. The minimum action permissions required to generate a video are:

  • bedrock:InvokeModel

  • s3:PutObject

However, we recommend the following additional actions so you can track the status of video generation jobs:

  • bedrock:GetAsyncInvoke

  • bedrock:ListAsyncInvokes

When video generation completes, the video is stored in the Amazon S3 bucket you specified. Amazon Nova creates a folder for each invocation ID. This folder contains the manifest.json and output.mp4 files that are created by the video generation request.

Starting a video generation job

To initiate the generation of a video, call start_async_invoke(). This creates a new invocation job. When the job completes, Amazon Nova automatically saves the generated video to an Amazon S3 bucket that you specify.

start_async_invoke() takes the following arguments:

  • modelId (Required) – The model ID to use. For Amazon Nova Reel, this is "amazon.nova-reel-v1:0 "

  • modelInput (Required) – Defines all of the video generation parameters specific to the Amazon Nova Reel model. For more information, see Video generation input parameters.

  • outputDataConfig (Required) – Defines where the generated video should be saved. The value must have the following structure:

    { "s3OutputDataConfig": { "s3Uri": string (S3 URL starting with "s3://") } }

Video generation input parameters

The following structure defines an video generation job for Amazon Nova Reel:

{ "taskType": "TEXT_VIDEO", "textToVideoParams": { "text": string, "images": ImageSource[] (list containing a single ImageSource) }, "videoGenerationConfig": { "durationSeconds": int, "fps": int, "dimension": string, "seed": int } }

These input parameters are necessary to create the video generation job:

  • text (Required) – A text prompt to generate the video. Must be 1-512 characters in length.

  • images (Optional) – A single JPEG or PNG image that is used as the starting keyframe of the output video. This input image is used along with the text prompt to generate the video. The image must be formatted as a Base64 string. Images can be in PNG or JPEG format and must be 8 bits per color channel (RGB). PNG images may contain an additional alpha channel, but that channel must not contain any transparent or translucent pixels. Currently, the model accepts only images of 1280 (width) x 720 (height).

  • durationSeconds (Required) - Duration of the output video. 6 is the only supported value currently.

  • fps (Required)- Frame rate of the output video. 24 is the only supported value currently.

  • dimension (Required) - Width and height of the output video. "1280x720" is the only supported value currently.

  • seed (Optional) – Determines the initial noise setting for the generation process. Changing the seed value while leaving all other parameters the same will produce a totally new image that still adheres to your prompt, dimensions, and other settings. It is common to experiment with a variety of seed values to find the perfect image.

    The seed value must be between 0-2,147,483,646 and the default value is 12.

When you use an image as the input, use the following structure to include the image in your request:

{ "format": "png" | "jpeg" "source": { "bytes": string (Base64 encoded image) } }
  • format (Required) - Must match the format of the input image. Either "png" or "jpeg".

  • source (Required)

    • bytes (Required) - The input image encoded as a Base64 string. The image must have a resolution of 1280 x 720.

Checking progress of video generation jobs

There are two ways to check on the progress of a video generation job. If you have a reference to the invocation ARN that was returned when starting the invocation, you can use the get_async_invoke() method of the Amazon Bedrock Runtime.

response = bedrock_runtime.get_async_invoke( invocationArn="arn:AWS:bedrock:us-east-1:account-id;:async-invoke/invocation-id" ) status = response["status"] print(f"Status: {status}")

The status of a job will be "Completed", "InProgress", or "Failed". For more details on using the get_async_invoke() method, see the Async Invoke API documentation.

If you do not have a reference to the invocation ARN, or if you want to check the status for multiple jobs at once, you can use the list_async_invokes() method of the Amazon Bedrock Runtime.

invocations_details = bedrock_runtime.list_async_invokes( maxResults=10, # (Optional) statusEquals="InProgress", # (Optional) Can be "Completed", "InProgress", or "Failed". Omit this argument to list all jobs, regardless of status. # Note: There are other supported arguments not demonstrated here. ) print(json.dumps(invocations_details, indent=2, default=str))

For more details on using the list_async_invokes() method, see the Async Invoke API documentation.