SRT to Speech API
Pricing
10 credits per 1,000 characters
The cost is calculated based on the total character count of all text in the SRT file.
Overview
The SRT to Speech API converts SRT subtitle files into synchronized speech audio. This endpoint merges the generated audio with the original video or creates standalone audio files with timing matched to the subtitle timestamps.
Endpoint
- URL:
POST https://api.revidapi.com/paid/srt-to-speech/merge - Method:
POST
Request
Headers
x-api-key: Required. Your API key for authentication.Content-Type: Required. Must beapplication/json.
Body Parameters
Required Parameters
| Parameter | Type | Description |
|---|---|---|
srt_url |
string (URI) | URL of the SRT subtitle file |
video_url |
string (URI) | URL of the video file to merge with (optional for audio-only output) |
Optional Parameters
| Parameter | Type | Description |
|---|---|---|
engine |
string | TTS engine to use: edge, capcut, google. Default: edge |
voice_id |
integer | Voice ID for the selected engine |
voice |
string | Voice name (alternative to voice_id) |
speed |
number | Speech speed multiplier (0.5 to 2.0). Default: 1.0 |
pitch |
number | Voice pitch adjustment (-20 to 20). Default: 0 |
replace_audio |
boolean | If true, replaces original audio. If false, mixes with original. Default: false |
output_format |
string | Output format: mp4, mp3, wav. Default: mp4 |
webhook_url |
string (URI) | URL to receive the result when processing is complete |
id |
string | Custom identifier for tracking the request |
Example Request
{
"srt_url": "https://example.com/subtitles.srt",
"video_url": "https://example.com/video.mp4",
"engine": "edge",
"voice_id": 1001,
"speed": 1.0,
"replace_audio": false,
"output_format": "mp4",
"webhook_url": "https://example.com/webhook",
"id": "srt-tts-request-123"
}
curl -X POST "https://api.revidapi.com/paid/srt-to-speech/merge" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"srt_url": "https://example.com/subtitles.srt",
"video_url": "https://example.com/video.mp4",
"engine": "edge",
"voice_id": 1001,
"speed": 1.0,
"replace_audio": false,
"webhook_url": "https://example.com/webhook",
"id": "srt-tts-request-123"
}'
Response
Immediate Response (202 Accepted)
When a webhook URL is provided, the API returns an immediate acknowledgment with a task_id:
{
"code": 202,
"id": "srt-tts-request-123",
"task_id": "550e8400-e29b-41d4-a716-446655440000",
"message": "processing"
}
Success Response (via Webhook or Direct)
{
"code": 200,
"id": "srt-tts-request-123",
"task_id": "550e8400-e29b-41d4-a716-446655440000",
"response": {
"output_url": "https://storage.example.com/video/output.mp4",
"duration": 120.5,
"total_characters": 5432
},
"message": "success"
}
Error Responses
Invalid Request (400)
{
"code": 400,
"id": "srt-tts-request-123",
"message": "Invalid request: 'srt_url' is a required property"
}
Authentication Error (401)
{
"code": 401,
"message": "Invalid API key"
}
Workflow Recommendation
For asynchronous processing:
- Create Task: Send POST request to create the task
- Wait: Add a wait node (30-45 seconds) to allow server processing time
- Check Status: Use GET endpoint to check task status:
GET https://tts.revidapi.com/api/get/{task_id} - Retrieve Result: Once status is "completed", retrieve the output URL from the response
Usage Notes
- Character Counting: Credits are calculated based on the total character count of all subtitle text in the SRT file.
- SRT Format: The SRT file must be in standard SRT format with proper timestamps.
- Audio Synchronization: The generated speech is synchronized with the subtitle timestamps.
- Webhook Processing: When a webhook_url is provided, the request is processed asynchronously.
- Output Format: Choose the appropriate output format based on your needs (mp4 for video, mp3/wav for audio-only).
Common Issues
- Invalid SRT Format: Ensure the SRT file is properly formatted with valid timestamps
- URL Accessibility: Both srt_url and video_url must be publicly accessible
- Processing Time: Large files with many subtitles may take longer to process
Best Practices
- Use Webhooks: Always use webhooks for better reliability
- Unique IDs: Provide unique
idvalues for tracking - Test SRT Files: Validate SRT file format before submission
- Voice Selection: Choose voices that match the language and tone of your content