A package for isolating voice from video files using the ElevenLabs API
Project description
ElevenLabs Voice Isolator for Video Files
This tool extracts audio from video files and uses the ElevenLabs voice isolator API to remove background noise, resulting in clean, studio-quality speech.
Features
- Extract audio from various video formats (MP4, AVI, MOV, MKV, WebM)
- Process individual video files or batch process entire directories
- Isolate voice from background noise using ElevenLabs' AI
- Merge isolated voice audio back with original video
- Simple command-line interface
- Modular package structure for easy integration into other projects
Requirements
- Python 3.7+
- FFmpeg installed on your system
- ElevenLabs API key
Installation
Option 1: Install from source
- Clone this repository or download the files
- Install the package in development mode:
pip install -e .
Option 2: Install dependencies only
- Clone this repository or download the files
- Install the required Python packages:
pip install -r requirements.txt
-
Install FFmpeg if not already installed:
- macOS:
brew install ffmpeg - Ubuntu/Debian:
sudo apt-get install ffmpeg - Windows: Download from ffmpeg.org or use Chocolatey:
choco install ffmpeg
- macOS:
-
Create a
.envfile with your ElevenLabs API key:
cp .env.example .env
Then edit the .env file to add your API key.
Usage
Command-line Interface
The package provides a simple command-line interface:
# Process a single video
python cli.py path/to/video.mp4 -o path/to/output.mp4
# Batch process all videos in a directory
python cli.py path/to/videos_directory --batch -o path/to/output_directory
Python API
You can also use the package as a Python module in your own projects:
from voice_isolator.processor import process_video, batch_process_videos
# Process a single video
process_video(
video_path="path/to/video.mp4",
output_path="path/to/output.mp4",
api_key="your-elevenlabs-api-key" # Optional if set in environment
)
# Batch process videos
batch_process_videos(
input_dir="path/to/videos_directory",
output_dir="path/to/output_directory",
api_key="your-elevenlabs-api-key" # Optional if set in environment
)
Additional options
usage: cli.py [-h] [-o OUTPUT] [--batch] [--temp-dir TEMP_DIR] [--keep-temp] [--api-key API_KEY] [--video-codec VIDEO_CODEC] [--overwrite] [--verbose] input
Process videos with ElevenLabs voice isolation
positional arguments:
input Input video file or directory containing video files
optional arguments:
-h, --help show this help message and exit
-o OUTPUT, --output OUTPUT
Output file or directory for processed videos
--batch Process all video files in the input directory
--temp-dir TEMP_DIR Directory for temporary files (only used in batch mode)
--keep-temp Keep temporary files
--api-key API_KEY ElevenLabs API key (will use ELEVENLABS_API_KEY env var if not provided)
--video-codec VIDEO_CODEC
Video codec to use (default: copy - no re-encoding)
--overwrite Overwrite output files if they exist
--verbose Enable verbose logging
Package Structure
The package is organized into the following modules:
voice_isolator.audio.isolator: Functions for isolating voice from audio filesvoice_isolator.video.extractor: Functions for extracting audio from video filesvoice_isolator.video.merger: Functions for merging video files with audio filesvoice_isolator.processor: Main processing functions combining all componentsvoice_isolator.utils: Utility functions (logging, etc.)
How It Works
- The script extracts the audio track from the video file using FFmpeg
- The extracted audio is sent to the ElevenLabs voice isolator API
- The API processes the audio to remove background noise and isolate the voice
- The cleaned audio is merged back with the original video
- The final video with clean audio is saved to the specified output location
License
MIT
Acknowledgements
- ElevenLabs for their voice isolation API
- FFmpeg for audio/video processing capabilities
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file elevenlabs_voice_isolator-0.1.0.tar.gz.
File metadata
- Download URL: elevenlabs_voice_isolator-0.1.0.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c61e11d2c5ef6d841de495de02fa5cf678e44189ec25ba3c4ef5c9063cbcc221
|
|
| MD5 |
5d453e5eb239e1bcce6c2af80c70d886
|
|
| BLAKE2b-256 |
1bffaa19dbf35d464e708454bcdd2f9f563a8b20730f359f1a88d8067afb8deb
|
File details
Details for the file elevenlabs_voice_isolator-0.1.0-py3-none-any.whl.
File metadata
- Download URL: elevenlabs_voice_isolator-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
179109037e3f5b809a75b9330f5db1783642f2be6249130efcb67b96438a0db8
|
|
| MD5 |
35b62d8f6b3c66fc7a17025b067783c2
|
|
| BLAKE2b-256 |
8e5c96bbcf00bcab2245cb426356a12463b70741b5b51eaa7a8d637d6d56fa08
|