Today I filed a formal complaint against #YouTube with the Irish Data Protection Commissioner for their illegal deployment of #adblock detection technologies.
Under Article 5(3) of 2002/58/EC YouTube are legally obligated to obtain consent before storing or accessing information already stored on an end user's terminal equipment unless it is strictly necessary for the provisions of the requested service.
In 2016 the EU Commission confirmed in writing that adblock detection requires consent.
MythTV has a broadcast television ad detection module and it works pretty damn well.
This goes into a bit of detail on it’s methods:
https://www.mythtv.org/wiki/Commercial_detection
A lot of what it does could be applied to a video stream, although adapting it to useful real-time could be tricky.