Adding video uploads to documents in Sanity.io
You have three main options for adding video uploads to your Sanity documents:
1. File Field Type (Basic Video Storage)
For simple video uploads without transcoding or streaming features, you can use the standard file field type. This works well if you just need to store video files and provide download links.
{
name: 'myVideo',
title: 'Video File',
type: 'file',
options: {
accept: 'video/*'
}
}Videos uploaded this way are stored in Sanity's Content Lake and can be accessed via URL. You can append ?dl to the URL to trigger downloads. This approach is straightforward but doesn't include video-specific features like transcoding, adaptive streaming, or thumbnails.
2. Mux Plugin (Recommended for Professional Video)
For a professional video experience with streaming, transcoding, and analytics, the Mux plugin is the best choice. Mux is Sanity's official technology partner for video and provides:
- Automatic transcoding and optimization for all devices
- Adaptive quality streaming with global CDN delivery
- Auto-generated captions and 4K support
- Video analytics and playback monitoring
- Thumbnail generation and metadata extraction
Install it with:
npm install sanity-plugin-mux-inputThen add it to your schema:
{
name: 'video',
title: 'Video',
type: 'mux.video'
}The plugin lets editors upload videos directly in Studio, which are then processed by Mux and made available for streaming. Note that Mux is a separate service with its own pricing.
3. Third-Party Video Platforms
You can also embed videos from platforms like YouTube, Vimeo, or Cloudinary by storing their URLs in string fields or using dedicated plugins. This approach works if you're already hosting videos elsewhere and just need to reference them in your content.
Bottom line: Use the file field for basic video file storage, but if you need proper video streaming, transcoding, or a professional video experience, the Mux plugin is the way to go. It's specifically designed for this use case and integrates seamlessly with Sanity Studio.
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.