DEV Community

Farhan Munir
Farhan Munir

Posted on

Building an AI-Powered Stock Video Discovery Workflow for Instagram Reel Creation

One of the biggest bottlenecks in short-form video creation isn't writing the script or generating ideas—it's finding the right footage.

After generating an engaging Reel concept, creators often spend more time searching for suitable B-roll than they do editing the final video.

To solve this problem, I added a new AI-powered media discovery step to Reel-Quick, allowing the application to automatically locate relevant royalty-free or open-license stock videos based on the generated Reel concept.

Repository

https://github.com/ronin1770/reel-quick

Implementation Issue

https://github.com/ronin1770/reel-quick/issues/18


The Problem

The existing Reel Wizard already produces high-quality creative outputs including:

  • Reel ideas
  • Trending concepts
  • Video titles
  • Hooks
  • Core messages
  • Visual recommendations
  • Story structure

However, once the concept was generated, users still had to manually search for footage.

The workflow looked like this:

Idea Generated
       │
       ▼
Open Pexels
       │
       ▼
Search
       │
       ▼
Open Pixabay
       │
       ▼
Search Again
       │
       ▼
Open Mixkit
       │
       ▼
Search Again
       │
       ▼
Repeat Until Enough Clips Are Found
Enter fullscreen mode Exit fullscreen mode

This process introduced several problems:

  • disconnected user experience
  • inconsistent search quality
  • duplicated work
  • forgotten licensing requirements
  • broken URLs
  • footage that didn't match the intended emotional tone

The application generated the creative direction but stopped short of helping users assemble the actual Reel.


The Goal

Instead of making users perform multiple manual searches, the wizard should continue the workflow automatically.

Once a Reel concept has been approved, the application should:

  • understand the intended story
  • identify the required visual scenes
  • generate effective search phrases
  • locate matching royalty-free footage
  • return structured results for later workflow stages

The result is a much smoother creator experience.


Reusing Existing AI Infrastructure

Rather than introducing another AI provider or search service, the implementation builds on the existing AI Engine already used throughout Reel-Quick.

The backend generates a prompt containing the information collected during previous wizard steps.

Typical inputs include:

  • niche
  • trend name
  • Reel title
  • video concept
  • core message
  • emotional tone
  • visual style
  • B-roll requirements
  • language
  • platform
  • orientation
  • maximum results

Instead of asking users to invent search terms themselves, GPT performs that reasoning.


AI Prompt Responsibilities

The prompt instructs GPT to behave as a media research assistant.

Its responsibilities include:

  • understand the narrative
  • identify visual themes
  • generate search phrases
  • search only trusted royalty-free libraries
  • avoid fabricated information
  • verify licensing whenever possible
  • return structured JSON

This moves the intelligence from the user into the application.


Supported Video Sources

The implementation focuses on well-known media libraries commonly used by content creators.

Current supported sources include:

  • Pexels
  • Pixabay
  • Mixkit
  • Coverr
  • Videvo
  • Wikimedia Commons

These platforms provide a large collection of reusable stock footage suitable for social media production.


Why Structured JSON Matters

Instead of returning free-form text, the AI produces validated JSON.

A simplified structure looks like this:

{
  "wizard_id": "...",
  "query": {},
  "search_terms": [],
  "videos": [],
  "warnings": []
}
Enter fullscreen mode Exit fullscreen mode

Each video contains structured metadata such as:

  • title
  • source
  • page URL
  • creator
  • duration
  • orientation
  • visual tags
  • recommended usage
  • licensing information
  • relevance score

This allows the frontend to display results immediately while giving later wizard steps machine-readable data.


Built-in Safety Checks

One challenge with AI-generated search results is preventing hallucinations.

The prompt explicitly tells GPT to never invent:

  • URLs
  • creators
  • filenames
  • licenses
  • attribution requirements

If license verification cannot be confirmed, the response marks:

license_verified = false
Enter fullscreen mode Exit fullscreen mode

instead of guessing.

This creates a much more reliable workflow for commercial content creators.


Backend Validation

Even with structured AI responses, validation is still essential.

The backend validates:

  • maximum of 10 results
  • valid URLs
  • duplicate URLs
  • duplicate identifiers
  • supported orientations
  • required fields
  • relevance score range
  • Boolean license properties

Invalid responses never proceed directly into the workflow.


Workflow

The complete pipeline now looks like this.

User Selects Reel
        │
        ▼
Load Visual Requirements
        │
        ▼
Generate AI Prompt
        │
        ▼
Existing AI Engine
        │
        ▼
GPT Media Search
        │
        ▼
JSON Validation
        │
        ▼
License Verification
        │
        ▼
Save Results
        │
        ▼
Display Video Options
Enter fullscreen mode Exit fullscreen mode

This transforms media discovery from a manual activity into an automated workflow stage.


Tracking Research Status

Each search request maintains its own lifecycle.

pending
processing
completed
completed_with_warnings
failed
Enter fullscreen mode Exit fullscreen mode

This makes it easier to:

  • retry failed searches
  • debug AI responses
  • monitor long-running operations
  • expose progress within the UI

Debug Information

When something goes wrong, developers need more than a generic error.

The implementation stores useful diagnostic information such as:

  • raw AI response
  • JSON validation errors
  • inaccessible URLs
  • duplicate results
  • missing license information
  • prompt version
  • AI model used

This significantly improves troubleshooting and future prompt refinement.


Benefits for Creators

The new workflow offers several advantages.

Instead of manually searching multiple websites, creators receive a curated list of relevant footage that already matches the intended story.

Benefits include:

  • faster content production
  • fewer context switches
  • better visual consistency
  • reduced copyright risk
  • reusable search results
  • production-ready structured data
  • smoother wizard experience

Most importantly, creators can stay focused on storytelling instead of repetitive searching.


What's Next?

This implementation lays the foundation for future workflow automation.

Possible future enhancements include:

  • automatic media import
  • one-click download
  • scene-to-clip matching
  • AI clip ranking
  • timeline generation
  • automatic Reel assembly
  • transition recommendations
  • music synchronization
  • caption placement
  • multi-platform optimization

The long-term goal is to move from "idea generation" to fully automated Reel production.


Final Thoughts

Generative AI is often associated with writing scripts or generating captions, but some of its greatest value comes from orchestrating workflows.

By teaching the Reel Wizard how to discover relevant, royalty-free footage, we eliminate one of the most repetitive parts of short-form video production.

Instead of jumping between multiple stock-video websites, creators receive curated, structured, and reusable search results that integrate directly into the rest of the production pipeline.

This is another step toward making AI not just creative, but genuinely productive.


Repository

https://github.com/ronin1770/reel-quick

Implementation Issue

https://github.com/ronin1770/reel-quick/issues/18

Top comments (0)