文件上传问题
我正在为我的网站实现类似 Youtube 的场景——上传视频,以便所有人都可以观看。 我的问题是,我认为我们需要在上传后对视频进行编码,然后其他人才能远程播放,但编码过程非常慢(我尝试使用 Microsoft Expression Encoder 和 mplayer,编码 20 分钟的视频大约需要 10 分钟)。 令我惊讶的是,即使我们上传一个非常大的视频到Youtube,似乎其他人也可以立即选择并播放,看起来编码过程几乎花费了零时间。
请问有人有什么想法吗? YouTube 的编码过程为何如此神奇? 或者Youtube完全跳过编码过程——但是如果跳过编码过程,Youtube如何确保所有上传的视频都可以播放(即视频遵循一些参数,如比特率、图片大小或其他参数)?
提前致谢, 乔治
I am implementing a similar scenario like Youtube for my web site -- uploading video and so that all people could watch. My question is, I think we need to encode the video after upload before other people could play remotely, but encode process is very slow (I tried with Microsoft Expression Encoder and also mplayer, encode a 20 mins video takes about 10 mins). To my surprise, even if we upload a very big video to Youtube, seems other people could select and play immediately, looks like encoding process takes almost zero time.
Does anyone have any ideas please? How did Youtube do encode process so fast magically? Or Youtube totally skip the encode process -- but if skip encode process, how could Youtube ensure all video uploaded is playable (i.e. videos follow some parameter, like bit rate, picture size or something)?
thanks in advance,
George
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
不要忘记 YouTube 归 Google 所有,因此拥有 450,000 个可用服务器帮助!
(我承认,这个答案有点滑稽。显然 YouTube 无法访问所有这些内容。但重点仍然是,他们将拥有大量资源来解决这个问题)
Don't forget that YouTube is owned by Google, so having 450,000 servers available may help !
(a slightly facetious, answer, I confess. And obviously YouTube won't have access to all of those. But the point remains that they'll have phenomenal amounts of resource to throw at this issue)
在做任何其他事情之前,先获得一个更好的编码器。 有很多可用的编码器。 有些是开源的,有些是专有的。 苹果有一些非常非常好的编码器,速度快,但价格昂贵。
查看 http://www.ffmpegx.com/ 了解开源编码器的最新技术技术。 它们集成了多种技术。
Before doing anything else, get a better encoder. There are lots of encoders available. Some are open source, some are proprietary. Apple has some very, very nice encoders that are fast, but expensive.
Look at http://www.ffmpegx.com/ for the state of the art in open-source encoder technology. They integrate a diverse set of technologies.
另外,youtube 可能使用硬件编码器。
并且,只有在编码比播放快的情况下才可以在编码时播放。
Also, hardware encoder probably is used by youtube.
And, is it possible playing while encoding only if encode is fast than play it.
如果没有任何特定的内部知识,我希望(1)将输入视频切成较短的片段以发送到多个编码器,以及(2)在上传流的同时对流进行编码,而不是等到上传完毕整个文件开始。
不,所有内容都必须转换为FLV才能播放。
Without any particular insider knowledge, I would expect (1) chopping the input video into shorter segments to send to multiple encoders, and (2) encoding the stream at the same time as you are uploading it, rather than waiting until you've uploaded the entire file to start.
No, everything must be converted to FLV for playback.