Difference between revisions of "Mplayer"

From Tomelec
Jump to: navigation, search
(Play a Tuxbox stream)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== Flash Video (FLV) to wav or mp3 ==
 
== 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.
+
It can be done 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.
 
  <nowiki>mplayer -ao pcm:file=sound.wav -novideo flashvideo.flv
 
  <nowiki>mplayer -ao pcm:file=sound.wav -novideo flashvideo.flv
 
lame sound.wav sound.mp3</nowiki>
 
lame sound.wav sound.mp3</nowiki>
Line 15: Line 15:
 
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.
 
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.
  
 +
Or using FFmpeg:
 +
<nowiki>ffmpeg -i video-file.avi -vcodec png %05d.png</nowiki>
 +
Super fast!
  
 
== Play PNG sequence ==
 
== Play PNG sequence ==
Line 34: Line 37:
  
 
== Play a Tuxbox stream ==
 
== Play a Tuxbox stream ==
  <nowiki>mplayer http://dbox:31339/$(printf '%04x,' $(GET http://dbox/control/zapto?getpids) )</nowiki>
+
  <nowiki>mplayer http://dbox:31339/$(printf '%04x,' $(GET http://dbox/control/zapto?getpids) )
 +
 
 +
Fullscreen, de-interlaced and with cache:
 +
mplayer -cache 1024 -vf pp=lb -fs http://dbox:31339/$(printf '%04x,' $(GET http://dbox/control/zapto?getpids) )
 +
</nowiki>

Latest revision as of 19:32, 29 August 2013

Flash Video (FLV) to wav or mp3

It can be done 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.

Or using FFmpeg:

ffmpeg -i video-file.avi -vcodec png %05d.png

Super fast!

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 raw video data (RGB24 format)

Play real raw data - binary files with RGB values for each pixel, 3 bytes per pixel, no header. At least the videos width and height must be entered - for example:

mplayer -demuxer rawvideo -rawvideo w=85:h=48:format=rgb24 test.raw


Play a Tuxbox stream

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

Fullscreen, de-interlaced and with cache:
mplayer -cache 1024 -vf pp=lb -fs http://dbox:31339/$(printf '%04x,' $(GET http://dbox/control/zapto?getpids) )