Thumbnail from video or audio

Hello. How could I get a thumbnail generated from a video or audio file?