downgoon / -MPEG2-TS-HOWTO

0 stars 0 forks source link

MP4 Time Seeking #6

Open downgoon opened 6 years ago

downgoon commented 6 years ago

现在主流的CDN厂商对视频都支持Time Seeking了。Apache Traffic Server(CDN缓存开源方案)也支持MP4 Plugin来实现MP4 Time Seeking。

https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/mp4.en.html

This module provides streaming media server support for MP4 files. User can send a HTTP request to the server with start argument which is measured in seconds (NOT in binary offset), and the server will respond with the stream such that its start position corresponds to the requested time, for example:

http://v.foo.com/dota2.mp4?start=290.12

This allows performing a random seeking at any time. We can use flash player, vlc, mplayer, firefox or chrome to play the streaming media.

Note

This plugin requires that the moov box in the mp4 file should be ahead of mdat box.

备注:对于moovmdat后面的,需要改写到前面。也有公开的工具支持,比如qt-faststart

It is not a good idea to cache a large mp4 file, many video sites will cut a large video file into many small mp4 files, and each small mp4 file will be less than 80M(bytes), it will be a reasonable choice.

另外在nginx上也有插件支持mp4 seeking: http://nginx.org/en/docs/http/ngx_http_mp4_module.html