Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moov前置加速视频首次可见 #84

Open
Topppy opened this issue May 26, 2023 · 0 comments
Open

moov前置加速视频首次可见 #84

Topppy opened this issue May 26, 2023 · 0 comments
Milestone

Comments

@Topppy
Copy link
Owner

Topppy commented May 26, 2023

背景

抓到video标签的url在network中请求多次,不同range。
先了解一下下mp4的结构,这里使用meidaParser打开mp4文件
image

可以看到是嵌套的类似文件目录的格式,但是呢是有先后顺序的。
如果把整个mp4看做一本书的话,其中Moov 类似于整本书的目录,mdat就是占这本书99%以上的书的具体内容,也就是视频的具体内容。

如果moov排在mdat后面的话,浏览器第一次请求的时候,发现诶,我没有拿到书本的目录,没法播放视频,就会直接从视频最后的moov部分,等拿到moov之后,再重新播放视频。

所以,moov前置就会避免多余的请求次数,浏览器一开始就能拿到视频目录moov,就能立刻开始知道怎么播放了。

@Topppy Topppy added this to the publish milestone Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant