Skip to content

lucky0612/fibo-hack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🎬 FIBO CINEMATICS STUDIO

What if AI could think like a real cinema crew?

Version Bria.ai CrewAI License

Professional AI-Powered Cinematography Platform

Built for FIBO Hackathon 2025

Watch Demo • Try It OutRead the Story


🎭 The Story

I love filmmaking. I love AI. But I had a problem.

Every AI image generator I tried created beautiful images. Stunning, even. But they didn't understand cinematography. They didn't know why Spielberg shoots from below to make heroes feel powerful. They didn't understand why Denis Villeneuve uses 24mm lenses to create isolation. They just... generated.

And when you wanted to change something? Re-prompt and pray. Maybe it works. Maybe it doesn't. Maybe your whole composition changes and you lose what made the shot great in the first place.

That's not how real filmmaking works.

On a real film set, you have a Director who defines the emotional core. You have a DP who translates that into technical camera specs. You have a Gaffer who designs the lighting. You have an Editor who ensures continuity.

So I asked: What if we taught AI to work the same way?

What if instead of throwing prompts at an AI and hoping, we built a cinema crew that thinks like professionals? Each agent with its own expertise. Each focused on their craft. All working together to create something intentional.

That's FIBO Cinematics Studio.

And it changes everything.


✨ What Makes This Different

🎬 A Real Cinema Crew (CrewAI Multi-Agent System)

Four AI agents. Each with decades of virtual experience:

Director AgentThe Visionary

  • Defines emotional core and mood
  • Chooses visual language and color palette
  • Asks: "What is this shot trying to say?"
  • Example thinking: "Mystery, isolation, wonder - let's use desaturated blues with a warm key light for hope"

DP AgentThe Technician

  • Specifies exact camera specs
  • Camera angle: low-angle, eye-level, overhead, dutch
  • Focal length: 14mm wide to 200mm telephoto
  • Depth of field: f/1.4 shallow to f/22 deep
  • Example thinking: "Wide shot needs 24mm lens for environmental context, f/8 for sharpness"

Gaffer AgentThe Light Sculptor

  • Designs complete lighting setups
  • Direction: 45-degree key, side, back, overhead
  • Quality: hard vs soft shadows
  • Color temperature: 3200K tungsten to 7000K+ daylight
  • Example thinking: "Low-key noir style: single hard side light at 3200K, dramatic shadows"

Editor AgentThe Synthesizer

  • Takes all creative and technical decisions
  • Assembles into production-ready FIBO JSON
  • Ensures continuity and shot flow
  • Outputs perfectly structured prompts

This isn't prompt engineering. This is programmatic cinematography.

🎯 True Parameter Disentanglement

Here's the killer feature that makes judges go "holy shit":

Want to change the camera angle? Change JUST the camera angle.
Same scene. Same composition. Same lighting. Same seed. Only the angle changes.

Want to modify the lighting direction? Change JUST the lighting.
Everything else stays identical. The camera work? Unchanged. The composition? Perfect.

Demo this and watch jaws drop.

Original Shot: eye-level | 50mm | front lighting
↓
Modify camera angle to "low-angle"
↓
New Shot: low-angle | 50mm | front lighting
→ Hero looks powerful, but composition identical

Modify lighting to "back"
↓
Newer Shot: low-angle | 50mm | back lighting
→ Dramatic silhouette, camera angle stays

This is the power of FIBO's disentanglement. And we demonstrate it perfectly.

💎 16-Bit HDR Color Grading Pipeline

Every shot automatically goes through professional post-production:

8-bit Standard Output from Bria.ai

Convert to 16-bit (0-65535 range)

Apply Cinematic Color Grading

  • Exposure adjustment in stops (2^x multiplier)
  • Contrast curves around midpoint (0.5)
  • Saturation with luminance preservation
  • Color temperature via channel shifts
  • Professional tone mapping


Export Multiple Formats

  • 16-bit TIFF → DaVinci Resolve, Nuke
  • 16-bit PNG → After Effects, universal
  • 8-bit JPEG → Web preview (Reinhard tone mapped)
  • Before/After comparison with labels

This is the same color science professional colorists use.

Not filters. Not Instagram presets. Real math. Real color science.

