I am using GAE to serve large files, and I can successfully serve mp3 using a simple blobstoreService.serve(key, res);
If I put the resource url in the browser, the media control will appear and/or the media player will start, and the music will start before the download is complete.
However, when I put a mp4 url in the Chrome, the control appears but nothing happens. Here are what I have done:
Accept-Ranges:bytes
to the first request and I have observed that the next request still asks for full 75MB range. Should I only serve partially even though the browser asks for all?The html code looks like below except my GAE url is the src. The example mp4 works but if my gae link is there, it doesn't show video at all.
<video width="640" controls=""> <source src="http://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4"> Your browser does not support HTML5 video. </video>
What exactly are needed to do on GAE server side to serve the video using streaming?
The marked answer has sufficient information on how to serve the mp4 file and it also gives a live web page for demo. From that demo, I was able to tell that my site could serve an mp4 file as long as the Chrome browser could decode it. The problem I encountered was due to the codec used in ffmpeg wasn't recognized by Chrome. Changed to H.264, everything worked fine.
Here is one example of the ffmpeg command line, where OK.MTS is the camcorder file, output1.mp4 is to be uploaded:
ffmpeg -i ok.MTS -codec:v libx264 -profile:v baseline -preset slow -b:v 500k -maxrate 800k -bufsize 1000k -vf scale=-1:432 -threads 0 -b:a 96k output1.mp4
Is your handler putting the correct Content-Type in the response headers? You need to be setting "Content-Type:video/mp4" for the video to play correctly.
Here is a test site I wrote on App Engine that plays mp3, ogg and mp4 files from Cloud Storage and the BlobStore.
Here is a link to an mp4 file in the BlobStore that uses serve() to return the file. When I paste this link into chrome the content plays correctly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With