Livingseed Media Cut is a robust API designed to help our ministry community easily extract audio from YouTube videos. Whether you need a sermon clip, worship song segment, or teaching excerpt, this tool makes it simple to download exactly what you need in your preferred format.
- 🎵 Multiple Formats - Download in MP3 (audio), WAV (high quality), or MP4 (video)
- ✂️ Precise Trimming - Extract specific time ranges or full tracks
- 📝 Custom Metadata - Add filename, topic/album, and artist/speaker information
- 📊 Real-time Progress - Track extraction progress with live updates
- 📜 Download History - Keep track of your recent extractions
- ⚡ Fast & Free - No registration required, completely free to use
-
Clone the repository
git clone https://github.com/livingseed/mediacut.git cd mediacut/app -
Install dependencies
pip install -r requirements.txt
-
Set up environment variables
Create a
.envfile in the app directory (optional, see.env.example):cp .env.example .env
-
Run the server
python main.py
-
Docker (Optional)
# Build and run with Docker Compose docker-compose up -d --build -
Access the API
Navigate to http://localhost:3000/docs to see the API documentation.
| Command | Description |
|---|---|
python main.py |
Start server |
python main.py --help |
Show all available options |
- Paste a YouTube URL - Copy any YouTube video link
- Choose extraction mode:
- Snippet - Extract a specific time range
- Full Track - Download the entire video audio
- Set time range (for snippets) - Enter start and end times
- Select output format - Choose MP3, WAV, or MP4
- Add metadata (optional) - Customize filename, topic, and speaker
- Click "Start Extraction" - Wait for processing to complete
- Download your file - Click the download button when ready
- Backend: FastAPI - Modern, fast web framework for building APIs
- Processing: yt-dlp & FFmpeg - Media downloading and processing
- Language: Python - Core programming language
app/
├── config.py # Configuration & environment vars
├── main.py # FastAPI app initialization
├── requirements.txt # Python dependencies
├── routes/ # API route handlers
│ ├── extract.py # Audio extraction endpoints
│ ├── video_info.py # Video info endpoints
│ ├── health.py # Health check endpoint
│ └── app.py # App home endpoints
├── services/ # Business logic
│ └── extractor.py # Core extraction service
├── models/ # Pydantic models
│ ├── requests.py # Request schemas
│ └── responses.py # Response schemas
├── utils/ # Utility modules
│ └── ffmpeg_utils.py # FFmpeg helpers
| Variable | Description | Default |
|---|---|---|
HOST |
Server host | 0.0.0.0 |
YOUTUBE_PROXY_URL |
Proxy URL | None |
YOUTUBE_COOKIES_PATH |
Path to cookies file | None |
YOUTUBE_VISITOR_DATA |
Cookie-less bot bypass token (from window.yt.config_.VISITOR_DATA) |
|
YOUTUBE_PO_TOKEN |
Proof of Origin Token (Optional, for advanced bypass) | |
YOUTUBE_COOKIES_CONTENT |
Base64 encoded content of cookies.txt (Fallback) |
None |
LOG_TO_FILE |
Enable file logging | false |
MAX_CONCURRENT_JOBS |
Max simultaneous extractions | 3 |
CACHE_ENABLED |
Enable audio caching | true |
FFMPEG_THREADS |
Threads for processing | 4 |
See .env.example for all available options.
To handle age-restricted videos or other access issues, you can provide YouTube cookies.
- Export Cookies: Use a browser extension (e.g., "Get cookies.txt" for Chrome/Firefox) to export your YouTube cookies into a
cookies.txtfile. - Place File:
- Local: Place
cookies.txtin yourapp/directory or any accessible path. - Docker: Mount
cookies.txtinto the container, e.g.,/app/cookies.txt.
- Local: Place
- Configure: Set
YOUTUBE_COOKIES_PATH=/app/cookies.txt(Docker) or absolute path (local).
For cloud deployments (like Vercel) where you cannot upload sensitive files like client_secrets.json or youtube_api_creds.pickle, you can provide them as Base64 encoded environment variables.
-
Encode
client_secrets.json:base64 -i client_secrets.json -o -
Copy the output and set it as
GOOGLE_CLIENT_SECRETS. -
Encode
youtube_api_creds.pickle: First, generate the token locally usingpython generate_token.py. Then encode it:base64 -i youtube_api_creds.pickle -o -
Copy the output and set it as
GOOGLE_API_TOKEN.
To bypass YouTube's "Sign in to confirm you’re not a bot" error without using cookies, you can use the Visitor Data token.
-
Get Visitor Data:
- Open YouTube in a browser (Incognito recommended).
- Open Developer Tools (F12) -> Console.
- Run:
window.yt.config_.VISITOR_DATA - Copy the output string (e.g.,
Cgt...).
-
Configure:
- Set
YOUTUBE_VISITOR_DATAenvironment variable with this string.
- Set
Vercel uses AWS Datacenter IPs, which YouTube blocks aggressively. If you see "Sign in to confirm you’re not a bot", you have two options:
- Use Cookies (Free, but requires maintenance): Set
YOUTUBE_COOKIES_CONTENT. - Use a Residential Proxy (Paid, scalable, no cookies):
- Get a residential proxy (e.g., from Smartproxy, Bright Data, IPRoyal).
- Set
YOUTUBE_PROXY_URLenvironment variable:http://user:pass@host:port - This masks Vercel's IP with a residential one, bypassing the block.
For cloud environments where you can't upload files easily:
-
Export Cookies:
- Install the "Get cookies.txt LOCALLY" extension for Chrome/Firefox.
- Go to
youtube.comand ensure you are logged in. - Click the extension icon and export as
cookies.txt(Netscape format).
-
Encode:
- Convert the file content to Base64 (to avoid newline issues in env vars).
- Mac/Linux:
base64 -i cookies.txt - Windows: Use an online Base64 encoder or PowerShell.
-
Configure:
- Copy the Base64 string.
- Set
YOUTUBE_COOKIES_CONTENTenvironment variable with this string.
- ✅ No user data collection
- ✅ All processing happens locally or on your server
- ✅ No account required
- ✅ History stored locally in your browser
- ✅ No tracking or analytics
We welcome contributions from the community! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is maintained by the Livingseed Media Team for ministry use.
Need help? Have questions?
- 📧 Email: support@livingseed.org
- 🌐 Website: livingseed.org
- Built with love by the Livingseed Media Team
- Powered by FastAPI
- Icons by Lucide
Made with ❤️ for the ministry community
© 2025 Livingseed. All rights reserved.