🎨 Built for Professionals

Cinematic Dark Interface

  • Film grain texture overlay (animated SVG)
  • Professional color palette (blacks, grays, gold accents)
  • Typography: Inter for UI, JetBrains Mono for code
  • No cartoony elements, no "consumer app" feel

Keyboard Shortcuts (coming soon)

  • C → Create shot
  • L → Library
  • E → Export
  • Cmd+K → Quick commands

Shot Library

  • Complete metadata (seeds, parameters, timestamps)
  • Reproducible generation
  • Version tracking
  • Notes and tags

Professional Exports

  • Formats cinematographers actually use
  • Ready for real post-production workflows
  • DaVinci Resolve, Premiere, Final Cut Pro compatible

🏗️ Architecture (For the Technical Judges)

┌─────────────────────────────────────────────────────────────────┐
│                  FRONTEND • React + Vite                         │
│  • Cinematic UI with CSS film grain animation                   │
│  • Framer Motion for smooth transitions                         │
│  • Real-time shot preview with lazy loading                     │
│  • Virtual camera controls with live feedback                   │
│  • Shot library with infinite scroll                            │
└────────────────────────┬────────────────────────────────────────┘
                         │ REST API (async)
┌────────────────────────┴────────────────────────────────────────┐
│                  BACKEND • FastAPI (Python 3.11)                │
├─────────────────────────────────────────────────────────────────┤
│  🎬 CINEMA CREW (CrewAI)                                        │
│     ├── Director Agent → LLM: Groq Llama 3.3 70B               │
│     ├── DP Agent → Technical cinematography knowledge          │
│     ├── Gaffer Agent → Professional lighting design            │
│     └── Editor Agent → JSON synthesis & continuity             │
│                                                                  │
│  Sequential Workflow:                                           │
│  User Input → Director → DP → Gaffer → Editor → FIBO JSON     │
├─────────────────────────────────────────────────────────────────┤
│  🎨 BRIA FIBO CLIENT                                            │
│     ├── Direct v2 API integration (NOT FAL.AI)                 │
│     ├── Structured prompt generation (/v2/structured_prompt)   │
│     ├── Image generation with async polling                    │
│     ├── Parameter refinement with seed consistency             │
│     └── Batch generation for storyboards                       │
├─────────────────────────────────────────────────────────────────┤
│  💎 HDR PIPELINE (OpenCV + colour-science)                     │
│     ├── 16-bit color space conversion                          │
│     ├── Exposure stops (2^x multiplier)                        │
│     ├── Contrast curves (S-curve around 0.5)                   │
│     ├── Saturation (luminance-preserving)                      │
│     ├── Temperature shifts (R/B channel adjustment)            │
│     ├── Reinhard tone mapping for 8-bit preview                │
│     └── Multi-format export (TIFF, PNG, JPEG)                  │
└─────────────────────────────────────────────────────────────────┘
                         │
                         ▼
          ┌──────────────────────────────┐
          │   Bria.ai FIBO API (v2)      │
          │   JSON-Native Endpoints      │
          │   Parameter Disentanglement  │
          └──────────────────────────────┘

Why This Architecture Wins:

  1. Direct Bria.ai Integration: We use v2 endpoints directly, not FAL.AI
  2. Most Sophisticated Multi-Agent: 4 specialized agents with distinct roles
  3. Production-Grade Color Science: Real 16-bit processing, not fake HDR
  4. Async Everything: Non-blocking generation, background HDR processing
  5. Scalable: Ready for PostgreSQL, Celery, Redis, S3

🚀 Quick Start

Prerequisites

# Check your versions
python --version  # Need 3.11+
node --version    # Need 18+

You'll need:

Backend Setup (5 minutes)

# Clone the repo
git clone https://github.com/yourusername/fibo-cinematics-studio.git
cd fibo-cinematics-studio/backend

# Mac M1/M2 setup (ARM architecture)
brew install miniforge
conda create --name fibo-cinema python=3.11 -y
conda activate fibo-cinema
conda install -c conda-forge numpy opencv pillow -y

# Install dependencies
pip install fastapi uvicorn[standard] crewai python-dotenv
pip install Pillow opencv-python imageio colour-science
pip install python-multipart requests aiofiles pydantic

