I have some videos that are already in WebM format. I can see that ImageKit supports WebM as an output format, but can I also provide it as an input and convert the video to MP4 output so that it works on all kinds of devices that don’t support WebM? Is there any considerations that I should know before converting the video to MP4?
ImageKit supports using WebM as both an input and output format. This means you can take a video in WebM and convert it to MP4 for devices or browsers that don’t support WebM playback. Whether your files are in the ImageKit Media Library or stored on a connected External storage, ImageKit lets you deliver videos in mp4 either automatically or by forcing the format.
ImageKit provides two primary methods to deliver your WebM videos in MP4:
Automatic Video Format Conversion
ImageKit automatically selects the best video format for each user by analyzing factors such as device capabilities, browser support, and your preferences.
Enabling Automatic Format Conversion
To enable this feature, activate the “Use best format for video delivery” setting in your ImageKit dashboard under the video settings.
Alternatively, you can use the URL-based transformation parameter f-auto
to optimize individual videos dynamically. This works similarly to the global setting but allows you to apply the transformation per video rather than system-wide.
Example URL:
https://ik.imagekit.io/ikmedia/docs_images/Community/sample-video.webm/ik-video.mp4?tr=f-auto
When this feature is enabled, ImageKit automatically serves the video in MP4 format if the viewer’s browser doesn’t support WebM—ensuring smooth playback across all devices.
Learn how to optimize videos for web delivery using ImageKit
Forcing an Output Format
If you prefer to specify the output video format manually, ImageKit allows you to do so using URL-based transformation parameters.
How to Force a Specific Format
By appending the format f
parameter to your video’s URL, you can convert a video to a preferred format. This ensures consistent delivery in the desired format, regardless of the user’s browser or device.
Example: Convert a WebM video to MP4
- Original WebM Video:
https://ik.imagekit.io/ikmedia/docs_images/Community/sample-video.webm
- MP4 Output Using ImageKit:
https://ik.imagekit.io/ikmedia/docs_images/Community/sample-video.webm/ik-video.mp4?tr=f-mp4
Important Considerations for WebM to MP4 Conversion
- For video transformation to work, ensure that the URL ends with
.mp4
or.mov
. If your original file does not have one of these extensions, you must append/ik-video.mp4
to the URL. - WebM videos typically have smaller file sizes due to more efficient compression. When converting WebM to MP4, the resulting file may be larger, which could affect loading speed and bandwidth usage.
- WebM is supported in approximately 97% of modern browsers. Therefore, consider this wide compatibility before deciding to convert WebM videos to MP4. You can explore the detailed browser compatibility information here.
Learn how to transform videos using the ImageKit.io URL-based transformation parameters