Hacker News new | ask | show | jobs
by ThatPlayer 988 days ago
There's also video encoding reasons. Modern video compression uses p-frames, predicted frames, that are based on previous frames. With longer scenes and less movement, you want lots of p-frames for good compression.

This makes being able to arbitrarily inject an ad video at a random point hard if there isn't an immediate full complete frame immediately after. You can't just fill the video with them, as that would make compression worse. You don't want to fully re-encode the video either, that takes up CPU time.

I've run into this myself using ffmpeg to cut out clips of videos. You can use the option of "-c copy" to copy a stream without re-encoding it, and it'll pick the previous full frame and be less accurate.

There's also web reasons with CDNs. Embedding in the video stream would require serving from the same server as the video. That would raise the costs of your CDNs. With targeted ads, you don't want to show the same ad to everyone, and you don't want to be limited to ads on that server when you do an ad auction.

https://en.wikipedia.org/wiki/Video_compression_picture_type...

https://trac.ffmpeg.org/wiki/Seeking#Seekingwhiledoingacodec...

1 comments

This was solved in broadcast a long time ago, I'd imagine similar could be done for videos delivered to web browsers, but you'd still be able to detect the insertion then I guess, so it wouldn't be very useful (unless its WideVine/HDCP or similar so it couldn't easily be seen, but eh)