# Configure API keys
cp .env.example .env
# Edit .env with your keys

# Start server
python main.py

Backend running at: http://localhost:8000
API docs at: http://localhost:8000/docs

Frontend Setup (3 minutes)

cd ../frontend

# Install dependencies
npm install --legacy-peer-deps

# Start dev server
npm run dev

Frontend running at: http://localhost:5173

First Shot (2 minutes)

  1. Open http://localhost:5173
  2. Describe your scene: "Astronaut discovering alien artifact on Mars at sunset"
  3. Choose: Wide shot, 16:9, Dramatic color grade
  4. Click "Generate Cinematic Shot"
  5. Wait 60-120 seconds
  6. Mind = Blown 🤯

🎮 How to Use

Creating Your First Masterpiece

Step 1: Describe Your Vision

Don't just describe what you see. Describe what you feel:

❌ "A person in a room"
✅ "A lonely detective in a rain-soaked noir office at night,
    single desk lamp casting dramatic shadows, cigarette smoke
    drifting through venetian blinds"

Step 2: Choose Your Shot Type

Each has meaning:

  • Extreme Wide Shot: Establish environment, show isolation
  • Wide Shot: Context + subject, environmental storytelling
  • Medium Shot: Conversation, natural feel
  • Close-Up: Emotion, detail, intimacy
  • Extreme Close-Up: Intensity, specific details

Step 3: Let the Crew Work

Watch as:

  1. Director defines the emotional core
  2. DP chooses camera specs (angle, lens, DOF)
  3. Gaffer designs the lighting
  4. Editor synthesizes into FIBO JSON
  5. Bria.ai generates your vision
  6. HDR pipeline color grades in 16-bit

Step 4: Refine with Precision

Now the magic happens:

Original: eye-level | 50mm lens | front lighting

Want it more dramatic?
→ Change camera to "low-angle"
→ Same composition, different power dynamic

Want film noir mood?
→ Change lighting to "side"
→ Same framing, dramatic shadows

Want telephoto compression?
→ Change lens to "85mm portrait"
→ Same scene, different spatial feel

Each change modifies ONLY that parameter. That's the power.


🎨 HDR Presets Explained

Neutral

Use for: Documentation, versatile base, client reviews

Exposure: 0.0 stops
Contrast: 1.0x
Saturation: 1.0x
Temperature: 0.0

Clean, balanced, true to generation.

Warm (Golden Hour)

Use for: Romantic scenes, nostalgia, comfort

Exposure: +0.1 stops (slightly brighter)
Contrast: 1.0x
Saturation: 1.0x
Temperature: +0.15 (warmer, golden)

That magic hour feeling.

Cool (Sci-Fi)

Use for: Futuristic, clinical, mystery

Exposure: 0.0
Contrast: 1.0x
Saturation: 0.9x (slightly desaturated)
Temperature: -0.15 (cooler, blue tones)

Blade Runner vibes.

Dramatic (Thriller)

Use for: Intensity, conflict, action

Exposure: -0.1 stops (slightly darker)
Contrast: 1.3x (punchy!)
Saturation: 1.0x
Temperature: 0.0

Christopher Nolan style.

Vintage (Period Pieces)

Use for: Memories, 70s/80s aesthetic

Exposure: 0.0
Contrast: 1.0x
Saturation: 0.7x (desaturated)
Temperature: +0.1 (slightly warm)

Film photography nostalgia.

Noir (Classic Film)

Use for: Mystery, classic film, dramatic

Exposure: -0.1 stops
Contrast: 1.4x (very punchy!)
Saturation: 0.3x (nearly B&W)
Temperature: 0.0

Citizen Kane. The Maltese Falcon. That vibe.


🏆 Why We Win All Four Categories

✅ Best Overall Submission

Complete Production Pipeline:

  • ✓ Multi-agent AI system (4 specialized agents)
  • ✓ Direct Bria.ai FIBO integration (v2 API)
  • ✓ 16-bit HDR color grading (real color science)
  • ✓ Professional exports (TIFF, PNG for post)
  • ✓ Shot library with full metadata
  • ✓ Reproducible generation (seeds + parameters)

This isn't a demo. It's a production tool.

✅ Best Controllability

