{
  "schemaVersion": 1,
  "slug": "audio-stream-aac-export-check",
  "locale": "en",
  "evidenceClass": "executed-local-fixture-not-provider-generation",
  "providerModelTest": false,
  "productionTaskRun": false,
  "runCommand": "node run-recipe.mjs --out ./my-run",
  "environment": {
    "nodeVersion": "v24.18.0",
    "ffmpeg": {
      "version": "ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers",
      "binarySha256": "a90e3db6a3fd35f6074b013f948b1aa45b31c6375489d39e572bea3f18336584"
    }
  },
  "title": "Distinguish absent audio from silence and verify an AAC export",
  "description": "Build original tone, silent-track and no-audio fixtures, export AAC, then validate stream identity, decoded samples and numerical signal energy.",
  "goal": "Verify that a required audio stream exists and survives AAC conversion. Numerical decoding and RMS checks are not listening, intelligibility or sound-quality reviews.",
  "preparation": [
    "Use Node.js and FFmpeg with AAC support, setting FFMPEG_BIN as needed. No external music or speech is downloaded.",
    "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.",
    "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."
  ],
  "steps": [
    {
      "title": "01. Create three different audio conditions",
      "body": "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."
    },
    {
      "title": "02. Require an explicit audio mapping",
      "body": "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."
    },
    {
      "title": "03. Decode samples and check measured energy",
      "body": "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."
    },
    {
      "title": "04. Separate codec, silence and video checks",
      "body": "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."
    }
  ],
  "acceptance": [
    "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."
  ],
  "troubleshooting": [
    {
      "symptom": "A supposedly silent file fails because no audio stream is present.",
      "change": "Inspect only the required stream mapping. A silence waveform needs an actual track; choose the provided silent-track fixture to test that separate condition."
    },
    {
      "symptom": "The sample count slightly exceeds one second.",
      "change": "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."
    },
    {
      "symptom": "The copied video ends early after muxing.",
      "change": "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."
    }
  ],
  "ending": "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.",
  "assetCaption": "Original synthetic tone and silence WAVs, locally muxed/transcoded fixtures and a three-condition audio diagram. No listening claim or model audio generation."
}
