Thursday, July 12, 2012

4 cool tricks to do with MPlayer



MPlayer is a very common tool in the Linux world, it is usually used for watching videos or running audios. However, MPlayer has many more features and options. Here are 4 cool tricks you can do with MPlayer:

Take screenshots from video

To manually take screenshots from a video ( for example, video.avi), you can open the terminal and run the following command:

 mplayer -vf screenshot video-file  
After you hit enter, MPlayer will start to run the video at its original resolution. To take screenshots of the video in any moment, you just need to press the letter "s". Each time you press "s", one screenshot will be taken.

Convert files into .wav format

You already know how to use ffmpeg to convert an audio file to .wav format and you can use MPlayer to do the task too. The cool thing about MPlayer is that you can directly convert the audio of a video file into a separate .wav file too. The command to do the trick is:
 mplayer input.avi -vc null -vo null -ao pcm:fast:waveheader:file=output.wav
Just replace input.avi with whatever video or audio file you want. With this command, MPlayer will ignore the video part and convert the audio part into a .wav file.

Play videos in the terminal

You can use MPlayer to play videos in the linux terminal. The drawback with this trick is that the video will be played in ASII mode so the video quality sucks. However, you will gain a lot of coolness points for this trick.

The command to play a video in the terminal will be:
mplayer -vo caca video.avi
If you want to watch the video in black and white color, the command will be:
mplayer -vo aa video.avi

Just replace video.avi with any other video you want.

Here is an example of a video running in the terminal:
 
 Create GIF images 
There are many tools to create animated GIF images and MPlayer is one of them. To create a GIF image from a video, the command you can use is:

mplayer video-file -ao null -ss 0:00:15 -endpos 15 -vo gif89a:fps=24:output=animated.gif -vf scale=400:280

Here is what the variables in this command mean:

"video-file": the video from which you want to create the GIF
"-ss 0:00:15" : when the GIF starts in the video, replace 0:00:15 with what you want
"-endpos 15": the length of the GIF, replace 15 with what you want
"gif89a:fps=24" : 24 here means 24 frames/seconds
"output=animated.gif" : change the animated.gif into the file name you want
"scale=400:280" : dimensions of the GIF

Here is an example of a GIF created with MPlayer:


*****************

Hope you find this article cool and useful.

No comments:

Post a Comment