视频托管 - 压缩视频?

发布于 2024-11-06 15:26:15 字数 337 浏览 0 评论 0原文

我计划将视频添加到我的网站(1 分钟长或更少的简短问候剪辑)。由于这是一家初创公司,视频大小非常重要。

  1. 什么格式最适合存储上传的视频(例如:mp4、avi、mpeg、flv)? 要求:质量应该足够好,同时保持文件大小尽可能小。

  2. 我的平台是 PHP。如果用户以不同格式上传视频,是否有用于视频压缩/转换的内置或开源框架?对于照片,我们使用imaggemagik;有类似的视频吗?

  3. 理想情况下,我想避免使用 Flash 视频播放器。有更好的选择吗?

I am planning to add videos to my website (1 minute long or less clips for short greetings). Since this is a startup, video size is very important.

  1. What format is the best to use for storing the uploaded video (e.g.: mp4, avi, mpeg, flv)? Requirement: quality should be decent enough while keeping the file size as low as possible.

  2. My platform is PHP. Are there built-in or open source frameworks for video compression/conversion if a user uploads a video in a different format? For photos we use imaggemagik; is there anything similar for video?

  3. Ideally, I want to avoid using a Flash video player. Is there a better option?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

弥枳 2024-11-13 15:26:16

1) 什么格式最适合存储上传的视频 - mp4、avi、mpeg、flash 等? (要求质量应该足够好,同时保持字段大小尽可能小)。

包含 h.264 的 mp4。然后WebM作为备份。

2) 我的平台是 PHP,如果用户上传不同格式的视频,是否有内置或开源框架用于视频压缩/转换? (就像我们使用 imaggemagik 来处理照片一样,视频也使用类似的方法吗?)

ffmpeg 似乎很受欢迎

3)理想情况下,如果有更好的选择,我想避免使用 Flash 来播放视频?

您至少需要 Flash 来实现向后兼容,但在 h.264 和 WebM 之间,您将获得 HTML 5 视频的广泛支持。

1) What format is the best to use for storing the uploaded video - mp4, avi, mpeg, flash, etc? (req is quality should be decent enough while keeping fiel size as low as possible).

mp4 containing h.264. Then WebM as a backup.

2) My platform is in PHP, are there built -in or open source frameworks for video compression/conversion if a user uploads a different format video? (Like for photos we use imaggemagik, similarly anything for video?)

ffmpeg seems popular

3) Ideally i want to avoid using flash for video if there is a better option?

You'll need Flash for backwards compatibility at least, but between h.264 and WebM you will have wide support in HTML 5 video.

深海里的那抹蓝 2024-11-13 15:26:16

ffmpeg-php 扩展是您所需要的

http://ffmpeg-php.sourceforge.net/

the ffmpeg-php extension is what you need

http://ffmpeg-php.sourceforge.net/

深海蓝天 2024-11-13 15:26:16

mp4 容器和 h264 编解码器是所有浏览器都支持的唯一“一对”。

h265 和 VP9 提供更好的压缩比,但仍然部分受支持,并且在大多数平台上可能没有硬件加速。

对于 h264,通过双通道编码您将获得更好的压缩效果。第一遍创建有关第二遍中使用的视频运动的统计数据。请参阅 ffmpeg 相关文档。

此外,与降低质量参数相比,编码到较小的输出分辨率会产生更好的质量。也就是说,如果您有分辨率为 1080x720 的原始视频,编码为最终 (1080/3)x(720x3) 输出将节省大约 9(3x3) 带宽。所欣赏的质量比以原始比特率 1/9 传输 1080x720 的流要好得多。这是由于大脑的工作方式造成的。

一个好的方法是提供视频的高-中-低表示,并通过 JS 为客户端检测最佳视频。将全高清流式传输到 3G 客户端或将 1080p 视频流式传输到具有 800x400 屏幕的客户端没有任何意义。

mp4 container and h264 codec is the only "couple" supported by all browsers.

h265 and VP9 offers better compression ratio but are still partially supported and probably with no hardware acceleration in most platforms.

As for h264, you will get better compression with double pass encoding. First pass creates statistics about video motion that are used in the second pass. Consult ffmpeg documentation about it.

Also encoding to an smaller output resolution produces better quality than downgrading the quality parameters. That's, if you have an original video with 1080x720 resolution, encoding into a final (1080/3)x(720x3) output will save around 9(3x3) bandwidth. The appreciated quality is much better than streaming a 1080x720 at 1/9 of the original bit-rate. This is due to the way the brain works.

A good approach can be to offer a high-medium-low representation of the video and through JS detect the best video for the client. It doesn't make any sense to stream fullHD to a 3G client or a 1080p video to a client with a 800x400 screen.

甜警司 2024-11-13 15:26:16

考虑使用 http://m.vid.ly 等服务或更全面的服务(例如https://xmaven.com - 这些解决了复杂视频设置带来的麻烦,并且完全可扩展

think about making your life easy with a service like http://m.vid.ly or a more comprehensive service like https://xmaven.com - these take the headache out of messing around with complex video setups and are fully extensible

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文