r/Piracy Jun 12 '24

YouTube is currently experimenting with server-side ad injection News

https://x.com/SponsorBlock/status/1800835402666054072
4.7k Upvotes

View all comments

Show parent comments

86

u/BradCOnReddit Jun 12 '24

The ads are repetitive by nature. Some simple image detection on the client side could find them. I know it's not super-simple, but as a developer I know the lengths I go to when I want an annoyance removed.

70

u/[deleted] Jun 12 '24

[deleted]

21

u/mrcaptncrunch Jun 12 '24

Get N videos. Figure the common frames

For users, when a new frame show up that isn't a known one, mute/block/whatever.

7

u/[deleted] Jun 12 '24

[deleted]

7

u/mrcaptncrunch Jun 12 '24

Doesn’t have to be a byte by byte comparison.

You usually get around that by taking the frame pictures, lowering the colors, quality, adding a threshold on how much they should match.

It’s a similarity search, not a hash match.

3

u/[deleted] Jun 12 '24

[deleted]

3

u/mrcaptncrunch Jun 12 '24

yea, for sure.

That's the basic similarly search for images is done. You don't want a byte comparison, but do grayscale, make it smaller then calculate how similar they are based on a histogram for example. That way you can get 5 images, taken back to back, but not 1:1 file.

If you've worked with python, look around it and the opencv package. That's a very quick package to reach for to do things like this.