Examples
Video to Shorts
Hackathon Resources
- Introduction
- Setup
- Examples
- Simple Text Agent
- Agent with Tools
- Agent with Knowledge
- Agent with Structured Outputs
- Research Agent
- YouTube Agent
- Image Input + Tools
- Image Generation using DALL-E
- Image to Structured Output
- Image Generate Audio
- Image Input + Output
- Image Transcription
- Image search using Giphy
- Audio Input
- Audio Input Output
- Audio Sentiment
- Audio Transcript
- Audio Multi Turn
- Audio Generate Podcast
- Video Input
- Video Generation with Models Lab
- Video Generation with Replicate
- Video Captions
- Video to Shorts
- Models
- Pre-built Replit Template
- 🏆 Prizes
Examples
Video to Shorts
Video to Shorts
This agent takes a video input and converts it into short vertical videos.
video_to_shorts.py
import subprocess
from pathlib import Path
from agno.agent import Agent
from agno.media import Video
from agno.models.google import Gemini
from agno.utils.log import logger
# Get sample videos from https://www.pexels.com/search/videos/sample/
video_path = Path(__file__).parent.joinpath("sample_video.mp4")
output_dir = Path("tmp/shorts")
agent = Agent(
name="Video2Shorts",
description="Process videos and generate engaging shorts.",
model=Gemini(id="gemini-2.0-flash-exp"),
markdown=True,
debug_mode=True,
structured_outputs=True,
instructions=[
"Analyze the provided video directly—do NOT reference or analyze any external sources or YouTube videos.",
"Identify engaging moments that meet the specified criteria for short-form content.",
"""Provide your analysis in a **table format** with these columns:
- Start Time | End Time | Description | Importance Score""",
"Ensure all timestamps use MM:SS format and importance scores range from 1-10. ",
"Focus only on segments between 15 and 60 seconds long.",
"Base your analysis solely on the provided video content.",
"Deliver actionable insights to improve the identified segments for short-form optimization.",
],
)
Usage
1
Install libraries
pip install -U agno google-genai
2
Export API keys
export GOOGLE_API_KEY=***
3
Run the agent
python video_to_shorts.py
On this page