Search code examples
pythongoogle-cloud-platformgoogle-cloud-storagedolbydolby-audio-api

Issue with Dolby API Integrated with GCP


I'm currently trying to use Dolby's enhance API and I'm running into an issue when trying to write the output file. Here's the code I'm using to get the blob for the input and output blobs:

file = await storage_client.get_capture_file(capture.filename)
input_file = file.generate_signed_url(
    version="v4",
    expiration=datetime.timedelta(minutes=15),
    method="GET",
)
blob = storage_client.capture_bucket.blob(
    "{}_{}".format(preset, capture.filename)
    if preset
    else "{}_{}_{}_{}_{}".format(
        speech_isolation,
        range_control,
        noise_reduction,
        peak_limit,
        capture.filename,
    )
)
output_file = blob.generate_signed_url(
    version="v4",
    expiration=datetime.timedelta(minutes=15),
    method="PUT",
    content_type="application/octet-stream",
)

The input file works fine since if I write to Dolby's temporary storage, there's no problem. Here's my payload and API call

payload = {
    "content": {"type": "mobile_phone"},
    ...
    
    "input": input_file,
    "output": output_file,
}
headers = {
    "Accept": "application/json",
    "Content-Type": "application/json",
    "x-api-key": os.environ.get("DOLBY_API_KEY"),
}
enhance_response = requests.request(
    "POST", "https://api.dolby.com/media/enhance", json=payload, headers=headers
)

The specific error I'm receiving is the following:

{'path': '/media/enhance', 'status': 'InternalError', 'progress': 43, 'api_version': 'v1.1.2', 'error': {'type': '/problems/internal-error', 'title': 'An internal service error has occurred'}}

I believe the issue has something to do with uploading the new file to GCP. I don't really know what the exact issue is though. Any guidance would be appreciated.


Solution

  • Remove the

    content_type="application/octet-stream",
    

    and it will work. I received this answer from Dolby tech support after several days of troubleshooting and it is currently working for me.