When trying to render an animation, it doesn't work
It's likely to be one of two things: 


Either the output path you are trying to use is invalid or trying to write the file to a protected non-writable path on your machine, 
OR you are trying to use a video codec that your OS does not support.


Try switching up your output path and/or your video codec and see if the error goes away.

Bonus Tip: It's best to render your animation to a sequence of still images (PNG, JPG, etc), and then render the video from the images. Lots of reasons why this is better (some reasons include: in case animation render fails in the middle, it's easier to render video from images instead of raw render, etc).