html5 video: very slow loading

我怕爱的太早我们不能终老 提交于 2020-01-15 18:58:30

问题


First: there are topics with the similar title. I browsed them but dint find a satisfactory answer.

I am testing autoloading of html5 video in android and ipad.(Auto load only works in few browsers: Firefox, Opera and Safari).

The video loads instantaneously if it is on the device that is playing. But if the video is on a server it takes very long time to load(It took nearly 5 mins for the video to start).

I dont think the problem is with bandwidth. For testing purpose I have hosted the files on google drive. (accessing Google drive should be pretty fast and the size of the video files are less than 2MB).

Can you suggest how to speed up video loading?

Here is my video element:

<video  id="video1" width="430" height="430" controls  preload="auto" >
<source src="https://drive.google.com/uc?export=download&id=0B0eCCOckMJskRDl2enU4N1JLSGs" type='video/mp4;codecs="avc1.42E01E, mp4a.40.2"'/>
<source src="https://drive.google.com/uc?export=download&id=0B0eCCOckMJskbURTTjJVaG42V0U" type='video/webm;codecs="vp8, vorbis"'/>
</video>

Thanks.


回答1:


The reason it does this is because sometimes the video encoder (whatever programme was used) places the video index at the end of the video file rather than at the beginning. This interferes with progressive download as the browser doesn’t know anything about the file until it has downloaded it and read that index.

Run this program below on it, which will simply re-encode the file, placing the index at the beginning.

http://renaun.com/blog/code/qtindexswapper/

Let me know if this helps.




回答2:


Install qt-faststart, then run the command:

qt-faststart inputfile.mp4 outputfile.mp4


来源:https://stackoverflow.com/questions/25688845/html5-video-very-slow-loading

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!