The official Python client for the Audiomatic API
Project description
audiomatic-python
The official Python library for the Audiomatic API
Installation
pip install -U audiomatic
Quick Start
from audiomatic import Audiomatic
# Initialize the client
client = Audiomatic(api_key="your_api_key")
# Translate a local video file
project_id = client.translate(
source="path/to/video.mp4",
target_lang="es",
project_name="Spanish Translation"
)
# Check translation status
status, result_url = client.get_status(project_id)
Usage Examples
Translating a YouTube Video
# Translate a YouTube video to French
project_id = client.translate(
source="https://youtube.com/watch?v=example",
target_lang="fr",
project_name="French Translation"
)
Advanced Options
# Translate with custom options
project_id = client.translate(
source="path/to/video.mp4",
target_lang="de",
project_name="German Translation",
opt_params={
"accent_level": 0.75,
"num_speakers": 2,
"remove_background_audio": True,
"start_time": 30000, # Start at 30 seconds
"end_time": 120000, # End at 2 minutes
"captions_path": "path/to/captions.vtt"
}
)
API Reference
Client Initialization
Audiomatic(api_key: str)
Initialize the Audiomatic client.
Parameters:
api_key
(str): Your Audiomatic API key
Methods
translate(source: str, target_lang: str, project_name: Optional[str] = None, opt_params: Optional[Dict] = None) -> str
Translate a video file or YouTube URL.
Parameters:
source
(str): Path to local video file or YouTube URLtarget_lang
(str): Target language code (e.g., "es", "fr", "de")project_name
(str, optional): Custom project name (defaults to filename)opt_params
(Dict, optional): Additional parameters:accent_level
(float): Voice accent level (0, 0.25, 0.5, 0.75, or 1)num_speakers
(int): Number of speakers in video (defaults to auto-detect)remove_background_audio
(bool): Whether to remove background audiostart_time
(int): Start time of video clip in millisecondsend_time
(int): End time of video clip in millisecondscaptions_path
(str): Path to custom captions file
Returns: Project ID string
get_status(project_id: str) -> Tuple[str, Optional[str]]
Check the status of a translation project.
Parameters:
project_id
(str): Project ID returned from translate()
Returns: Tuple of (status, result_url)
Limitations
- Maximum file size: 500MB
- Maximum video duration: 15 minutes
- Supported languages: ['en', 'fr', 'es', 'de', 'pt', 'zh', 'ja', 'hi', 'it', 'ko', 'nl', 'pl', 'ru', 'sv', 'tr']
- Supported accent levels:[0, 0.25, 0.5, 0.75, 1]
Error Handling
The client includes a custom AudiomaticError
exception class that provides detailed error information:
try:
project_id = client.translate(...)
except AudiomaticError as e:
print(f"Error: {e}")
print(f"Status Code: {e.status_code}")
print(f"Error Code: {e.error_code}")
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
audiomatic-0.1.3.tar.gz
(8.4 kB
view details)
Built Distribution
File details
Details for the file audiomatic-0.1.3.tar.gz
.
File metadata
- Download URL: audiomatic-0.1.3.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.27
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a788c5d8e1dc3ae0324316853010ebd2fa09e6363764ad4c4ea35cf1f4dd5fa |
|
MD5 | 65cd18318769b397d1d075b2df54a881 |
|
BLAKE2b-256 | 19a501bc4a386034bfbf292f4e173baff648a954ce55ff198628279887daa5d9 |
File details
Details for the file audiomatic-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: audiomatic-0.1.3-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.27
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9b7dfab4c4758ad113078c9de1e65394146066d9e2c0b64c5133d3d673e8e57 |
|
MD5 | 212a4b6cf716b0ba5ecb8d6182416e4d |
|
BLAKE2b-256 | 0e055bd7c385c81be0f608d55aaf8cec690e176ac74d95a1292ba5a77b70a8d4 |