POST
/
dubbing-results
Get Dubbing Results in Bulk
curl --request POST \
  --url https://client.camb.ai/apis/dubbing-results \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "run_ids": [
    12345,
    6789
  ]
}'
{
  "1344": {
    "video_url": "https://example.com/video/processed_123.mp4",
    "audio_url": "https://example.com/audio/processed_123.mp3",
    "transcript": [
      {
        "start": 0,
        "end": 5000,
        "text": "Hello, this is a sample transcript.",
        "speaker": "Speaker 1"
      }
    ]
  }
}

Efficiently retrieve the results of multiple dubbing tasks in a single API call. This bulk endpoint allows you to fetch completed dubbing results for multiple runs at once, making it ideal for applications that need to process large volumes of content or manage multiple dubbing projects simultaneously.

Understanding Bulk Dubbing Results

When you request the results of multiple completed dubbing tasks, our system returns a comprehensive collection of results, with each entry containing:

  • Dubbed Video: A complete video file with the original visuals and newly generated voiceover in your target language.
  • Dubbed Audio: An isolated audio track containing only the synthesized speech in your target language.
  • Complete Transcript: A detailed, time-coded transcript of the dubbed content with speaker identification.

This bulk approach significantly reduces the number of API calls needed when working with multiple dubbing projects, improving efficiency and reducing latency in your applications.

Accessing Multiple Dubbed Results

To retrieve results for multiple dubbing tasks, you’ll need to provide an array of run_id values in the request payload. Each run_id uniquely identifies a specific dubbing task that was created through our dubbing pipeline.

Request Payload Structure

The request body should contain an array of run IDs:

{
  "run_ids": [12345, 67890, 24680, 13579]
}

Example Request with Python

Here’s how to fetch multiple dubbing results using Python:

import requests

# Your API authentication
headers = {
    "x-api-key": "your-api-key",  # Replace with your actual API key
    "Content-Type": "application/json",
}


def get_bulk_dubbing_results(run_ids):
    """
    Retrieves the results of multiple dubbing tasks in a single request.
    Returns a collection of dubbing results with media URLs and transcripts.
    """
    payload = {"run_ids": run_ids}

    try:
        response = requests.post(
            "https://client.camb.ai/apis/dubbing-results",
            headers=headers,
            json=payload,
        )

        # Verify the request was successful
        response.raise_for_status()

        # Extract the bulk dubbing results
        results_data = response.json()

        print(f"Successfully retrieved results for {len(results_data)} dubbing runs")

        # Process each result
        for key in results_data:
            print(f"Run ID: {key}")
            print(f"\nVideo URL: {results_data.get(key, {}).get('video_url')}")
            print(f"\nAudio URL: {results_data.get(key, {}).get('audio_url')}")
            print(f"\nTranscript entries: {len(results_data.get(key, {}).get('transcript', []))}")

        return results_data

    except requests.exceptions.RequestException as e:
        print(f"Error retrieving bulk dubbing results: {e}")
        if hasattr(e, "response") and e.response is not None:
            print(f"Response content: {e.response.text}")
        return None


# Example usage with multiple run IDs
run_ids = [41707, 40413]  # Replace with your actual run IDs
bulk_results = get_bulk_dubbing_results(run_ids)

# Process successful results
if bulk_results:
    print(f"\n{len(bulk_results)} runs completed successfully:")

    for result in bulk_results:
        run_id = result
        transcript = bulk_results.get(run_id, {}).get("transcript", [])

        if transcript:
            print(f"\nRun ID {run_id} - Transcript Preview:")
            for i, dialogue in enumerate(transcript[:2]):  # Show first 2 entries
                speaker = dialogue.get("speaker", "Unknown")
                text = dialogue.get("text", "")
                start = dialogue.get("start", "")
                end = dialogue.get("end", "")
                print(f"  Speaker {speaker}: {text} [{start} - {end}]")

            if len(transcript) > 2:
                print(f"  ... and {len(transcript) - 2} more dialogue entries")

Response Handling

The bulk endpoint returns results for all requested run IDs, including those that may still be processing or have failed. Each result in the response includes:

  • video_url: URL to the dubbed video (if completed)
  • audio_url: URL to the dubbed audio (if completed)
  • transcript: Complete transcript with timing information (if completed)

Best Practices

When using the bulk dubbing results endpoint:

  • Batch Size: Limit your requests to reasonable batch sizes (recommended: 50-100 run IDs per request) to ensure optimal performance
  • Status Checking: Always check the status of each result before attempting to access media URLs or transcripts
  • Error Handling: Implement proper error handling for individual failed runs within the bulk response

This bulk approach streamlines your workflow when managing multiple dubbing projects, reducing API overhead and improving the efficiency of your content localization pipeline.

Authorizations

x-api-key
string
header
required

The x-api-key is a custom header required for authenticating requests to our API. Include this header in your request with the appropriate API key value to securely access our endpoints. You can find your API key(s) in the 'API' section of our studio website.

Body

application/json

Response

200
application/json

Successful Response

An object containing the results of one to five dubbing runs. Each key in the object is a unique identifier for a run, and the corresponding value is the result of the dubbing run.