HTML5滞后的视频MP4 [英] HTML5 lagging videos MP4

查看:194
本文介绍了HTML5滞后的视频MP4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有个问题,当我上传视频到我的网站并在我的HTML5播放器(video.js)中播放视频时,它们比较滞后,但这很奇怪,因为并非所有mp4文件都在网站上滞后只有一些视频,但是当我从我的服务器上下载它们并在我的电脑上播放它时,它正常播放。



为什么有些视频滞后?有人对此有解释吗?如果问题是带宽,那么根据格式,源位速率,帧大小等等的不同而有所不同。 你会想重新编码到一个更适合你的目的大小

  ffmpeg -imy.mp4 - f mp4 -vcodec mpeg4 -b 512k -r 30 -s 640x360 -acodec libfaac -ar 32000 -ab 128k -ac 2 -threads 8 -movflags faststartmy_reduced.mp4

-b =视频比特率(较低的值=较小的视频文件大小...但是它会降低视频质量。)

-s =解析视频,优化它以匹配所需的输出(但要记住保持正确的宽高比)

-movflags =将元数据重新定位到文件的开头,从而减少缓冲时间。

I have a problem, When i upload a video to my website And play the video in my HTML5 player(video.js) They are lagging, But it's weird because not all mp4 files are lagging on the site only some videos, But when i download them from my server and play them on my computer it's playing normal.

Why are some video's lagging? Does someone have a explanation for it?

解决方案

If the problem is bandwidth, then depending on format, source bit rate, framesize etc you'll want to re-encode to a more optimal size for your intended purpose

ffmpeg -i "my.mp4" -f mp4 -vcodec mpeg4 -b 512k -r 30 -s 640x360 -acodec libfaac -ar 32000 -ab 128k -ac 2 -threads 8 -movflags faststart "my_reduced.mp4"

-b = video bit rate (lower value = smaller size of the video file... however it reduces the quality of video.

-s = resolution of the video, optimize it to match desired output (but remember to maintain the correct aspect ration)

-movflags = relocates metadata to the start of the file reducing buffering time

这篇关于HTML5滞后的视频MP4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