detach_source_has_no_audio: check probe.has_audio first

Audio detach fails with detach_source_has_no_audio on silent video. Probe has_audio with a free frames-false video inspect first. Refusal codes listed.

3 min readSume
All posts

detach_source_has_no_audio means the video you passed to audio detach has no audio track. Prevent it by probing first: a video inspect with frames: false returns probe.has_audio and makes no stills. The probe-only inspect is not billed, per the Sume pricing notes, so the check costs nothing.

The guard

Probe, then detach only when the clip has sound. The inspect default is mode: sync, which waits up to 30 seconds.

import os, requests

BASE = "https://api.sume.com"
H = {"Authorization": "Bearer " + os.environ["SUME_API_KEY"]}
url = "https://media.sume.com/artifacts/artf_demo/talk.mp4"

r = requests.post(BASE + "/v1/video-inspect",
    headers={**H, "Idempotency-Key": "probe-001"},
    json={"video_url": url, "frames": False})
r.raise_for_status()
print(r.json())  # read probe.has_audio before detaching

Stable refusal codes

These are the codes the detach docs list; each means a different fix.

Audio detach refusals
CodeMeaningFix
detach_source_has_no_audioNo audio trackProbe first; skip silent clips
audio_detach_range_emptyend <= start, or range over 900 sCorrect the range
detach_start_past_sourcestart beyond the durationUse a start inside the clip
source_duration_exceededSource over 1800 sTrim first
unsupported_media_sourceNot a media.sume.com URLImport with POST /v1/media-imports
source_not_foundDead URL or other workspaceCheck the artifact id

Cost of the mistake

A detach is $0.01. The point of the probe is less the cent than the batch: a loop over 500 clips with 40 silent ones fails 40 jobs and leaves 40 failed jobs to sort out. Filter on has_audio and you queue only the files that will succeed.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume