{"record":{"id":"fd4e284eedfdc0f9","repo":"vercel/ai","slug":"unsupported-video-mime-type-mimetype-expected","errorCode":null,"errorMessage":"Unsupported video mime type: ${mimeType}, expected one of: ${Object.keys(BEDROCK_VIDEO_MIME_TYPES).join(', ')}","messagePattern":"Unsupported video mime type: (.+?), expected one of: (.+?)","errorType":"exception","errorClass":"UnsupportedFunctionalityError","httpStatus":null,"severity":"error","filePath":"packages/amazon-bedrock/src/convert-to-amazon-bedrock-chat-messages.ts","lineNumber":686,"sourceCode":"): AmazonBedrockDocumentFormat {\n  const format =\n    BEDROCK_DOCUMENT_MIME_TYPES[mimeType as AmazonBedrockDocumentMimeType];\n  if (!format) {\n    throw new UnsupportedFunctionalityError({\n      functionality: `file mime type: ${mimeType}`,\n      message: `Unsupported file mime type: ${mimeType}, expected one of: ${Object.keys(BEDROCK_DOCUMENT_MIME_TYPES).join(', ')}`,\n    });\n  }\n  return format;\n}\n\nfunction getAmazonBedrockVideoFormat(\n  mimeType: string,\n): AmazonBedrockVideoFormat {\n  const format =\n    BEDROCK_VIDEO_MIME_TYPES[mimeType as AmazonBedrockVideoMimeType];\n  if (!format) {\n    throw new UnsupportedFunctionalityError({\n      functionality: `video mime type: ${mimeType}`,\n      message: `Unsupported video mime type: ${mimeType}, expected one of: ${Object.keys(BEDROCK_VIDEO_MIME_TYPES).join(', ')}`,\n    });\n  }\n\n  return format;\n}\n\nfunction trimIfLast(\n  isLastBlock: boolean,\n  isLastMessage: boolean,\n  isLastContentPart: boolean,\n  text: string,\n) {\n  return isLastBlock && isLastMessage && isLastContentPart ? text.trim() : text;\n}\n\ntype SystemBlock = {","sourceCodeStart":668,"sourceCodeEnd":704,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/amazon-bedrock/src/convert-to-amazon-bedrock-chat-messages.ts#L668-L704","documentation":"getAmazonBedrockVideoFormat maps a video MIME type to a Bedrock video format and throws UnsupportedFunctionalityError when it is not in BEDROCK_VIDEO_MIME_TYPES (mkv and mov). Bedrock's video input is limited to these containers.","triggerScenarios":"Passing a video part with mediaType outside {video/x-matroska, video/quicktime} — most commonly video/mp4, video/webm, or video/avi.","commonSituations":"Most recorded and downloaded videos are MP4/WebM, so this fires frequently; developers assume MP4 is universally supported but Bedrock requires mkv or mov containers.","solutions":["Remux/transcode the video to MOV (or MKV) with ffmpeg: ffmpeg -i in.mp4 -c copy out.mov (or re-encode if codecs are unsupported).","Set the mediaType to video/quicktime after conversion.","Check the 'expected one of' list in the error for the currently supported containers.","If only a frame is needed, extract a PNG/JPEG frame and send it as an image part instead."],"exampleFix":"// before\n{ type: 'file', mediaType: 'video/mp4', data: mp4Bytes }\n// after\nexecSync(`ffmpeg -i clip.mp4 -c copy clip.mov`);\n{ type: 'file', mediaType: 'video/quicktime', data: readFileSync('clip.mov') }","handlingStrategy":"validation","validationCode":"const SUPPORTED_VIDEO = ['video/x-matroska','video/quicktime'];\nif (!SUPPORTED_VIDEO.includes(videoPart.mediaType)) {\n  throw new Error(`Transcode ${videoPart.mediaType} to MOV/MKV before sending to Bedrock`);\n}","typeGuard":"function isBedrockSupportedVideo(mediaType) {\n  return ['video/x-matroska','video/quicktime'].includes(mediaType);\n}","tryCatchPattern":"try {\n  return await generateText({ model, messages });\n} catch (error) {\n  if (UnsupportedFunctionalityError.isInstance(error) && error.message.includes('Unsupported video mime type')) {\n    console.error('Bedrock only accepts mkv/mov videos; transcode with ffmpeg first.');\n  }\n  throw error;\n}","preventionTips":["Transcode uploads to MOV (or MKV) with ffmpeg at ingest time.","Probe container type with ffprobe rather than trusting file extensions.","Document the mkv/mov restriction wherever video uploads are accepted."],"tags":["unsupported-functionality","bedrock","video","mime-type"],"backgroundTag":"unsupported-media-type","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}