True Parameter Disentanglement:

  • ✓ Change camera angle independently
  • ✓ Modify lighting direction alone
  • ✓ Adjust lens focal length in isolation
  • ✓ Change depth of field precisely
  • ✓ Alter color scheme without affecting composition

Demo Strategy:

  1. Generate one shot
  2. Change camera angle → Show only angle changed
  3. Change lighting → Show only lighting changed
  4. Display before/after/after in grid
  5. Judges' minds = blown

✅ Best JSON-Native/Agentic Workflow

Most Sophisticated Multi-Agent System:

  • ✓ 4 specialized CrewAI agents
  • ✓ Sequential workflow with clear handoffs
  • ✓ Each agent has distinct expertise
  • ✓ Generates complete FIBO structured JSON
  • ✓ Every field intentionally populated

Example Agent Output:

{
  "short_description": "lonely astronaut discovers ancient alien monolith...",
  "objects": [
    {
      "description": "astronaut in orange NASA suit",
      "location": "right third of frame",
      "relative_size": "medium, human scale",
      "texture": "reflective fabric, dusty from Mars surface",
      "pose": "reaching towards artifact, sense of wonder"
    }
  ],
  "photographic_characteristics": {
    "camera_angle": "low-angle",
    "lens_focal_length": "24mm wide angle",
    "depth_of_field": "deep, f/8 for environmental context",
    "focus_area": "artifact in foreground, astronaut sharp"
  }
}

Every parameter is intentional. That's agentic thinking.

✅ Best UX/Professional Tool

Built for Filmmakers:

  • ✓ Cinematic dark interface (not consumer app feel)
  • ✓ Film grain texture (animated, authentic)
  • ✓ Professional color palette (blacks, grays, gold)
  • ✓ Shot library with search/filter
  • ✓ Complete metadata tracking
  • ✓ Keyboard shortcuts (coming soon)
  • ✓ Export manager for multiple formats
  • ✓ Before/after HDR comparisons
  • ✓ Parameter controls that make sense

Design Philosophy:

"If a professional cinematographer wouldn't use it, we didn't build it."


🔬 Technical Deep Dive

How the Cinema Crew Works

User Input:

"A lonely detective in a rain-soaked noir office at night"

Director Agent thinks:

"Mystery, isolation, melancholy. Classic noir aesthetic.
Visual language: High contrast, dramatic shadows.
Color palette: Desaturated with warm key light for hope.
Mood: Tension, waiting, introspection."

DP Agent thinks:

"Noir requires specific camera work.
Camera angle: Slightly high angle (vulnerability).
Lens: 35mm for environmental context + subject.
Depth of field: f/2.8, blur background for isolation.
Frame: Rule of thirds, negative space."

Gaffer Agent thinks:

"Classic noir lighting: Single source dramatic.
Direction: 45-degree key light from window.
Quality: Hard light through venetian blinds.
Color temperature: 3200K warm tungsten.
Shadow: Deep, dramatic falloff."

Editor Agent synthesizes:

{
  "short_description": "Noir detective in rain-soaked office...",
  "lighting": {
    "conditions": "single hard source, dramatic contrast",
    "direction": "45-degree from left, window light",
    "shadow": "deep, long shadows across desk"
  },
  "photographic_characteristics": {
    "camera_angle": "slightly high angle",
    "lens_focal_length": "35mm",
    "depth_of_field": "shallow, f/2.8"
  }
}

This is how real cinematographers think. Now AI does too.

The HDR Color Science

Input: 8-bit RGB image (0-255 per channel)

Step 1: Convert to 16-bit

img_16bit = (img_8bit.astype(np.float32) / 255.0) * 65535
# Now we have 16-bit color depth (0-65535)

Step 2: Apply Exposure (in stops)

exposure_multiplier = 2 ** exposure_stops
img_exposed = np.clip(img_16bit * exposure_multiplier, 0, 65535)
# Exposure +1.0 = 2x brighter, -1.0 = 0.5x darker

Step 3: Contrast Curve

normalized = img_exposed / 65535.0
contrasted = ((normalized - 0.5) * contrast + 0.5)
img_contrasted = np.clip(contrasted * 65535, 0, 65535)
# S-curve around midpoint

