03:00:0050% OFFClaim

Hands-on recipe

Distinguish absent audio from silence and verify an AAC export

Verify that a required audio stream exists and survives AAC conversion. Numerical decoding and RMS checks are not listening, intelligibility or sound-quality reviews.

Includes executed local fixtures, scripts and receipts. These checks do not represent a video-generation service run.

Original task-specific local-fixture diagram
Original synthetic tone and silence WAVs, locally muxed/transcoded fixtures and a three-condition audio diagram. No listening claim or model audio generation.

01Prepare environment and inputs

  1. Use Node.js and FFmpeg with AAC support, setting FFMPEG_BIN as needed. No external music or speech is downloaded.
  2. Inspect the three distinct inputs: an original 440-Hz sine WAV, digital-silence WAV and one-second video with no audio. The silent WAV contains 16,000 zero samples; absent audio has no stream to map.
  3. Choose a fresh output directory and keep initial-failed-run.json for the documented first attempt. The corrected recorded run avoids -shortest during stream copy and preserves all ten video frames.

02Run the recipe

Run command

node run-recipe.mjs --out ./my-run
  1. Create three different audio conditions

    The script writes the tone and silence WAV headers and PCM samples directly with Node buffers. It muxes each with the original video into separate MKV fixtures. A present stream containing zeros is not the same as a file that lacks an audio stream.

  2. Require an explicit audio mapping

    Map 0:v:0 and 0:a:0 when creating aac-export.mp4, copying video and encoding audio with AAC at 64 kbit/s. The absent-audio fixture deliberately fails the required map instead of accepting an optional missing stream.

  3. Decode samples and check measured energy

    Decode AAC to mono 16-kHz signed 16-bit PCM. The actual run returned 16,384 samples and RMS 0.1391365 for the synthetic tone. The count accepts bounded AAC padding; it does not claim an exact presentation duration from raw padded samples.

  4. Separate codec, silence and video checks

    The actual inspection log reports Audio: aac; all ten video frames decode, and the silent-track fixture decodes to PCM samples all valued zero. The initial run’s -shortest video truncation is retained as a failed receipt; the corrected script’s seven checks all pass.

03Check the result

  • The exported audio maps successfully and decodes to nonempty, even-length 16-bit PCM.
  • Decoded AAC count is between 16,000 and 17,024 samples; the recorded count is 16,384.
  • The original sine’s decoded RMS lies between 0.1 and 0.2; the recorded value is 0.1391365.
  • The actual FFmpeg inspection names AAC as the audio codec.
  • The exported video still contains ten complete 320×180 frames.
  • A present silent track decodes to zeros, while absent audio fails the explicit stream map; seven checks pass.

04Troubleshoot and deliver

A supposedly silent file fails because no audio stream is present.

Inspect only the required stream mapping. A silence waveform needs an actual track; choose the provided silent-track fixture to test that separate condition.

The sample count slightly exceeds one second.

Keep the 16-kHz output rate fixed and compare the bounded AAC padding allowance. Do not label all decoded padded samples as exact display duration.

The copied video ends early after muxing.

Remove only -shortest from the equal-duration fixture stream copy and verify all ten video frames again. The initial failed receipt records this observed issue.

Retain stream logs and measured samples as machine checks. Listen and review synchronization separately before making an editorial judgement about audio; this recipe did not perform either review.

05Download scripts and fixtures