YouTube warns it might make your viewing experience worse if you don't turn off your ad-blocker
(www.businessinsider.com)
Just build a database of ads. Then use some kind of image hash to compare against the displayed content.