Skip to content

Instantly share code, notes, and snippets.

@PatrickKalkman
Created May 26, 2025 13:51
Show Gist options
  • Save PatrickKalkman/78fbf894ba8ce9b836b3048f184452b7 to your computer and use it in GitHub Desktop.
Save PatrickKalkman/78fbf894ba8ce9b836b3048f184452b7 to your computer and use it in GitHub Desktop.
def detect_film_start(self, video_file: types.File) -> Dict[str, float]:
"""Detect when the main film content begins."""
prompt = """Analyze this video clip from the beginning of a film.
Identify the exact timestamp (in MM:SS format) where the first scene
of the main, continuous narrative body of the film begins.
This point must occur after the full conclusion of ALL of the following:
- All studio logos and distributor cards
- The main title card of the film itself
- All subsequent production company cards
I'm looking for the moment the film transitions from opening textual
and logo elements into the primary storyline."""
response = self.client.models.generate_content(
model="gemini-2.5-pro-preview-05-06",
contents=[video_content, prompt],
config=types.GenerateContentConfig(response_mime_type="text/plain")
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment