Purpose: Generate and save subtitles for a project Parameters:
project_id(required) - Unique project identifierurl(required) - Video URLlanguage(optional) - Default: "en"timing_offset(optional) - Default: 0.0
Response: Job ID for tracking generation progress
Purpose: Add subtitles to video using project_id (generates if not exist) Parameters:
project_id(required) - Project identifier to find existing subtitlesurl(required) - Video URL- All styling parameters (font-size, colors, etc.)
Behavior:
- β If subtitles exist for project_id β Use existing subtitles
- β‘ If no subtitles exist β Generate first, then add to video
# Step 1: Generate subtitles only
curl -X POST /generate-subtitles \
-d '{"project_id": "my-video-001", "url": "https://video.mp4"}'
# Returns: job_id for generation
# Step 2: Add subtitles to video (uses existing)
curl -X POST /add-subtitles \
-d '{"project_id": "my-video-001", "url": "https://video.mp4"}'
# Returns: job_id for video processing with existing subtitles# Single step: Generate + Add in one call
curl -X POST /add-subtitles \
-d '{"project_id": "my-video-002", "url": "https://video.mp4"}'
# Returns: job_id for generation + video processingsave_project_subtitles(project_id, data)- Store subtitles by projectget_project_subtitles(project_id)- Retrieve existing subtitles- Project subtitle files:
{project_id}_subtitles.json
process_generate_subtitles_job()- Generate only, save by project_idprocess_add_subtitles_job()- Check for existing, generate if needed, then process video
- Generate endpoint returns "already_exists" if subtitles exist for project
- Add endpoint automatically uses existing subtitles if available
- Efficiency: Generate subtitles once, reuse for multiple video versions
- Cost Savings: Avoid redundant Whisper processing for same content
- Workflow Flexibility: Separate generation from video processing
- Project Management: Organize subtitles by project for easy tracking
- Automatic Fallback: Add-subtitles works regardless of existing subtitle state
Content Creators: Generate subtitles once, apply to multiple video formats/versions Batch Processing: Generate all subtitles first, then process videos in parallel Iterative Design: Tweak video styling without re-generating expensive subtitles Team Workflows: One person generates subtitles, others handle video processing
- β Endpoints Created: Both generate-subtitles and add-subtitles operational
- β Project Storage: Job manager saves/retrieves subtitles by project_id
- β Duplicate Detection: Generate endpoint detects existing subtitles
- β Workflow Logic: Add endpoint uses existing or generates new subtitles
- β Progress Tracking: Both workflows provide detailed job status updates
- β Container Deploy: Performance mode with tiny model + project workflow active
Note: Full end-to-end testing requires valid video URLs. Framework and logic confirmed working via container deployment and endpoint validation.