8.9 KiB
8.9 KiB
Social Optimizer Implementation Plan
Overview
Social Optimizer creates platform-optimized versions of videos for Instagram, TikTok, YouTube, LinkedIn, Facebook, and Twitter with one click. Reuses Transform Studio processors for aspect ratio conversion, trimming, and compression.
Features
Core Features (FFmpeg-based - Can Start Immediately)
-
Platform Presets
- Instagram Reels (9:16, max 90s, 4GB)
- TikTok (9:16, max 60s, 287MB)
- YouTube Shorts (9:16, max 60s, 256GB)
- LinkedIn Video (16:9, max 10min, 5GB)
- Facebook (16:9 or 1:1, max 240s, 4GB)
- Twitter/X (16:9, max 140s, 512MB)
-
Aspect Ratio Conversion
- Auto-crop to platform ratio (reuse Transform Studio
convert_aspect_ratio) - Smart cropping (center, face detection)
- Letterboxing/pillarboxing
- Auto-crop to platform ratio (reuse Transform Studio
-
Duration Trimming
- Auto-trim to platform max duration
- Smart trimming options (keep beginning, middle, end)
- User-selectable trim points
-
File Size Optimization
- Compress to meet platform limits (reuse Transform Studio
compress_video) - Quality presets per platform
- Bitrate optimization
- Compress to meet platform limits (reuse Transform Studio
-
Thumbnail Generation
- Extract frames from video (FFmpeg)
- Generate multiple thumbnails (start, middle, end)
- Custom thumbnail selection
-
Batch Export
- Generate optimized versions for multiple platforms simultaneously
- Progress tracking per platform
- Individual or bulk download
Advanced Features (Phase 2)
-
Caption Overlay
- Auto-caption generation (speech-to-text API needed)
- Platform-specific caption styles
- Safe zone overlays
-
Safe Zone Visualization
- Show text-safe areas per platform
- Visual overlay in preview
- Platform-specific guidelines
Platform Specifications
| Platform | Aspect Ratio | Max Duration | Max File Size | Formats | Resolution |
|---|---|---|---|---|---|
| Instagram Reels | 9:16 | 90s | 4GB | MP4 | 1080x1920 |
| TikTok | 9:16 | 60s | 287MB | MP4, MOV | 1080x1920 |
| YouTube Shorts | 9:16 | 60s | 256GB | MP4, MOV, WebM | 1080x1920 |
| 16:9, 1:1 | 10min | 5GB | MP4 | 1920x1080 or 1080x1080 | |
| 16:9, 1:1 | 240s | 4GB | MP4, MOV | 1920x1080 or 1080x1080 | |
| Twitter/X | 16:9 | 140s | 512MB | MP4 | 1920x1080 |
Technical Implementation
Backend Structure
backend/services/video_studio/
├── social_optimizer_service.py # Main service
└── platform_specs.py # Platform specifications
Reuse from Transform Studio:
convert_aspect_ratio()- For aspect ratio conversioncompress_video()- For file size optimizationscale_resolution()- For resolution scaling (if needed)
New Functions Needed:
trim_video()- Trim video to platform durationextract_thumbnail()- Generate thumbnails from videobatch_process()- Process multiple platforms in parallel
Frontend Structure
frontend/src/components/VideoStudio/modules/SocialVideo/
├── SocialVideo.tsx # Main component
├── components/
│ ├── VideoUpload.tsx # Shared upload
│ ├── PlatformSelector.tsx # Platform checkboxes
│ ├── OptimizationOptions.tsx # Options panel
│ ├── PreviewGrid.tsx # Platform previews
│ └── BatchProgress.tsx # Progress tracking
└── hooks/
└── useSocialVideo.ts # State management
API Endpoint
POST /api/video-studio/social/optimize
Request Parameters:
{
file: File, // Source video
platforms: string[], // ["instagram", "tiktok", "youtube", ...]
options: {
auto_crop: boolean, // Auto-crop to platform ratio
generate_thumbnails: boolean, // Generate thumbnails
add_captions: boolean, // Add caption overlay (Phase 2)
compress: boolean, // Compress for file size limits
trim_mode: "beginning" | "middle" | "end", // Where to trim if needed
}
}
Response:
{
success: boolean,
results: [
{
platform: "instagram",
video_url: string,
thumbnail_url: string,
aspect_ratio: "9:16",
duration: number,
file_size: number,
},
// ... one per selected platform
],
cost: 0, // Free (FFmpeg processing)
}
Implementation Phases
Phase 1: Core Features (Week 1-2)
-
Platform Specifications
- Define platform specs (aspect, duration, file size)
- Create
platform_specs.pywith all platform data
-
Backend Service
- Create
social_optimizer_service.py - Implement batch processing
- Reuse Transform Studio processors
- Add thumbnail extraction
- Create
-
Backend Endpoint
- Create
/api/video-studio/social/optimizeendpoint - Handle batch processing
- Return results for all platforms
- Create
-
Frontend UI
- Platform selector (checkboxes)
- Options panel
- Preview grid
- Batch progress tracking
- Download buttons (individual + bulk)
Phase 2: Advanced Features (Week 3-4)
-
Caption Overlay
- Speech-to-text integration (may need external API)
- Caption styling per platform
- Safe zone visualization
-
Enhanced Thumbnails
- Multiple thumbnail options
- Custom thumbnail selection
- Thumbnail preview
Cost
- Free: All operations use FFmpeg (no AI cost)
- Processing time depends on video length and number of platforms
- Batch processing is efficient (parallel processing)
User Experience Flow
- Upload Video: User uploads source video
- Select Platforms: Check platforms to optimize for
- Configure Options: Set cropping, compression, thumbnail options
- Preview: See preview of all platform versions
- Optimize: Click "Optimize for All Platforms"
- Progress: Track progress for each platform
- Download: Download individual or all optimized versions
Example UI
┌─────────────────────────────────────────────────────────┐
│ SOCIAL OPTIMIZER │
├─────────────────────────────────────────────────────────┤
│ Source Video: [video_1080x1920.mp4] (15s) │
│ │
│ Select Platforms: │
│ ☑ Instagram Reels (9:16, max 90s) │
│ ☑ TikTok (9:16, max 60s) │
│ ☑ YouTube Shorts (9:16, max 60s) │
│ ☑ LinkedIn Video (16:9, max 10min) │
│ ☐ Facebook (16:9 or 1:1) │
│ ☐ Twitter (16:9, max 2:20) │
│ │
│ Optimization Options: │
│ ☑ Auto-crop to platform ratio │
│ ☑ Generate thumbnails │
│ ☑ Compress for file size limits │
│ ☐ Add captions overlay (Phase 2) │
│ │
│ [Optimize for All Platforms] │
│ │
│ PREVIEW GRID: │
│ ┌─────────┬─────────┬─────────┬─────────┐ │
│ │ Instagram│ TikTok │ YouTube │ LinkedIn│ │
│ │ 9:16 │ 9:16 │ 9:16 │ 16:9 │ │
│ │ [Video] │ [Video] │ [Video] │ [Video] │ │
│ │ [Download]│[Download]│[Download]│[Download]│ │
│ └─────────┴─────────┴─────────┴─────────┘ │
│ │
│ [Download All] │
└─────────────────────────────────────────────────────────┘
Benefits
- Time Savings: One video → multiple platform versions in one click
- Consistency: Same content optimized for each platform
- Compliance: Automatic adherence to platform requirements
- Efficiency: Batch processing saves time
- Free: No AI costs, uses FFmpeg
Next Steps
- Create platform specifications module
- Implement social optimizer service (reuse Transform Studio processors)
- Create backend endpoint
- Build frontend UI with platform selector and preview grid
- Add batch processing and progress tracking