remotion-dev/remotion · error · Error

Invalid inputFile type. The provided file is not a wav file!

Error message

Invalid inputFile type. The provided file is not a wav file! Convert the file to a 16KHz wav file first: "ffmpeg -i input.mp4 -ar 16000 output.wav -y"

What it means

The transcribe() function from @remotion/install-whisper-cpp validates that the input file has a .wav extension via isWavFile() before passing it to whisper.cpp. whisper.cpp requires a 16 kHz mono PCM wav file; any other format will cause it to fail or produce garbage. The error message includes the exact ffmpeg command to convert.

Source

Thrown at packages/install-whisper-cpp/src/transcribe.ts:325

	language?: Language | null;
	splitOnWord?: boolean;
	signal?: AbortSignal;
	onProgress?: TranscribeOnProgress;
	flashAttention?: boolean;
	additionalArgs?: AdditionalArgs;
}): Promise<TranscriptionJson<HasTokenLevelTimestamps>> => {
	if (!existsSync(whisperPath)) {
		throw new Error(
			`Whisper does not exist at ${whisperPath}. Double-check the passed whisperPath. If you havent installed whisper, check out the installWhisperCpp() API at https://www.remotion.dev/docs/install-whisper-cpp/install-whisper-cpp to see how to install whisper programatically.`,
		);
	}

	if (!existsSync(inputPath)) {
		throw new Error(`Input file does not exist at ${inputPath}`);
	}

	if (!isWavFile(inputPath)) {
		throw new Error(
			'Invalid inputFile type. The provided file is not a wav file! Convert the file to a 16KHz wav file first: "ffmpeg -i input.mp4 -ar 16000 output.wav -y"',
		);
	}

	const tmpJSONDir = path.join(process.cwd(), 'tmp');

	const {outputPath: tmpJSONPath} = await transcribeToTemporaryFile({
		fileToTranscribe: inputPath,
		whisperPath,
		whisperCppVersion,
		model,
		tmpJSONPath: tmpJSONDir,
		modelFolder: modelFolder ?? null,
		translate: translateToEnglish,
		tokenLevelTimestamps,
		printOutput,
		tokensPerItem: tokenLevelTimestamps ? 1 : (tokensPerItem ?? 1),
		language: language ?? null,

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Convert the source audio to a 16 kHz wav file first using ffmpeg: ffmpeg -i input.mp4 -ar 16000 output.wav -y, then pass output.wav to transcribe().
  2. Verify the input file extension is .wav (case-insensitive) before calling transcribe().
  3. Automate the conversion step in a pipeline so non-wav sources are always pre-processed.
  4. Check that the wav file is mono PCM at 16 kHz sample rate for best whisper.cpp compatibility.

Example fix

// before
await transcribe({
  inputPath: './audio.mp3', // wrong format
  whisperPath,
  whisperCppVersion: 'v1.5.4',
  model: 'base.en',
  tokenLevelTimestamps: false,
});

// after
import {execSync} from 'child_process';
execSync('ffmpeg -i ./audio.mp3 -ar 16000 ./audio.wav -y');
await transcribe({
  inputPath: './audio.wav',
  whisperPath,
  whisperCppVersion: 'v1.5.4',
  model: 'base.en',
  tokenLevelTimestamps: false,
});
Defensive patterns

Strategy: validation

Validate before calling

function assertIsWavFile(inputPath: string): void {
  if (!inputPath.toLowerCase().endsWith('.wav')) {
    throw new Error(
      `Input must be a .wav file. Got: ${inputPath}. Convert with: ffmpeg -i input -ar 16000 output.wav -y`
    );
  }
}

// Before calling transcribe():
assertIsWavFile(inputPath);

Type guard

function isWavFile(p: string): boolean {
  return p.toLowerCase().endsWith('.wav');
}

Prevention

When it happens

Trigger: Calling transcribe() with an inputPath whose filename does not end in .wav, such as .mp3, .mp4, .m4a, .flac, or any non-wav extension. The isWavFile() helper inspects the file extension (case-insensitive) and rejects anything else.

Common situations: Passing the raw downloaded media file (mp4/mp3) directly to transcribe without an ffmpeg conversion step; wav file generated but named with a different extension; user assumes whisper.cpp handles arbitrary audio formats.

Related errors


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