I run a visa agency in Bali, and in the evenings I build data tools on Apify. One of them is Audio to Text. You give it a link to an MP3, M4A, WAV or a video page and get back a transcript split into timed passages. Under the hood it is Whisper large v3 (turbo by default) behind Groq's API, plus the plumbing around it: downloading, splitting long files, speaker labels, subtitles and billing.
This post is about one field in the output row, language, and the matching field in the input. On a hard input they don't agree with each other, and the way they disagree is easy to walk into if you are building a pipeline on top.
The test that was meant to be boring
Besides a daily one-minute audio file, one of my scheduled checks sends two YouTube links: the 19-second "Me at the zoo" clip and the Despacito music video. The zoo clip is the easy case, clean English speech with no music. Despacito is the hard one on purpose: four and a half minutes of Spanish singing over a loud backing track with a long intro.
Both links went through on 13 November, on two consecutive builds, with the same input:
{ "urls": [ "https://www.youtube.com/watch?v=jNQXAC9IVRw", "https://www.youtube.com/watch?v=kJQP7kiw5Fk" ], "quality": "fast", "includeSegments": true } No language hint, so the model picks the language itself. The zoo clip came back the way you'd expect: 19.02 seconds, 37 words, 4 segments, language: "English", reading the way it sounds.
The music video came back like this, trimmed:
{ "fileName": "Luis Fonsi - Despacito ft. Daddy Yankee.webm", "durationSeconds": 281.52, "language": "English", "model": "fast", "wordCount": 467, "segmentCount": 66, "status": "ok" } language: "English", on both runs. The text itself is Spanish. Out of 66 segments, the only ones that aren't Spanish are five short interjections: "Hi", "Fancy!", "Oh, oh no, oh no, oh", "Hey, go!" and "oh". Everything else reads like this:
{"start": 41, "duration": 5, "text": "Si, sabes que ya llevo un rato mirándote"} {"start": 46, "duration": 4, "text": "Tengo que bailar contigo hoy"} So the transcription is mostly fine and the label is wrong.
Where the label probably comes from
Look at the first segment:
{"start": 0, "duration": 29, "text": "Hi"} That is one word stretched over 29 seconds, and it is the same on both runs. Open-source Whisper picks the language once, from the first 30-second window of audio, and then keeps that label for the whole file. In this video that window is almost all instrumental intro with a bit of spoken English on top. My best explanation is that the label was decided there, before any Spanish was sung. I can't see inside Groq's service, so I'm not certain they do it exactly the same way, but the 29-second "Hi" fits.
If you route transcripts by language (per-language search index, translation step, choice of embedding model), this row goes down the English path. For a voice note or a call the first half-minute is usually speech, and it's usually in the language of the rest of the file. For anything with an intro, such as podcasts with a jingle, webinars with hold music or videos with a cold open, don't fully trust a label decided from the first 30 seconds.
The part that made me stop: missing accented words
Three segments in the Despacito transcript look different from the other 63. They are long (16.04, 11 and 14.04 seconds), they have no punctuation, and every word that should carry an accent is cut short. Paraphrasing rather than quoting the lyrics, here is what they contain:
-
imwhere imán should be -
esttwice where está should be -
mwhere más should be -
cwhere cómo should be -
cuwhere cuánto should be - a lone
Dat the start of the third passage
These are not random misses. The text stops right where the first non-ASCII letter would be, and the rest of the word is gone. The same transcript gets está right three times in other segments, and mirándote above is fine too. Both runs have exactly the same broken fragments in the same three segments, so it isn't sampling noise. (Elsewhere the two runs differ: 467 vs 465 words, 66 vs 68 segments, and near the end one has Hey where the other has ¡Eh!. That run-to-run drift is normal for Whisper and a separate topic.)
I checked our own code first, because a byte-truncation bug in my own Python seemed more likely than one in the model. The step that turns the API response into segments only strips whitespace:
def to_segments(payload: dict, offset: float) -> list: segments = [] for item in payload.get('segments') or []: text = (item.get('text') or '').strip() if not text: continue ... There's no encode('ascii'), no regex on letters and no Unicode normalisation anywhere in that path. The fragments come from the model as-is. Whatever causes it, it lines up with the label: the model was told, or decided, it was listening to English, and the accented letters got dropped.
If you ingest non-English audio, run a cheap check: look for long segments with no punctuation that contain one- or two-letter "words" which aren't real words in that language. For Spanish, a bare est, m or c is a good signal.
import re SUSPECT = re.compile(r"(?:^|\s)(?:est|m|c|cu|d)(?=\s|$)", re.I) def suspicious(segments): return [s for s in segments if s["duration"] > 8 and not re.search(r"[.,!?¿¡]", s["text"]) and SUSPECT.search(s["text"])] On this file it flags exactly the three segments above and nothing else.
So name the language yourself. Carefully.
The obvious fix is the language input field: tell the model what it's hearing instead of letting it guess from the intro. The output row just told me the language is called "English", so the natural thing (for a person, and even more for an agent chaining calls) is to send that same word back. I tried exactly that today, on the one-minute English test file, using a test account:
{"urls": ["https://.../sample-1min.m4a"], "quality": "fast", "language": "English"} Result:
{ "status": "error", "errorCode": "recognition-failed", "errorMessage": "The recognition service refused the file: {\"error\":{\"message\":\"unsupported language: English\\nLanguage must be one of: [sw sn lo ha es nl id no mi mn km so de ..." } Same file, same build, with "language": "en": status: "ok", 215 words, 8.7 seconds.
The input form does say "two-letter code, for example en, ru, id", so the field is documented correctly. But the output gives you a language name, the input expects a code, and the Actor passes whatever you type straight to the API. That's a trap I set myself. The fix is now in my queue: accept names as well as codes and convert them before the request. Until it ships, send ISO 639-1 codes: es, en, id, ru.
The error itself behaved the way it should. That run charged nothing: zero minutes, zero files. A refused file becomes a free error row with a reason, and the run still finishes SUCCEEDED. That's the reason to check status on every row before reading transcript. A green run doesn't mean every file got transcribed.
I haven't yet re-run the music video with "language": "es", so I can't tell you whether naming the language brings the accented words back. That's the next check, and I'm not going to guess the result.
What it cost
Billing here is per started minute of audio, with the last second free:
BILLING_GRACE_SECONDS = 1.0 def billable_minutes(duration): return max(1, math.ceil(((duration or 60) - BILLING_GRACE_SECONDS) / 60)) That's why the 60.01-second test file bills one minute and not two. Encoders often report a fraction of a second over the real length, and that shouldn't cost you an extra minute.
Each of the two-video runs was charged audio-minute × 6 (1 for the zoo clip, 5 for 281.52 seconds), file-processed × 2 and video-link × 2. At $0.009, $0.002 and $0.09 that comes to $0.238, and $0.18 of it, about 76%, is the two video-link fees. That fee covers pulling the audio out of a video page through a residential exit node. A direct file link never pays it, which is why the one-minute M4A costs $0.011. If you have the audio files, link to them directly. Both runs finished in 14.5 and 17.6 seconds of runtime.
Calling it
curl -X POST "https://api.apify.com/v2/acts/lergassy~audio-to-text/run-sync-get-dataset-items?token=YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"urls":["https://example.com/interview.mp3"],"language":"es","includeSegments":true}' Or in Python, checking each row:
from apify_client import ApifyClient client = ApifyClient("YOUR_TOKEN") run = client.actor("lergassy/audio-to-text").call(run_input={ "urls": ["https://example.com/interview.mp3"], "language": "es", # a code, not "Spanish", for now "includeSegments": True, }) for row in client.dataset(run["defaultDatasetId"]).iterate_items(): if row["status"] != "ok": print("failed:", row["source"], row["errorCode"], row["errorMessage"][:120]) continue print(row["language"], row["durationMinutes"], row["wordCount"]) When this is the wrong tool
If the recording is mostly music, like songs, karaoke or DJ sets, don't expect a clean transcript from any Whisper-based service. This post is a mild example of what happens. If a YouTube video already has a proper caption track, read the captions instead of paying to recognise the audio again. If you need word-level timings, these segments are phrase-level. And if your file mixes languages (one interviewer in English, a guest in Indonesian), know that language is one label per file, not per segment. Name the main language and check the rest yourself.
What I'd take away from this: the language field tells you what the model assumed, not what was actually spoken. And until my fix ships, send the hint as a two-letter code.