> ## Documentation Index
> Fetch the complete documentation index at: https://sambanova-systems.mintlify.site/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Implement video input features

SambaNova supports video input for select multimodal models on both SambaNova Cloud and SambaStack 1.2, allowing you to pass video files alongside text prompts. Learn how to query SambaNova video-capable models using either the SambaNova or OpenAI Python client.

<Note>
  Video input is currently supported on `gemma-4-31B-it`. This model does **not** support audio input.
</Note>

<Note>
  Videos must meet the following requirements:

  * **Maximum duration:** 60 seconds
  * **Frame rate:** 2 fps
  * **Maximum file size:** 100 MB
  * **Duration metadata:** The video file must have readable duration metadata
</Note>

<Warning>
  Always use `"type": "video_url"` with a nested `video_url` object. Using `"type": "video"` is not supported and causes a validation error.
</Warning>

## Make a query with a video

The video request follows the multimodal input format. Pass the video as a base64-encoded string or a URL using the `video_url` content type.

<Steps>
  <Step title="Step 1">
    Make a new Python file and copy the code below.

    <CodeGroup>
      ```python Python (SambaNova) theme={null}
      from sambanova import SambaNova
      import base64

      client = SambaNova(
          base_url="your-sambanova-base-url",
          api_key="your-sambanova-api-key",
      )

      def encode_video(video_path):
          with open(video_path, "rb") as video_file:
              return base64.b64encode(video_file.read()).decode("utf-8")

      video_path = "sample.mp4"
      video_base64 = encode_video(video_path)

      response = client.chat.completions.create(
          model="gemma-4-31B-it",
          messages=[
              {
                  "role": "user",
                  "content": [
                      {"type": "text", "text": "Describe what is happening in this video."},
                      {
                          "type": "video_url",
                          "video_url": {"url": f"data:video/mp4;base64,{video_base64}"},
                      },
                  ],
              }
          ],
      )

      print(response.choices[0].message.content)
      ```

      ```python Python (OpenAI) theme={null}
      from openai import OpenAI
      import base64

      client = OpenAI(
          base_url="your-sambanova-base-url",
          api_key="your-sambanova-api-key",
      )

      def encode_video(video_path):
          with open(video_path, "rb") as video_file:
              return base64.b64encode(video_file.read()).decode("utf-8")

      video_path = "sample.mp4"
      video_base64 = encode_video(video_path)

      response = client.chat.completions.create(
          model="gemma-4-31B-it",
          messages=[
              {
                  "role": "user",
                  "content": [
                      {"type": "text", "text": "Describe what is happening in this video."},
                      {
                          "type": "video_url",
                          "video_url": {"url": f"data:video/mp4;base64,{video_base64}"},
                      },
                  ],
              }
          ],
      )

      print(response.choices[0].message.content)
      ```
    </CodeGroup>
  </Step>

  <Step title="Step 2">
    Use your SambaNova API key and base URL from the [API keys and URLs](/en/get-started/api-keys-urls) page to replace `"your-sambanova-api-key"` and `"your-sambanova-base-url"`.
  </Step>

  <Step title="Step 3">
    Replace `"sample.mp4"` with the path to your video file.
  </Step>

  <Step title="Step 4">
    Update the prompt text in the `content` array to match your use case.
  </Step>

  <Step title="Step 5">
    Run the Python file to receive the text output.
  </Step>
</Steps>

## Payload format

The `video_url` content block accepts either a base64-encoded video or a URL:

```json theme={null}
{
  "type": "video_url",
  "video_url": {
    "url": "data:video/mp4;base64,<base64-encoded-video>"
  }
}
```

```json theme={null}
{
  "type": "video_url",
  "video_url": {
    "url": "https://example.com/sample.mp4"
  }
}
```
