Skip to content

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 be application/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:

  1. Create Task: Send POST request to create the task
  2. Wait: Add a wait node (30-45 seconds) to allow server processing time
  3. Check Status: Use GET endpoint to check task status: GET https://tts.revidapi.com/api/get/{task_id}
  4. Retrieve Result: Once status is "completed", retrieve the output URL from the response

Usage Notes

  1. Character Counting: Credits are calculated based on the total character count of all subtitle text in the SRT file.
  2. SRT Format: The SRT file must be in standard SRT format with proper timestamps.
  3. Audio Synchronization: The generated speech is synchronized with the subtitle timestamps.
  4. Webhook Processing: When a webhook_url is provided, the request is processed asynchronously.
  5. Output Format: Choose the appropriate output format based on your needs (mp4 for video, mp3/wav for audio-only).

Common Issues

  1. Invalid SRT Format: Ensure the SRT file is properly formatted with valid timestamps
  2. URL Accessibility: Both srt_url and video_url must be publicly accessible
  3. Processing Time: Large files with many subtitles may take longer to process

Best Practices

  1. Use Webhooks: Always use webhooks for better reliability
  2. Unique IDs: Provide unique id values for tracking
  3. Test SRT Files: Validate SRT file format before submission
  4. Voice Selection: Choose voices that match the language and tone of your content