Ugly black bars appear on videos, both on TV and on the web, when the aspect ratios of your video and the housing it lives in don’t match.
Why black bars appear
The issue is most clear in the case of TV, so let’s start there.
Prior to HDTV, televisions and the video created for them followed a 4:3 aspect ratio. With HDTV came a new standard of 16:9. What happens when you watch a video created at the old aspect ration of 4:3 on a TV that is 16:9? Black bars show up on either side to fill the extra space (image credit):