remotion-dev/remotion · error · std::io::Error

No audio stream found in '${input_path}'. Ensure the video c

Error message

No audio stream found in '${input_path}'. Ensure the video contains an audio track.

What it means

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.

Source

Thrown at packages/compositor/rust/extract_audio.rs:22

use ffmpeg_next::{self as remotionffmpeg, codec::Id, encoder, format, media, Rational};

pub fn extract_audio(input_path: &str, output_path: &str) -> Result<(), ErrorWithBacktrace> {
    remotionffmpeg::init().map_err(|e| format!("Initialization error: {}", e))?;

    _print_verbose(&format!(
        "Extracting audio from {} {}",
        input_path, output_path
    ))?;

    let mut ictx = format::input(&input_path)
        .map_err(|e| format!("Error reading input from '{}': {}", input_path, e))?;
    let mut octx = format::output(&output_path)
        .map_err(|e| format!("Error setting up output to '{}': {}", output_path, e))?;

    // Determine the audio codec of the input file
    let audio_stream = match ictx.streams().best(remotionffmpeg::media::Type::Audio) {
        Some(audio_stream) => audio_stream,
        None => Err(std::io::Error::new(
            ErrorKind::Other,
            format!(
                "No audio stream found in '{}'. Ensure the video contains an audio track.",
                input_path
            ),
        ))?,
    };

    let audio_codec_id = unsafe { (*(*(audio_stream).as_ptr()).codecpar).codec_id };

    let mut stream_mapping = vec![-1; ictx.nb_streams() as _];
    let mut ist_time_bases = vec![Rational(0, 1); ictx.nb_streams() as _];
    let mut ost_index = 0;
    for (ist_index, ist) in ictx.streams().enumerate() {
        if ist.parameters().medium() != media::Type::Audio {
            continue;
        }
        stream_mapping[ist_index] = ost_index;

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Confirm the source actually has an audio track with `ffprobe <file>` before calling extraction.
  2. If the source is expected to be silent, skip the extract_audio step rather than treating missing audio as an error.
  3. Re-export the source ensuring an audio stream is written (e.g. add a silent audio track) if your workflow requires one.

Example fix

// before: always extract audio
await extractAudio(input, output);

// after: probe first, skip when silent
const hasAudio = await hasAudioTrack(input);
if (hasAudio) {
  await extractAudio(input, output);
}
Defensive patterns

Strategy: validation

Validate before calling

// Use ffprobe-equivalent metadata to confirm an audio stream exists first.
const hasAudio = await hasAudioTrack(inputPath); // returns boolean
if (!hasAudio) {
  throw new Error(`Input has no audio stream: ${inputPath}`);
}

Try / catch

try {
  await extractAudio(input, output);
} catch (err) {
  if (String(err).includes('No audio stream found')) {
    // source is silent; skip extraction instead of failing
  } else throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/df7377db2185ddfb. Report an issue: GitHub.