Instantly generate stems from YouTube videos with complet ๐ธ
Complet is a music service that allows extracting the stems (vocals, drums, bass, other) from a YouTube video using deep learning powered by the spleeter model from Deezer. This makes it easy to recreate a full band sound even when some instruments are missing, by using the stems as backing tracks.
This repository contains the API component of the complet service.
- Extract stems from YouTube video via link
- Return download links for each stem
- Store extracted stems on AWS S3
- Built with Python FastAPI framework
- Fully automated infrastructure as code (IaC) with Terraform
- CI/CD pipelines with GitHub Actions
To extract stems from a YouTube video:
POST /stems/extract
{
"youtube_link": "https://youtu.be/..."
}
RESPONSE:
{
"stems": {
"vocals": "https://s3.amazonaws.com/...",
"drums": "https://s3.amazonaws.com/...",
"bass": "https://s3.amazonaws.com/...",
"other": "https://s3.amazonaws.com/..."
}
}
The complet API uses FastAPI to handle requests and run the spleeter model. The infrastructure is provisioned on AWS using Terraform modules. CI/CD pipelines deploy changes from GitHub dev/staging/prod branches.
The complet API infrastructure is provisioned on AWS using Terraform. User requests first reach the API Gateway, which handles API versioning - by default requests go to the /v1 stage endpoints.
API Gateway triggers a Lambda function containing the FastAPI application code running in a Docker container stored in ECR. This serverless function handles the API logic and stem extraction using the spleeter model.
Extracted audio stems are uploaded to an S3 bucket for persistent storage. Download URLs for the stems are returned in the API response. The logs from the Lambda function are stored in CloudWatch Logs.
Terraform state is stored remotely in S3, with separate state buckets for each environment (dev, staging, prod). This allows independent infrastructure for each stage following Git branching workflow.
Storing Terraform state remotely enables a consistent view of infrastructure and prevents state duplication. Infrastructure changes can be applied predictably through CI/CD pipelines using the same configured backend.
This project is licensed under the MIT license. See LICENSE for details.