Step 4: Saturation (Luminance-Preserving)

luminance = (0.299*R + 0.587*G + 0.114*B)
img_saturated = luminance + saturation * (img_contrasted - luminance)
# Preserve perceived brightness

Step 5: Temperature Shift

img_temp = img_saturated.copy()
img_temp[:,:,0] *= (1 + temperature)  # Red channel
img_temp[:,:,2] *= (1 - temperature)  # Blue channel
# Positive = warmer, negative = cooler

Step 6: Export

# 16-bit TIFF (professional)
cv2.imwrite('shot_16bit.tiff', img_temp.astype(np.uint16))

# Tone-mapped 8-bit preview (Reinhard)
preview_8bit = (img_temp / (img_temp + 65535)) * 255

This is the same math used in DaVinci Resolve and Premiere.

Performance Optimizations

Async Everything:

@app.post("/api/shots/create")
async def create_shot(...):
    # Generate shot (60-120s)
    shot = await bria_client.generate_image(...)

    # Process HDR in background
    background_tasks.add_task(
        hdr_pipeline.process_shot,
        shot.image_url,
        shot.shot_id
    )

    # Return immediately
    return {"shot": shot}

Smart Caching:

  • Structured prompts cached by hash
  • Seeds stored for reproducibility
  • HDR presets pre-computed for common configs

Lazy Loading:

  • Shot library loads 20 at a time
  • Images lazy-loaded on scroll
  • Thumbnails generated on-demand

📁 Project Structure

fibo-cinematics-studio/
├── backend/                      # FastAPI server
│   ├── main.py                   # Server + all endpoints (500+ lines)
│   ├── .env                      # API keys (gitignored)
│   ├── .env.example              # Template
│   │
│   ├── api/
│   │   └── bria_client.py        # Bria.ai API client (250+ lines)
│   │       ├── generate_structured_prompt()
│   │       ├── generate_image()
│   │       ├── refine_image()
│   │       └── batch_generate()
│   │
│   ├── agents/
│   │   └── cinema_crew.py        # 4-agent system (400+ lines)
│   │       ├── DirectorAgent
│   │       ├── DPAgent
│   │       ├── GafferAgent
│   │       ├── EditorAgent
│   │       ├── create_single_shot()
│   │       └── create_storyboard()
│   │
│   ├── models/
│   │   ├── shot.py               # Shot data model
│   │   │   ├── shot_id, seed, timestamps
│   │   │   ├── structured_prompt (JSON)
│   │   │   ├── image_url, local paths
│   │   │   └── hdr_comparison_path
│   │   │
│   │   └── storyboard.py         # Storyboard model
│   │       ├── List[Shot]
│   │       ├── add_shot()
│   │       └── reorder_shots()
│   │
│   ├── utils/
│   │   └── hdr_pipeline.py       # 16-bit processing (300+ lines)
│   │       ├── convert_to_16bit()
│   │       ├── apply_cinematic_grade()
│   │       ├── export_formats()
│   │       └── create_comparison()
│   │
│   └── outputs/
│       ├── shots/                # Generated images
│       ├── storyboards/          # Multi-shot JSON
│       └── hdr/                  # 16-bit exports
│
├── frontend/                     # React + Vite
│   ├── src/
│   │   ├── components/
│   │   │   ├── ShotCreator.jsx   # Creation form
│   │   │   ├── CameraControl.jsx # Parameter controls
│   │   │   ├── ShotLibrary.jsx   # Gallery view
│   │   │   └── ShotComparison.jsx # HDR before/after
│   │   │
│   │   ├── lib/
│   │   │   └── api.js            # Backend client
│   │   │
│   │   ├── App.jsx               # Main app
│   │   ├── App.css               # Styles
│   │   └── index.css             # Global styles + film grain
│   │
│   ├── package.json
│   └── vite.config.js
│
├── docs/
│   ├── demo-script.md            # Video script
│   ├── DEVPOST-SUBMISSION.md     # Submission guide
│   ├── FINAL-CHECKLIST.md        # Launch checklist
│   └── screenshots/              # For submission
│
├── README.md                     # This file
├── .gitignore
└── github-setup.sh              # Automated git setup

🛠️ Development

Adding New Agents

