Difference between revisions of "Mplayer"

From Tomelec
Jump to: navigation, search
Line 4: Line 4:
 
lame sound.wav sound.mp3</nowiki>
 
lame sound.wav sound.mp3</nowiki>
 
This can be used to get playable mp3 files from downloaded Youtube videos. Possibly there is a better way with mencoder?
 
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 ==
 
== Video to PNG files ==
Line 12: Line 13:
 
It might be useful to crop and/or scale the video before writing PNGs:
 
It might be useful to crop and/or scale the video before writing PNGs:
 
  <nowiki>mplayer -nosound -benchmark /path/to/video.avi -vf crop=100:10:80:80,scale=50:50 -vo png:z=0</nowiki>
 
  <nowiki>mplayer -nosound -benchmark /path/to/video.avi -vf crop=100:10:80:80,scale=50:50 -vo png:z=0</nowiki>
This takes a 80x80px area, starting from (x,y)=(100,10), scales it to 50x50px and writes a PNG file for each frame.
+
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.
 +
<nowiki>mplayer mf:// type=png -fps 25</nowiki>
 +
Add a scaling video filter for very small images. ''Software scaler 4'' is useful to observe each pixel without blurring.
 +
<nowiki>mplayer mf:// -mf type=png -vf scale=320:240 -fps 25 
 +
mplayer mf:// -mf type=png -vf scale=320:240 -sws 4 -fps 25

Revision as of 15:00, 17 September 2011

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.

<nowiki>mplayer mf:// -mf type=png -vf scale=320:240 -fps 25  

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