SilenceSwift is a distributed video processing system designed to automatically detect and speed up silent portions of videos based on silencewarp. The system uses a microservices architecture to efficiently process videos through splitting, silence detection, speed adjustment, and merging.
Client -> API Server -> Redis Queues -> Workers -> S3 Storage
^ ^
| |
+-- Database <------------+
- Handles video uploads
- Manages job creation and tracking
- Provides status endpoints for clients
- Queues initial processing tasks
split_queue: Jobs waiting for video splittingprocess_queue: Chunks waiting for silence detection/speedupmerge_queue: Completed chunks waiting to be merged
- Splitter Workers: Split videos into manageable chunks
- Processor Workers: Process individual chunks to detect and speed up silence
- Merger Workers: Merge processed chunks back into a complete video
input/: Original uploaded videoschunks/: Split video chunksprocessed/: Chunks after silence processingoutput/: Final merged videos
- Tracks job status and metadata
- Maintains relationships between jobs and chunks
- Provides consistent state across all components
- Docker and Docker Compose
- Python 3.12 or higher (for local development)
- Poetry (for dependency management)
- Clone the repository
- Copy the example environment file:
cp .env.example .env
- Customize environment variables as needed
# Start the entire system
docker-compose up
# To run in background
docker-compose up -dThis will start the PostgreSQL database, Redis, MinIO, and the API server.
For development or customized deployments, you can run workers separately, dockerization to come:
# Start a splitter worker
python -m workers.splitter
# Start a processor worker
python -m workers.processor
# Start a merger worker
python -m workers.mergercurl -X POST -F "video=@your_video.mp4" http://localhost:5000/api/jobsResponse:
{
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "pending",
"message": "Job created successfully",
"input_file": "your_video.mp4"
}curl http://localhost:5000/api/jobs/550e8400-e29b-41d4-a716-446655440000Response:
{
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "processing",
"created_at": "2023-07-01T12:34:56.789Z",
"updated_at": "2023-07-01T12:35:00.123Z",
"input_path": "input/550e8400-e29b-41d4-a716-446655440000/your_video.mp4",
"output_path": null,
"error": null,
"chunks": { "pending": 2, "processing": 3, "completed": 5 },
"progress": 50.0
}You can customize the silence detection and processing parameters through environment variables:
SILENCE_PERCENTILE: Percentile used for calculating noise threshold (default: 30.0)SILENCE_DURATION: Minimum duration (in seconds) to consider a segment as silence (default: 0.35)SPEED_FACTOR: Factor by which silent segments are sped up (default: 10.0)
# Install dependencies
poetry install
# Activate virtual environment
eval (poetry env activate)
# Run API server locally
python -m api.appThe system uses two main tables:
jobs: Stores job metadata and overall statuschunks: Stores information about individual video chunks
This project is licensed under the MIT License - see the LICENSE file for details.