Want a Sound Designer agent?

# agents/cinema_crew.py
sound_agent = Agent(
    role="Sound Designer",
    goal="Design the sonic atmosphere of the scene",
    backstory="""You're an Oscar-winning sound designer with
    20 years of experience. You understand how sound shapes emotion.""",
    verbose=True,
    allow_delegation=False,
    llm=self.llm
)

# Add to workflow
director_taskdp_taskgaffer_tasksound_taskeditor_task

Creating New HDR Presets

# utils/hdr_pipeline.py
'cyberpunk': {
    'exposure': 0.2,        # Slightly brighter
    'contrast': 1.4,        # Punchy
    'saturation': 1.3,      # Vibrant neons
    'temperature': -0.2     # Cool, blue tones
}

Custom API Endpoints

# main.py
@app.post("/api/shots/{shot_id}/storyboard")
async def add_to_storyboard(shot_id: str, storyboard_id: str):
    shot = shots_db[shot_id]
    storyboard = storyboards_db[storyboard_id]
    storyboard.add_shot(shot)
    return {"success": True}

🚧 Roadmap

Phase 1: Post-Hackathon (Week 1-2)

  • Multi-shot storyboard creator UI
  • Timeline view with drag-and-drop
  • Shot reordering and sequencing
  • Export storyboard to PDF
  • More HDR presets (Hollywood, Cyberpunk, etc.)

Phase 2: Production Ready (Month 1)

  • 3D camera visualizer (Three.js)
  • User authentication & accounts
  • Database persistence (PostgreSQL)
  • Cloud storage (S3) for shots
  • API rate limiting
  • Custom agent training

Phase 3: Professional Features (Month 2-3)

  • Real-time collaboration
  • Shot matching AI (find similar cinematography)
  • Script breakdown automation
  • Premiere/FCP plugin integration
  • Batch generation (1000+ shots)
  • Custom workflow automation

Phase 4: Platform (Month 4+)

  • Marketplace for presets & agents
  • Community shot library
  • Video generation from storyboards
  • Mobile app (iOS/Android)
  • Virtual production pipeline
  • Enterprise SSO & team accounts

Vision: Make FIBO Cinematics Studio the industry standard for AI-assisted cinematography.


📸 Gallery

What Our Users Create

Coming soon: Stunning shots from beta testers

Before/After HDR Comparisons

Coming soon: Side-by-side quality improvements

Parameter Isolation Demos

Coming soon: Same scene, different parameters


📄 License

MIT License - Built for FIBO Hackathon 2025


🙏 Acknowledgments

This wouldn't exist without:

  • Bria.ai - For creating FIBO and believing in AI for creativity
  • CrewAI - For making multi-agent systems actually work
  • OpenCV Community - For the color science foundation
  • FastAPI Team - For making Python backends beautiful
  • React Team - For the best frontend framework

📞 Connect

Built by: [Lakshya Raj Vijay]

Project Links:


💬 Final Thoughts

I built FIBO Cinematics Studio because I believe AI should augment creativity, not replace it.

Cinematographers spend years learning their craft. The way light falls. How lenses compress space. Why certain angles create certain emotions. That knowledge is valuable. It's art.

But AI can help. It can handle the technical execution while the artist focuses on vision. It can iterate quickly so ideas flow freely. It can democratize access to professional tools without diminishing professional expertise.

That's the future I want to build.

Not AI that replaces cinematographers. But AI that makes every storyteller a cinematographer.

If this resonates with you, star this repo. If you want to collaborate, reach out. If you have ideas, open an issue.

Let's build the future of visual storytelling. Together.


🎬 "Lights. Camera. AI. Action." 🎬

Made with ❤️ and lots of ☕️ for FIBO Hackathon 2025

Star this repo if you believe in AI for creativity


🔥 One More Thing...

If you're a judge reading this: Thank you.

Thank you for taking the time. Thank you for believing in innovation. Thank you for supporting creators who want to push boundaries.

This isn't just a hackathon project to me. It's a vision of how AI and human creativity can work together. It's proof that we can build tools that respect craft while enabling innovation.

I hope you're as excited about this as I am. 🚀

Now go create something amazing. 🎬✨

About

fibo cinematics studio hackathon submission

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors