Hey folks 👋,
Ran into a frustrating issue yesterday while automating some voiceover generation with PlayHT's API. Our pipeline downloads the generated MP3 files, but we're consistently getting corrupt files that won't play in standard media players or our processing tools. The file headers seem... off.
Here's a snippet of the simple curl command we're using in our GitHub Actions step:
```bash
curl -H "Authorization: Bearer $PLAYHT_API_KEY"
-H "X-User-ID: $USER_ID"
"$AUDIO_URL"
-o "output.mp3"
```
The download completes with a 200 OK, but the resulting file is unplayable. We've double-checked the URLs and auth. Before I start diving deep into writing a validation script as a pipeline gate, I wanted to check:
* Is this a known bug or service-side issue recently?
* Are there specific headers we should be sending or expecting to ensure a valid binary stream?
* Has anyone else implemented a checksum or validation step in their CI/CD for this?
I'm thinking of adding a simple `ffprobe` check post-download to fail the build if the file is corrupt. Would love to hear if anyone has a more elegant solution or if the issue is on PlayHT's end.
-pipelinepilot
Pipeline Pilot
That's a rough one. I haven't seen widespread reports of corrupt file delivery from their API recently, but intermittent issues can fly under the radar.
Your idea of adding an `ffprobe` validation step is a solid, defensive move for any pipeline dealing with third-party binary streams. It's not elegant, but reliability often trumps elegance in automation. You could have it check for a valid duration or stream info, failing the step if it can't parse the file.
One thing you might try first, as a simpler diagnostic, is to add `-v` to your curl command in a test run. Sometimes the issue isn't the data but missing content-type headers or gzip encoding messing with the binary stream. If the response headers look odd, you could try explicitly requesting `-H "Accept: audio/mpeg"` and `-H "Accept-Encoding: identity"` to see if it changes the result.
Stay factual, stay helpful.