6 ms·
Why don’t they encode on the uploader machine?
by samwestdev 5y ago
Why don’t they encode on the uploader machine?
- pta2002 5y agoCan't trust user input, you'd have to spend quite a bit of energy just checking to see if it's good. You also want to transcode multiple resolutions, it'd end up being quite slow if it's done using JS.
- amelius 5y agoVerification is simpler than encoding, I suppose.
- londons_explore 5y agoChecking the result is good shouldn't be too hard - a simple spot check of a few frames should be sufficient, and it isn't like the uploader gets a massive advantage for uploading corrupt files. The CPU and bandwidth costs of transcoding to 40+ different audio and video formats would be massive though. I could imagine a 5 minute video taking more than 24 hours to transcode on a phone.
- simcop2387 5y ago> Checking the result is good shouldn't be too hard - a simple spot check of a few frames should be sufficient, and it isn't like the uploader gets a massive advantage for uploading corrupt files. Uploading corrupt files could allow the uploader to execute code on future client machines. You must check every frame and the full encoding of the video.
- kevincox 5y agoMust is a strong word. In theory browsers and other clients treat all video stream as untrusted and it is safe to watch an arbitrary video. However complex formats like videos are a huge attack surface. So yes, for the bigger names like Google this is an unacceptable risk. They will generally avoid serving any user-generated complex format like video, images or audio to users directly. Everything is transcoded to reduce the likelihood that an exploit was included.
- mschuster91 5y agoBecause of the massive bandwidth and data requirements. Assuming I as the source have a 20 MBit/s content that is 30 min long - that's about 3.6 GB of data. Given your average DSL uplink of 5 MBit/s, that's 2 hours uploading for the master version... and if I had to upload a dozen smaller versions myself, that could easily add five times the data and upload time.
- greenknight 5y agoImagine someone using a 10 year old computer to upload a 1 hour video. not only do they need to transcode to multiple different resolutions, but also codecs. This would not practical from a business / client relationship. They want their client (the uploader) to spend as little time as possible and get their videos as quickly as possible.
- greenknight 5y agoThough that being said, it would be great to be like hey google, ill do the conversions for you! but then they would have to trust that the bitrate isnt too high / not going to crash their servers etc.etc.etc.
- ThatPlayer 5y agoI wouldn't even say 10 year old computer. Think phones or tablets. As well as the battery drain. Or imagine trying to upload something over 4G.
- bufferoverflow 5y ago> Or imagine trying to upload something over 4G. 4G is perfectly fine for uploading videos. It can hit up to 50 Mbps. LTE-Advanced can do 150 Mbps.
- lbotos 5y agoBecause I make one output file and they optimize for like 7 different resolutions. If they make it longer for me to upload I'd wager that would lower the video upload rate.
- arghwhat 5y agoYouTube needs to re-encode occasionally (new codecs/settings/platforms), it would be easy to abuse and send too high bitrate or otherwise wrong content, and a lot of end-user devices simply isn't powerful enough to complete the task in a reasonable amount of time.
- chrisseaton 5y ago> Why don’t they encode on the uploader machine? Are you basically asking why they don't take a performance-sensitive, specialised, and parallel task and run it on a low-performance, unspecialised, and sequential system? Would take hours and be super inefficient.
- devit 5y agoBecause society results in companies being incentivized to babysit users rather than cutting off those who are unable to learn simple technical skills like optimally encoding a video respecting a maximum bitrate requirement.
- acdha 5y agoWhat about cutting off those who condescend others without recognizing the limits of their own understanding? I’m not an expert in this but I know that “optimally encoding a video” is an actual job. That’s because there’s no global definition of optimal (it varies depending on the source material and target devices, not to mention the costs of your compute, bandwidth, and time); you’re doing it multiple times using different codecs, resolutions, bandwidth targets, etc.; and those change regularly so you need to periodically reprocess without asking people to come back years later to upload the iPhone 13 optimized version. This brings us to a second important concept: YouTube is a business which pays for bandwidth. Their definition of optimal is not the same as yours (every pixel of my masterpiece must be shown exactly as I see it!) and they have a keen interest in managing that over time even if you don’t care very much because an old video isn’t bringing you much (or any) revenue. They have the resources to heavily optimize that process but very few of their content creators do.
- giantrobot 5y ago> simple technical skills like optimally encoding a video respecting a maximum bitrate requirement. This is in no way a "simple skill" as maximum video bitrate is only one of a number of factors for encoding video. For streaming to end users there's questions of codecs, codec profiles, entropy coding options, GOP sizes, frame rates, and frame sizes. This also applies for your audio but replacing frame rates and sizes with sample rate and number of channels. Streaming to ten random devices will require different combinations of any or all of those settings. There's no one single optimum setting. YouTube encodes dozens of combinations of audio and video streams from a single source file. Video it turns out is pretty complicated.
- absove 5y agoSounds like something for the next version of recaptcha