{"record":{"id":"41a7759e8fc00718","repo":"remotion-dev/remotion","slug":"invalid-inputfile-type-the-provided-file-is-not-a","errorCode":null,"errorMessage":"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\"","messagePattern":"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\"","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/install-whisper-cpp/src/transcribe.ts","lineNumber":325,"sourceCode":"\tlanguage?: Language | null;\n\tsplitOnWord?: boolean;\n\tsignal?: AbortSignal;\n\tonProgress?: TranscribeOnProgress;\n\tflashAttention?: boolean;\n\tadditionalArgs?: AdditionalArgs;\n}): Promise<TranscriptionJson<HasTokenLevelTimestamps>> => {\n\tif (!existsSync(whisperPath)) {\n\t\tthrow new Error(\n\t\t\t`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.`,\n\t\t);\n\t}\n\n\tif (!existsSync(inputPath)) {\n\t\tthrow new Error(`Input file does not exist at ${inputPath}`);\n\t}\n\n\tif (!isWavFile(inputPath)) {\n\t\tthrow new Error(\n\t\t\t'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\"',\n\t\t);\n\t}\n\n\tconst tmpJSONDir = path.join(process.cwd(), 'tmp');\n\n\tconst {outputPath: tmpJSONPath} = await transcribeToTemporaryFile({\n\t\tfileToTranscribe: inputPath,\n\t\twhisperPath,\n\t\twhisperCppVersion,\n\t\tmodel,\n\t\ttmpJSONPath: tmpJSONDir,\n\t\tmodelFolder: modelFolder ?? null,\n\t\ttranslate: translateToEnglish,\n\t\ttokenLevelTimestamps,\n\t\tprintOutput,\n\t\ttokensPerItem: tokenLevelTimestamps ? 1 : (tokensPerItem ?? 1),\n\t\tlanguage: language ?? null,","sourceCodeStart":307,"sourceCodeEnd":343,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/install-whisper-cpp/src/transcribe.ts#L307-L343","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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().","Verify the input file extension is .wav (case-insensitive) before calling transcribe().","Automate the conversion step in a pipeline so non-wav sources are always pre-processed.","Check that the wav file is mono PCM at 16 kHz sample rate for best whisper.cpp compatibility."],"exampleFix":"// before\nawait transcribe({\n  inputPath: './audio.mp3', // wrong format\n  whisperPath,\n  whisperCppVersion: 'v1.5.4',\n  model: 'base.en',\n  tokenLevelTimestamps: false,\n});\n\n// after\nimport {execSync} from 'child_process';\nexecSync('ffmpeg -i ./audio.mp3 -ar 16000 ./audio.wav -y');\nawait transcribe({\n  inputPath: './audio.wav',\n  whisperPath,\n  whisperCppVersion: 'v1.5.4',\n  model: 'base.en',\n  tokenLevelTimestamps: false,\n});","handlingStrategy":"validation","validationCode":"function assertIsWavFile(inputPath: string): void {\n  if (!inputPath.toLowerCase().endsWith('.wav')) {\n    throw new Error(\n      `Input must be a .wav file. Got: ${inputPath}. Convert with: ffmpeg -i input -ar 16000 output.wav -y`\n    );\n  }\n}\n\n// Before calling transcribe():\nassertIsWavFile(inputPath);","typeGuard":"function isWavFile(p: string): boolean {\n  return p.toLowerCase().endsWith('.wav');\n}","tryCatchPattern":null,"preventionTips":["Always pre-convert source audio to 16 kHz wav with ffmpeg before transcribe().","Add a file-extension check in your pipeline before calling transcribe().","Ensure ffmpeg writes the output with a .wav extension.","Document the 16 kHz mono PCM requirement for team members building pipelines."],"tags":["install-whisper-cpp","audio-format","ffmpeg","validation","precondition"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}