Why Cant i skip ahead on a MP4 video on a web page i made?

旧巷老猫 提交于 2019-12-13 08:56:33

问题


I have an Apache server set up and have made a simple web page,with a video on it. The video plays, but if i try to skip ahead or behind it freezes up. If i click the pause/play button it will usually go back to the beginning of the video. The video is MP4 format.It might be worth noting that the video is a rather large file as the video I'm trying to play is a hour long. I've tried smaller files and they seem to play fine and i can seek as much as i want. Also if open the web page locally it works, so I'm thinking it has something to do with downloading/buffering the video i just don't know where to start to try and fix it.


回答1:


If it's working with smaller files but not larger ones I would check where the meta data element (MOOV atom) in your mp4 is. By default it's at the end, which means accurating seeking won't be able to happen until the web browser has read the entire file.

You can address this using FFmpeg to relocate the MOOV atom to the front so the browser is able to request the correct parts of the file (assuming your server is configured to support byte range requests):

./ffmpeg -y -i SourceFile.mp4 -c:v copy -c:a copy -movflags faststart DestFile.mp4

this will simply re-position the MOOV atom, and copy the audio and video (no reprocessing) - so once the basics are working you might want to look at other optimizations you can do to improve the experience.



来源:https://stackoverflow.com/questions/51584700/why-cant-i-skip-ahead-on-a-mp4-video-on-a-web-page-i-made

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