I'm currently trying to implement a video player using Media Source Extensions. Currently just a very simple proof of concept, following a tutorial I found here.
I cloned their repo with all source code from github here and am testing the implementation on Chromium and Firefox with various video files.
Everything worked well with the example webm files in the repo for both browsers.
Next I tried to convert a video I downloaded from some random site using ffmpeg and mse-tools to "align the clusters" of the webm file using the following commands:
ffmpeg -i randomvideo.mp4 -c:v libvpx -c:a libvorbis output.webm
mse_webm_remuxer output.webm aligned.webm
Again, all was well on both browsers.
Finally, I wanted to convert a very simple animation I created in blender (rendered with h264 in mp4).
I tried converting the resulting file using the same process as above and the file played normally on firefox, but did not load on chromium.
I assume I am commiting some error when converting the file, but inspecting the attributes of the final file with vlc and ffprobe, I could not find any obvious problems.
Any ideas as to what I am doing wrong?
One final test I did was to go to this site to get some sample webm files.
I downloaded the "Big Buck Bunny Trailer in WebM" and "Elephants Dream as WebM File".
Both files worked in firefox, but the "Elephants Dream" file would not play in chromium.
I am on a linux machine (Arch Linux distro) with the following versions of the browsers:
Chromium Version 69.0.3497.100 (Official Build) Arch Linux (64-bit)
Firefox 62.0.3 (64-bit)
I have shared the file I created from the blender animation (very small - only 36 KB) on google drive here in case anyone wants to check it out.
So, after banging my head over the weekend, I finally figured out the problem with my tiny blender rendered mp4 file. Posting it here in case anyone has a similar problem.
I tried converting my original mp4 file with various other software suites to see if ffmpeg was doing something that was making my final webm file incompatible. Tried a couple of online converters and a comercial video converter (trial copy), but all had the same result. No video with MSE. Then, by chance I converted it using KDENLIVE. Not really a conversion, but rather a "rendering" as if it were a video editing project. To my surprise, it worked! Upon inspecting the diference between the files, I noticed that KDENLIVE added an audio stream to the webm file.
This led me to the realization that the original file without audio was generating a webm file with mime type of 'video/webm; codecs="vp8"'
(and not 'video/webm;codecs = "vp8,vorbis"'
). So the solution for me was to either change the mimetype passed to addSourceBuffer()
or to generate the webm file with a muted audio stream (thus creating a file of type 'video/webm;codecs = "vp8,vorbis"'
).
Both solutions above worked and my file was able to play in chromium.
Just as a final side note, the "Elephants Dream" file from this webm demo files site still is not playing as is, but I did "re-render" it with kdenlive, and also reencoded it with ffmpeg, and in both cases, the new file worked. So I believe, there may be some issue with the original file.