how youtube produce different quality video for one uploaded video [closed]

£可爱£侵袭症+ 提交于 2020-01-25 19:49:04

问题


I am developing a video sharing website. I do all things well but one question in mind.

example: I upload a video of 720p to youtube. well but the issue is:

youtube shows different quality videos in the player like 360p 480p etc

Question: will they encode this video while uploading to different types?

or

Question: is there ability of flash/html5 player that provide different resolution having different size for the same uploaded video?

BR


回答1:


They transcode the video. You need to do that before the user wants it, e.g. a video is uploaded, you transcode it (into different qualities and formats - you might choose 360p, 480p, 1080p, 1440p and 4K in MP4, webm and ogg for each), then the visitor loads the page, and by assessing their hardware and network, you choose the right format for them.

A good way to do this is to use AWS's Elastic Transcoder service and to store the videos in S3 - you'll need a lot of storage quite quickly.

AWS's Elastic Transcoder deals with setting all this up, and it's pretty reasonsable:

"Pay only for what you use. There is no minimum fee. Pricing depends on the duration and resolution of the content that you output."

It looks like they charge about $0.15 to turn 10 minutes of video into an SD format, and double that for HD.

The formats they allow you to transcode to are:

You should plan for multiple resolutions of multiple formats, depending on how old browsers/mobile devices you want to support.




回答2:


Upon upload, YouTube and all other video-hosting sites I know of reencode the source video into a number of different formats and resolutions, and store them all as separate stable blobs. The only other option (re-encoding on the fly) is absolutely unscalable and needlessly inefficient. Yes, storing a Cartesian product of formats and sizes of each video is heavy, storage-wise, but storage is cheaper than CPU.

I'd recommend watching this excellent YouTube video on how YouTube works (from a high level perspective). It directly addresses literally the exact same question you're asking.



来源:https://stackoverflow.com/questions/29874922/how-youtube-produce-different-quality-video-for-one-uploaded-video

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!