AI video API audio tracks: Inspect, Mute, and Validate
Your application has downloaded an approved product clip, but one placement needs sound and another requires silence. AI video API audio tracks should be handled as a delivery policy, not by assuming that every generated MP4 contains usable audio or by submitting another paid generation just to remove it. Inspect the actual file, preserve the original, and create a separate muted derivative when needed.
For applications using the GenRelay video API, this guide describes local processing after generation. It does not claim that every model produces audio, expose undocumented request parameters, or promise a native mute operation. The practical distinction is between a generation request and a transformation of bytes your application already owns.
What does an audio track tell you about a generated video?
An audio track tells you that a container holds an audio stream, not that the stream contains audible, appropriate, or synchronized sound. A container is a file structure that packages media streams and their timing information; MP4 is one example.
A codec is the algorithm used to encode and decode a stream. Your player may accept the video codec but reject the audio codec. A file can also contain multiple audio tracks, including a silent track or an unexpected language. Therefore, testing whether the filename ends in .mp4 is not an audio check.
Keep these acceptance questions separate:
- Does the file contain at least one non-cover-art video stream?
- Does it contain an audio stream, and how many?
- Is the audio codec accepted by the target player?
- Can the complete selected audio stream be decoded?
- Does a listening review accept its content and timing?
Structural inspection cannot answer the final question. Speech, music rights, unexpected dialogue, and lip synchronization require additional review appropriate to your application.
How should your application choose an audio policy?
Choose an explicit policy for each placement before delivering the clip. A delivery policy is an application rule that determines which derivative can be served to a particular destination.
| Policy | Acceptance rule | Action when the rule fails |
|---|---|---|
| Muted placement | No audio streams in the delivered file | Create and validate a muted copy |
| Audio required | Approved decodable audio is present | Hold for review or approved editing |
| Audio optional | Video meets the placement contract | Record audio presence; deliver according to UI rules |
| Narration replacement | Approved external narration is used | Edit separately and review synchronization |
These are application policies, not GenRelay model capabilities. Do not silently turn an audio-required request into a muted result. Likewise, browser autoplay behavior is not evidence that a file has no audio; browsers can mute playback while the downloadable file still contains sound.
Record the source asset identifier, selected policy, processing version, output identifier, and review decision. Do not overwrite the source file when a placement changes its requirements.
How can you inspect audio streams with Python and ffprobe?
Run ffprobe against a private local file and inspect its stream metadata before choosing a transformation. ffprobe is the media inspection program distributed with FFmpeg; install both executables and place them on your system's PATH.
Save the following as inspect_audio.py, then run python3 inspect_audio.py approved.mp4. It requires Python 3.9 or later and does not make a generation API request.
import json
from pathlib import Path
import subprocess
import sys
def inspect(path):
source = Path(path).resolve(strict=True)
if not source.is_file():
raise ValueError("Expected a local file")
result = subprocess.run(
["ffprobe", "-v", "error", "-show_streams",
"-show_format", "-of", "json", str(source)],
check=True, capture_output=True, text=True, timeout=30,
)
data = json.loads(result.stdout)
streams = data.get("streams", [])
videos = [s for s in streams
if s.get("codec_type") == "video"
and not s.get("disposition", {}).get("attached_pic", 0)]
if len(videos) != 1:
raise ValueError("Review files without exactly one video stream")
audio = [s for s in streams if s.get("codec_type") == "audio"]
return {
"video_index": videos[0]["index"],
"audio": [{"index": s["index"],
"codec": s.get("codec_name"),
"channels": s.get("channels"),
"sample_rate": s.get("sample_rate")}
for s in audio],
}
if __name__ == "__main__":
print(json.dumps(inspect(sys.argv[1]), indent=2))
A sample rate describes the number of audio samples per second. Channels describe independent audio signals, such as left and right stereo. Neither field proves that meaningful sound exists. Treat missing metadata as an inspection issue rather than inventing a value.
How do you create a muted copy without re-encoding video?
Explicitly select the approved video stream, remove audio, and copy its encoded packets into a new container. Stream copying avoids video re-encoding, although the resulting container bytes and metadata can still change.
Save this second example as mute_video.py beside the first script. Run python3 mute_video.py approved.mp4 muted.mp4. It deliberately accepts local files only and refuses to replace an existing destination.
from pathlib import Path
import subprocess
import sys
from inspect_audio import inspect
def mute(source_name, destination_name):
source = Path(source_name).resolve(strict=True)
destination = Path(destination_name).resolve()
if destination.suffix.lower() != ".mp4":
raise ValueError("This example writes MP4 only")
if destination.exists() or destination == source:
raise ValueError("Use a new destination")
info = inspect(source)
try:
subprocess.run(
["ffmpeg", "-nostdin", "-v", "error", "-n",
"-i", str(source),
"-map", f"0:{info['video_index']}",
"-c:v", "copy", "-an", "-sn", "-dn",
"-map_metadata", "-1", "-map_chapters", "-1",
"-movflags", "+faststart", str(destination)],
check=True, capture_output=True, timeout=120,
)
if inspect(destination)["audio"]:
raise ValueError("Unexpected audio in muted output")
subprocess.run(
["ffmpeg", "-nostdin", "-v", "error", "-xerror",
"-i", str(destination), "-map", "0:v:0",
"-f", "null", "-"],
check=True, capture_output=True, timeout=120,
)
except Exception:
destination.unlink(missing_ok=True)
raise
return destination
if __name__ == "__main__":
print(mute(sys.argv[1], sys.argv[2]))
The -an option removes audio; setting audio volume to zero would leave an audio stream behind. The explicit stream map also excludes subtitles and data streams from this derivative. Removing metadata and chapters here is a delivery choice, not a guarantee that every identifying detail inside encoded media has been removed.
Use an exclusively owned temporary destination in production, then promote it only after validation. Apply file-size limits, subprocess timeouts, process isolation, and restricted filesystem access to media processing workers. Keep FFmpeg updated because even local files can contain untrusted encoded input.
What should you validate before publishing the derivative?
Validate both the no-audio requirement and the original video acceptance contract before making the derivative public. The sample checks for absent audio and performs a full video decode, but it is not a complete delivery validator.
Compare encoded dimensions, rotation behavior, frame timing, and duration against the stored contract. A remux can preserve encoded video packets while producing container differences that affect a player. Test your actual web and mobile playback paths rather than inferring compatibility from a successful command.
Follow the separate video output validation guide for structural checks. Review content in the source, then verify that the delivery transformation has not altered the intended presentation. Publish the derivative under a new asset identifier and retain its relationship to the source for support and deletion requests.
Does muting a generated clip change generation charges?
Local muting does not itself submit a new generation request, and it does not establish a refund or change the original usage record. Processing, storage, and delivery can still have their own infrastructure costs.
As of November 14, 2026, the supplied GenRelay rate for Grok Imagine 1.0 is $0.010 per second and for Grok Imagine 1.5 is $0.022 per second. An illustrative workload of 100 clips with eight billable seconds each therefore totals $8.00 or $17.60 respectively, excluding additional generations and infrastructure. This arithmetic is not a promise that every configuration accepts an eight-second request.
Gemini Omni Flash is billed per generation: 100 generations cost $10.00 at 720P or $15.00 at 1080P using the supplied $0.10 and $0.15 rates. Do not multiply those rates by seconds. Confirm the selected configuration on GenRelay pricing before budgeting, and do not infer audio support or audio surcharges from these rates.
What do developers ask about AI video API audio tracks?
Does an audio stream mean the clip contains audible speech?
No. Stream metadata establishes audio presence, not audibility, speech content, language, or quality. Use decoding, signal analysis where useful, and listening review for your actual acceptance requirements.
Can I mute a clip by changing its filename?
No. A filename does not change media streams. Create a derivative that excludes audio, then inspect the resulting file before delivery.
Does stream copying work with every source codec?
No. The source codec must be compatible with the output container and target player. If the MP4 write fails, review compatibility and decide whether an explicitly approved transcode is appropriate; do not automatically regenerate the clip.
Should missing audio automatically trigger another generation?
No. First inspect the requested configuration, downloaded artifact, and placement policy. Another submission may incur another charge and may not solve a configuration mismatch. Hold the asset for review when audio is required.