{"record":{"id":"55033fa96ca02949","repo":"remotion-dev/remotion","slug":"the-selected-media-does-not-have-an-audio-track","errorCode":null,"errorMessage":"The selected media does not have an audio track.","messagePattern":"The selected media does not have an audio track\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/studio/src/components/Transcription/resample-media-to-16-khz.ts","lineNumber":44,"sourceCode":"\t});\n\tconst waveformChunks: Array<{\n\t\treadonly startFrame: number;\n\t\treadonly waveform: Float32Array;\n\t}> = [];\n\n\ttry {\n\t\tonProgress(0);\n\t\tconst audioTracks = await input.getAudioTracks();\n\t\tconst primaryVideoTrack =\n\t\t\taudioStreamIndex === null ? await input.getPrimaryVideoTrack() : null;\n\t\tconst audioTrack =\n\t\t\taudioStreamIndex !== null\n\t\t\t\t? (audioTracks[audioStreamIndex] ?? null)\n\t\t\t\t: primaryVideoTrack\n\t\t\t\t\t? await primaryVideoTrack.getPrimaryPairableAudioTrack()\n\t\t\t\t\t: (audioTracks[0] ?? null);\n\t\tif (audioTrack === null) {\n\t\t\tthrow new Error('The selected media does not have an audio track.');\n\t\t}\n\n\t\tif (await audioTrack.isLive()) {\n\t\t\tthrow new Error('Live media cannot be transcribed.');\n\t\t}\n\n\t\tconst output = new Output({\n\t\t\tformat: new WavOutputFormat(),\n\t\t\ttarget: new NullTarget(),\n\t\t});\n\t\tconst conversion = await Conversion.init({\n\t\t\tinput,\n\t\t\toutput,\n\t\t\ttracks: 'all',\n\t\t\tvideo: {discard: true},\n\t\t\taudio: (track) => {\n\t\t\t\tif (track.id !== audioTrack.id) {\n\t\t\t\t\treturn {discard: true};","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/studio/src/components/Transcription/resample-media-to-16-khz.ts#L26-L62","documentation":"resampleMediaTo16Khz resolves the audio track of the selected media (explicit index, primary video's pairable audio track, or first track). Whisper transcription requires 16kHz mono audio, so if no audio track can be resolved, the function throws instead of failing later during decoding.","triggerScenarios":"Calling resampleMediaTo16Khz with media that has zero audio tracks, or with audioStreamIndex pointing at a nonexistent track index, or a video-only file where no pairable audio track exists.","commonSituations":"Selecting a silent video (muted export), an image sequence render, or a subtitle-only asset for transcription; passing a wrong audioStreamIndex; media whose codec is not pairable with the output.","solutions":["Select a media file that actually contains an audio track.","Verify the audioStreamIndex is within the number of audio tracks of the media.","Remux/convert the media to include an audio track (e.g. via ffmpeg) before transcribing.","If the source legitimately has no audio, skip transcription — captions cannot be generated from it."],"exampleFix":"// before\naddCaptionJob({src: videoWithoutAudio, ...});\n// after\nconst hasAudio = getAudioTracks(src).length > 0;\nif (hasAudio) addCaptionJob({src, ...});","handlingStrategy":"validation","validationCode":"const audioTracks = await getAudioTracks(src);\nif (audioTracks.length === 0) {\n  throw new Error('Source has no audio track; cannot transcribe.');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await transcribe(src);\n} catch (e) {\n  if (e.message.includes('does not have an audio track')) {\n    showHint('Choose a media file with audio.');\n  }\n}","preventionTips":["Check track counts before starting transcription.","Validate audioStreamIndex bounds.","Handle image/video-only assets separately."],"tags":["audio","media","transcription"],"backgroundTag":"resource-not-found","analyzedSha":"b2f4e34732f3c6c222ea029413e22dc402218cd7","analyzedAt":"2026-09-09T13:27:51.281Z","contentChangedAt":"2026-09-09T13:27:51.281Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}