An open-source, privacy-first web application for generating AI videos with OpenAI Sora 2
A beautiful, frontend-heavy web application that lets you generate stunning AI videos with OpenAI Sora 2. All video processing happens in your browser - no server uploads, no data collection.
- π¨ AI Prompt Planning: Get AI-generated segment plans for complex video sequences
- ποΈ Frame Continuity: Automatic frame-to-frame continuity between segments using
input_referencefrom Sora 2 API - π Multiple Aspect Ratios: Landscape (16:9) and Portrait (9:16) formats with standard and Pro resolutions
- π Privacy-First: Your API key and videos never leave your device
- β‘ Client-Side Processing: All video concatenation happens in your browser using FFmpeg.wasm
- π― Zero Backend: Minimal serverless Edge Functions for CORS proxy only
- π Real-Time Progress: Live progress tracking for each video segment
- π± Mobile Detection: Automatic warnings for mobile devices with memory limits
- πΎ Memory Management: Built-in memory estimation and warnings
- π Modern UI: Beautiful, responsive interface with glassmorphism effects and smooth animations
- React 19 + TypeScript
- Zustand - Lightweight state management
- FFmpeg.wasm - Client-side video processing
- HTML5 Canvas API - Frame extraction for continuity
- Axios - HTTP client with multipart/form-data support
- Plyr - Video player
- TailwindCSS v4 - Modern styling with glassmorphism effects
- Vercel Edge Functions - Serverless CORS proxy
npm installFor full functionality with Edge Functions (required for API proxying):
npm run dev:vercelFor basic frontend development only:
npm run devNote: You must use npm run dev:vercel to test video generation, as it requires Vercel Edge Functions for the CORS proxy.
npm run build- Enter your OpenAI API key (starts with
sk-proj-) - Choose generation mode:
- Quick Generate: Use a single prompt for all segments
- π¨ Plan with AI: Get AI-generated segment breakdowns for complex videos
- Write your video prompt - Be creative and descriptive!
- Configure video settings:
- Segment Duration: 4, 8, or 12 seconds per segment
- Number of Segments: 1-10 segments (total duration = duration Γ segments)
- Resolution & Orientation:
- Landscape: 720p (1280x720) or 1024p Pro (1792x1024)
- Portrait: 720x1280 or 1024x1792 (Pro)
- Generate your video - Watch real-time progress for each segment
- Preview, download, or generate new!
npm install -g vercel
vercel --prodYour app will be live at https://your-app.vercel.app
Browser β sessionStorage β Edge Function β OpenAI API β Browser β FFmpeg.wasm β Download
- Edge Functions handle CORS (simple pass-through proxy)
- FFmpeg.wasm concatenates videos in the browser
- Frame Extraction uses HTML5 Canvas API to extract last frame from each segment
- Frame Continuity passes extracted frames as
input_referenceto subsequent segments - No databases, no Redis, no backend infrastructure!
- First Segment: Generated without any reference frame
- Extract Frame: After downloading each segment (except the last), the last frame is extracted using Canvas API
- Next Segment: The extracted frame is passed as
input_referenceto ensure visual continuity - Result: Smooth transitions between video segments, mimicking a single continuous video
This technique is inspired by the Sora 2 API documentation and ensures professional-looking extended videos.
- API keys stored in sessionStorage (cleared on tab close)
- Videos processed locally (never uploaded)
- HTTPS only
- COOP/COEP headers for SharedArrayBuffer
- Desktop browsers recommended (mobile has memory limits)
- Max 10 segments
- Memory warning at 1.5GB
- FFmpeg takes 5-10s to load initially
The app implements Sora 2's frame continuity feature for seamless video transitions:
Key Files:
src/utils/videoFrameExtractor.ts- Extracts last frame using Canvas APIsrc/services/openaiService.ts- Handles multipart/form-data for image uploadsapi/proxy-create-video.ts- Edge Function supporting both JSON and FormDatasrc/App.tsx- Orchestrates the frame extraction and continuity flow
Flow:
- Download completed video segment as Blob
- Create HTML5
<video>element and load the blob - Seek to last frame (duration - 0.1s)
- Draw frame to Canvas with matching dimensions
- Convert Canvas to JPEG Blob (95% quality)
- Pass Blob as
inputReferenceto next segment's API call - Edge Function forwards as
input_referencein multipart/form-data
Performance:
- Frame extraction takes ~100-500ms per video
- JPEG compression maintains high quality at smaller size
- Canvas operations are GPU-accelerated in modern browsers
The app uses these Sora 2 endpoints:
POST /v1/videos- Create video generation job (supportsinput_reference)GET /v1/videos/{id}- Poll job status and progressGET /v1/videos/{id}/content- Download completed video
Supported Parameters:
model:sora-2orsora-2-proseconds:"4","8", or"12"(string format required)size: Landscape (1280x720, 1792x1024) or Portrait (720x1280, 1024x1792)input_reference: Image blob for frame continuity (multipart/form-data)
FFmpeg won't load: Check COOP/COEP headers in vercel.json API key not saving: Not in private/incognito mode? Videos fail: Verify Sora 2 API access Browser crashes: Reduce segments or use 720p Frame extraction fails: Ensure browser supports Canvas API (all modern browsers do)
We welcome contributions! This is an open-source project, and we'd love your help to make it better.
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
- Follow the existing code style
- Add comments for complex logic
- Test your changes thoroughly
- Update documentation as needed
This project is open source and available under the MIT License.
- Built with OpenAI Sora 2 API
- Video processing powered by FFmpeg.wasm
- UI components inspired by modern design principles
- Issues: Found a bug? Open an issue
- Discussions: Have questions? Start a discussion
- Twitter: Follow for updates
If you find this project useful, please consider giving it a star! It helps others discover the project.
Made with β€οΈ by the open source community
