Skip to content

Conversation

@alokemajumder
Copy link
Collaborator

Summary

This PR significantly enhances the FFmpeg integration to expose more of FFmpeg's capabilities through the API.

New Operations Added

  • scale - Resolution scaling with algorithm selection (lanczos, bicubic, etc.)
  • crop - Video cropping with FFmpeg expression support
  • rotate - Video rotation (90°, 180°, 270°, or arbitrary angles)
  • flip - Horizontal/vertical flip
  • audio - Audio processing (volume, normalization, sample rate, channels)
  • subtitle - Subtitle overlay (SRT, ASS, VTT support)
  • concat - Video concatenation

Enhanced Filters (50+ FFmpeg filters now available)

  • Video Transform: scale, crop, overlay, pad, transpose, hflip, vflip, rotate
  • Color/Quality: eq, hqdn3d, unsharp, colorchannelmixer, lut3d, curves
  • Deinterlacing: yadif, bwdif, w3fdif, nnedi
  • Audio: volume, loudnorm, dynaudnorm, atempo, amerge, amix
  • Effects: fade, afade, drawtext, boxblur, gblur
  • Stabilization: vidstabdetect, vidstabtransform, deshake
  • HDR: zscale, tonemap, colorspace

API Improvements

  • Support both flat and nested params structure for flexibility
  • Allow empty operations list for simple format conversion
  • Map 'stream' and 'streaming' operation types consistently

Test plan

  • Python syntax validation passes
  • Unit tests for new validators
  • Integration test with sample video files

Example payloads

Scale video to 1080p

{
  "input": "/storage/input/video.mp4",
  "output": "/storage/output/video_1080p.mp4",
  "operations": [
    {"type": "scale", "width": 1920, "height": 1080, "algorithm": "lanczos"}
  ]
}

Audio normalization

{
  "input": "/storage/input/video.mp4",
  "output": "/storage/output/video_normalized.mp4",
  "operations": [
    {"type": "audio", "normalize": true, "normalize_type": "loudnorm"}
  ]
}

Crop and rotate

{
  "input": "/storage/input/video.mp4",
  "output": "/storage/output/video_processed.mp4",
  "operations": [
    {"type": "crop", "width": 1280, "height": 720, "x": 100, "y": 50},
    {"type": "rotate", "angle": 90}
  ]
}

- Add new operations: scale, crop, rotate, flip, audio, subtitle, concat
- Expand allowed FFmpeg filters (50+ filters for video/audio processing)
- Support both flat and nested params structure for API flexibility
- Add audio processing: volume, normalization, sample rate, channels
- Add video filters: blur, deinterlace, stabilize, speed, fade
- Add HDR/color space filters for modern workflows
- Allow empty operations list for simple format conversion
- Map 'stream' operation type to 'streaming' for consistency
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants