# Video description generation using Api

**URL:** <https://discuss.ai.google.dev/t/video-description-generation-using-api/53496>\
**Category:** Gemini API\
**Tags:** api\
**Created:** [December 9, 2024, 7:34pm UTC](https://discuss.ai.google.dev/t/video-description-generation-using-api/53496 "2024-12-09T19:34:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abin\_Mathew\_Sunny](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/abin_mathew_sunny/32/32009_2.png) [@Abin\_Mathew\_Sunny](https://discuss.ai.google.dev/u/Abin_Mathew_Sunny)\
**Post date:** [December 9, 2024, 7:34pm UTC](https://discuss.ai.google.dev/t/video-description-generation-using-api/53496/1 "2024-12-09T19:34:10Z")

</div>

I am using api for generating descriptions about video snaps,each video of 5 to 8sec long.I am getting description generated for the first video without any problem but for the rest it shows the file is not in ACTIVE STATE.Why is it like that.I saved the videos in a single folder and loops through each to generate it.The code works perfectly when I’m using or running program separately for each video but when I try from a single program it does not.Anyone have any idea

---

<div class="post-metadata">

**Author:** ![sps](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/sps/32/143_2.png) [@sps](https://discuss.ai.google.dev/u/sps)\
**Post date:** [December 9, 2024, 9:08pm UTC](https://discuss.ai.google.dev/t/video-description-generation-using-api/53496/2 "2024-12-09T21:08:20Z")

</div>

Welcome to the dev forum @Abin_Mathew_Sunny

When you upload a video file to the File API, it first goes into the `PROCESSING` state until it is ready for inference. Only `ACTIVE` files can be used for model inference.

Thus, you must check whether the file is `ACTIVE` before sending it to the model for inference—description generation in your case.

```auto
import time

# Check whether the file is ready to be used.
while video_file.state.name == "PROCESSING":
    print('.', end='')
    time.sleep(10)
    video_file = genai.get_file(video_file.name)

if video_file.state.name == "FAILED":
  raise ValueError(video_file.state.name)

```

More information is in the [documentation](https://ai.google.dev/gemini-api/docs/vision?lang=python#verify-file).

---

<div class="post-metadata">

**Author:** ![system](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/system/32/1_2.png) [@system](https://discuss.ai.google.dev/u/system)\
**Post date:** [November 5, 2026, 6:18pm UTC](https://discuss.ai.google.dev/t/video-description-generation-using-api/53496/4 "2026-11-05T18:18:45Z")

</div>

Closed on November 5, 2026, 6:18pm UTC

This thread was automatically closed 60 days after the last reply. If you are running into an issue, please create a new post.
