3 ms·
What do you mean by "technical issues"? Google already has a streaming video player supporting multiple bitrates and formats. They could just do whatever youtub
by t0astbread 6y ago
What do you mean by "technical issues"? Google already has a streaming video player supporting multiple bitrates and formats. They could just do whatever youtube-dl does to pack it into a file or even more optimally, grab it from their video database directly should there be something like that.
- _flux 6y agoExactly, Google has that player, but to replicate the same effect for offline playing you would need to play a playlist or a DASH video and multiple fragments. But I grant it's technically possible to do with a single MPEG file, just not trivial. You would need to prepend the advertisement to the video bitstream (re-encoded with same parameters such as width, height, FPS, intra picture interval) and then do the same for audio, while ensuring the video/audio synchronization is kept intact (MPEG edit lists are not well-supported by players, such as by ffmpeg), while preferably not re-encoding the actual video. A bit more complicated to do the insertion in the middle of the file. It's possible to do, but I don't think it's something that any off-the-shelf tools actually do.
- hnlmorg 6y agoYeah there are off the shelf tools available to the broadcasting industry. But these things are designed to tens of streams, not millions. As usual, it's a scale problem rather than a code problem.
- hnlmorg 6y agoI'd already explained the problem, albeit without much detail. The adverts are a different file to the video files. So you need to either merge them ahead of time or dynamically splice them in real time. Ahead of time: Now you need to not only have a video asset for each bit rate and video format but you need to multiply that with the number of adverts on any given day. This would result in thousands of files, maybe even hundreds of thousands once you take targeted adverts into account. And they'd need to rebuild their entire catalogue whenever an ad campaign ends. Clearly that isn't going to work long term. Real time: Option 2 is to stream the advert then follow immediately with the video content on the same HLS stream. This is much more achievable than option 1 but you are then running the streams like a live TV service where you're dynamically splicing content into existing streams. It isn't difficult to do per stream but it is extra processing compared with the existing set up. The real problem lies with scale. A TV broadcaster might do this with a dozen to a few hundred channels, each with contracts ranging from thousands to hundreds of thousands. Youtube have millions of streams, each which earn pennies from advertising (and even less if they had to download because of the change in advertising model -- as I also described before). So they'd have to pay more and earn less. The financials simply wouldn't stack up. Before you comment that YouTube and Twitch offer live streaming services based around the same advertising models, yes they do, but they also operate using the same stack as the pre-recorded videos because those video streams don't need to be spliced by YouTube / Twitch (any editing happens by the content creators before it hits YouTube and YouTube can show the adverts before or even between the videos by injecting them in the browser (ie so the splicing is managed at the front end rather than on Googles servers). None of this is doable with a "download video" button.