This can be done without installing any software and will work with any browser.
We just need to edit the file /etc/hosts and add a few lines :
sudo nano /etc/hosts
The hosts file is just a text file, used to map hostnames to IP adresses.
Anytime an entry listed in your hosts file is requested on the page you are viewing, your computer thinks 127.0.0.1 is the location of the file....( your computer will automatically check the hosts file first before DNS for entries to the web page you just requested ).
127.0.0.1 is the standard IP address used for a loopback network connection. This means that if you try to connect to 127.0.0.1, you are immediately looped back to your own machine. 127.0.0.1 is also referred to as localhost.
Link : http://www.lolloland.com/2012/12/12/technote-how-to-remove-video-ads-youtube/