Mplayer

From Tomelec
Revision as of 14:08, 17 September 2011 by Tom (talk | contribs)

Jump to: navigation, search

Flash Video (FLV) to wav or mp3

It´s can be in two easy steps. First extract the audio track using mplayer, then encode the wav-file to an mp3 using lame. The -novideo option makes this operation faster.

mplayer -ao pcm:file=sound.wav -novideo flashvideo.flv
lame sound.wav sound.mp3

This can be used to get playable mp3 files from downloaded Youtube videos. Possibly there is a better way with mencoder?


Video to PNG files

Writing a PNG file for each frame in the Video file. PNG files will be written to the current directory.

mplayer -nosound -benchmark -vo png:z=0 /path/to/video.avi

Output files are named 00000001.png, 00000002.png, 00000003.png, ...

It might be useful to crop and/or scale the video before writing PNGs:

mplayer -nosound -benchmark /path/to/video.avi -vf crop=100:10:80:80,scale=50:50 -vo png:z=0

This takes a 80x80px area, starting from (x,y)=(100,10), scales it to 50x50px and writes a PNG file for each frame. The result is a directory full of PNGs - a PNG sequence.


Play PNG sequence

Mplayer is able to play PNG sequences. All PNGs must have the same geometry. The framerate ist defined by the -fps option. The command must be executed in the directory of the PNG files.

mplayer mf:// type=png -fps 25

Add a scaling video filter for very small images. Software scaler 4 is useful to observe each pixel without blurring.

mplayer mf:// -mf type=png -vf scale=320:240 -fps 25  
mplayer mf:// -mf type=png -vf scale=320:240 -sws 4 -fps 25


Deinterlacing Filter

Here is a great overview with examples of mplayer´s deinterlacing filters: link


Play a Tuxbox stream

mplayer http://dbox:31339/$(printf '%04x,' $(GET http://dbox/control/zapto?getpids) )