{"record":{"id":"df7377db2185ddfb","repo":"remotion-dev/remotion","slug":"no-audio-stream-found-in-input-path-ensure-t","errorCode":null,"errorMessage":"No audio stream found in '${input_path}'. Ensure the video contains an audio track.","messagePattern":"No audio stream found in '(.+?)'\\. Ensure the video contains an audio track\\.","errorType":"error_code","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"packages/compositor/rust/extract_audio.rs","lineNumber":22,"sourceCode":"use ffmpeg_next::{self as remotionffmpeg, codec::Id, encoder, format, media, Rational};\n\npub fn extract_audio(input_path: &str, output_path: &str) -> Result<(), ErrorWithBacktrace> {\n    remotionffmpeg::init().map_err(|e| format!(\"Initialization error: {}\", e))?;\n\n    _print_verbose(&format!(\n        \"Extracting audio from {} {}\",\n        input_path, output_path\n    ))?;\n\n    let mut ictx = format::input(&input_path)\n        .map_err(|e| format!(\"Error reading input from '{}': {}\", input_path, e))?;\n    let mut octx = format::output(&output_path)\n        .map_err(|e| format!(\"Error setting up output to '{}': {}\", output_path, e))?;\n\n    // Determine the audio codec of the input file\n    let audio_stream = match ictx.streams().best(remotionffmpeg::media::Type::Audio) {\n        Some(audio_stream) => audio_stream,\n        None => Err(std::io::Error::new(\n            ErrorKind::Other,\n            format!(\n                \"No audio stream found in '{}'. Ensure the video contains an audio track.\",\n                input_path\n            ),\n        ))?,\n    };\n\n    let audio_codec_id = unsafe { (*(*(audio_stream).as_ptr()).codecpar).codec_id };\n\n    let mut stream_mapping = vec![-1; ictx.nb_streams() as _];\n    let mut ist_time_bases = vec![Rational(0, 1); ictx.nb_streams() as _];\n    let mut ost_index = 0;\n    for (ist_index, ist) in ictx.streams().enumerate() {\n        if ist.parameters().medium() != media::Type::Audio {\n            continue;\n        }\n        stream_mapping[ist_index] = ost_index;","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/compositor/rust/extract_audio.rs#L4-L40","documentation":"Returned by extract_audio() in the Rust compositor when ffmpeg_next cannot find an audio stream in the input (ictx.streams().best(Audio) returns None). The input is opened successfully but contains no audio track, so audio extraction cannot proceed; the error is wrapped as an io::Error of kind Other with the input path for context.","triggerScenarios":"Calling extract_audio on a video file that has only a video stream, a corrupt/truncated file whose audio track is unreadable, or a container that ffmpeg does not detect as having audio.","commonSituations":"Muting then exporting a clip that drops the audio stream; rendering a silent/visual-only composition and then attempting audio extraction; a screen recording or animated image with no audio; a truncated upload missing the moov/audio atoms.","solutions":["Confirm the source actually has an audio track with `ffprobe <file>` before calling extraction.","If the source is expected to be silent, skip the extract_audio step rather than treating missing audio as an error.","Re-export the source ensuring an audio stream is written (e.g. add a silent audio track) if your workflow requires one."],"exampleFix":"// before: always extract audio\nawait extractAudio(input, output);\n\n// after: probe first, skip when silent\nconst hasAudio = await hasAudioTrack(input);\nif (hasAudio) {\n  await extractAudio(input, output);\n}","handlingStrategy":"validation","validationCode":"// Use ffprobe-equivalent metadata to confirm an audio stream exists first.\nconst hasAudio = await hasAudioTrack(inputPath); // returns boolean\nif (!hasAudio) {\n  throw new Error(`Input has no audio stream: ${inputPath}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await extractAudio(input, output);\n} catch (err) {\n  if (String(err).includes('No audio stream found')) {\n    // source is silent; skip extraction instead of failing\n  } else throw err;\n}","preventionTips":["Probe the source with ffprobe for an audio stream before extracting.","Skip the audio-extraction step for compositions known to be silent.","Validate uploads are complete (not truncated) before processing."],"tags":["compositor","rust","ffmpeg","audio","media"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}