The bunny.net Stream platform offers MP4 URL access to some resolutions of video enabled, which may be useful in an environment where HLS playback or using our player is not possible (e.g. for legacy devices).
Prerequisites
- You must have a Video Library created. To create one, simply head under the Stream tab and press 'Add Video Library' in the top right.
- You need to have MP4 Fallback enabled under the encoding tab of the created video library
- Only videos uploaded after enabling MP4 Fallback will generate the MP4 file. Please keep in mind that the fallbacks go up to a maximum of 720P in quality if the original permits.
- In addition to the above, we do not upscale videos. A 720P fallback for example cannot be generated if the maximum quality of the original video is 480P, but in that case then play_480p.mp4 would work.
How to retrieve the MP4 URL?
Assuming that the above eligibility criteria have been satisfied, you can generate an MP4 URL employing the subsequent structure:
https://{pull_zone_url}.b-cdn.net/{video_id}/play_{resolution_height}p.mp4
While producing the above mentioned URL, it is critical to bear in mind that the fallback selections are only up to 720p. It may be easier to copy/paste the HLS URL and then change the file on the end to the MP4 URL. Thus, any resolution that is higher than 720p, such as 1080p, will trigger a 404 error because it is not present. If you only have one resolution enabled (for example, 2160p only (and nothing else) then we will generate an MP4 URL for that resolution).
The final link should appear as follows:
https://{pull_zone_url}.b-cdn.net/{video_id}/play_720p.mp4
Useful tip
Constructing the URL for the first time can be quite confusing, luckily, there is an easier way to do this, if the above way does not work for you.
1. Find a video of your choice and open its video card. You can do this by heading into your video library and clicking on a video. Once there, copy the HLS playlist URL.
The pasted link should be in the following format: https://{pull_zone_url}.b-cdn.net/{video_id}/playlist.m3u8?v=Version_ID. The key information needed is the end section, which should be replaced with play_{resolution_height}p.mp4 in order to play the video at the desired resolution. For instance, if the fallback is set to 720p, the modified URL should look like this: https://{pull_zone_url}.b-cdn.net/{video_id}/play_720p.mp4.
Help, I'm seeing a 403/404 error!
If you come across a 403 error, it is crucial to review your security settings because they are likely to blame. Below are some instances of how this could occur.
- Token authentication is enabled, but you are not producing a token or creating it incorrectly.
- Allowed domains are specified, restricting video playback to only authorized domains.
- Direct URL file access is denied. Thus, if you type the URL into your browser's address bar, you'll instantly get a 403 error since you're attempting to access it directly. This is often common on Apple devices, which do not send the right referral headers.
If you're seeing a 404 error, it's most likely because of one of two things:
- An incorrect URL construction.
- The fallback resolution you want to employ does not exist.
If neither of these is the issue, please don't hesitate to contact our team of super bunnies to request assistance. They'll be more than happy to guide you!