Zackriya-Solutions/meetily · error

Unknown sample rate

Error message

Unknown sample rate

What it means

The selected track's codec_params.sample_rate was None, so the decoder cannot proceed — the resampler and duration/progress math (frames / rate further down) all need it. Some containers and raw formats don't carry a sample rate in their headers (raw PCM, hand-muxed or exotic files). Standard WAV/FLAC/M4A exports essentially never hit this; it's a signature of unusual or hand-built media.

Source

Thrown at frontend/src-tauri/src/audio/decoder.rs:460

        )
        .map_err(|e| anyhow!("Failed to probe audio format: {}", e))?;

    let mut format = probed.format;

    // Find the first audio track
    let track = format
        .tracks()
        .iter()
        .find(|t| t.codec_params.codec != CODEC_TYPE_NULL)
        .ok_or_else(|| anyhow!("No audio track found in file"))?;

    let track_id = track.id;

    // Get audio parameters
    let sample_rate = track
        .codec_params
        .sample_rate
        .ok_or_else(|| anyhow!("Unknown sample rate"))?;

    let mut channels = track
        .codec_params
        .channels
        .map(|c| c.count() as u16)
        .unwrap_or(1);

    debug!(
        "Audio track: {}Hz, {} channels (from metadata)",
        sample_rate, channels
    );

    // Create the decoder
    let mut decoder = symphonia::default::get_codecs()
        .make(&track.codec_params, &DecoderOptions::default())
        .map_err(|e| anyhow!("Failed to create decoder: {}", e))?;

    // Decode all packets

View on GitHub (pinned to 0281737d87)

Solutions

  1. Convert the file to WAV first (`ffmpeg -i input out.wav`) — WAV headers always declare the rate.
  2. If you produce these files yourself, mux into a standard container that writes the sample rate.
  3. Code fix: fall back to ffmpeg conversion when sample_rate is None (see exampleFix).

Example fix

// before
let sample_rate = track.codec_params.sample_rate
    .ok_or_else(|| anyhow!("Unknown sample rate"))?;

// after — route to ffmpeg conversion, whose WAV output always carries the rate
let sample_rate = match track.codec_params.sample_rate {
    Some(sr) => sr,
    None => {
        let temp = convert_to_wav_with_ffmpeg(path, progress_callback.as_ref())?;
        return decode_wav(temp.to_path_buf(), progress_callback);
    }
};
Defensive patterns

Strategy: fallback

Try / catch

// on 'Unknown sample rate', fall back to convert_to_wav_with_ffmpeg — WAV headers always declare the rate — then decode the WAV

Prevention

When it happens

Trigger: Importing raw PCM with no header, files muxed by niche tools that omit the rate, or stream dumps where parameters weren't captured.

Common situations: Recordings converted with custom pipelines, radio capture dumps, files produced by research tooling.

Related errors


AI-assisted analysis of Zackriya-Solutions/meetily@0281737d87 (2026-08-16). Data as JSON: /api/errors/b81d7671f77351ac. Report an issue: GitHub.