Mplayer

Izvor: HrOpenWiki
Inačica od 19:47, 22. listopada 2011. koju je unio/unijela Lutherus (razgovor | doprinosi)

(razl) ←Starija inačica | vidi trenutačnu inačicu (razl) | Novija inačica→ (razl)
Skoči na: orijentacija, traži

MPlayer je popularan alat za reproukciju video sadržaja. Podržava sve video i audio formate koji i podržava ffmpeg.

Instalacija

Arch Linux

pacman -S mplayer

Debian

sudo apt-get install mplayer

Gentoo

emerge -av mplayer

Fedora

yum install mplayer

OpenSuse

zyper install mplayer


Alternativno, možete najnoviju development verziju sinuti sa http://www.mplayerhq.hu/design7/dload.html te je kompajlirati.

Dodatni savjeti kod instalacije

Možda će vam zatrebati i GUI ukoliko niste ljubitelj konzole.Tu vam na raspolaganju stoje mplayergui, smplayer, umplayer, gnome-mplayer, pymp

Integracija sa web browserom

Jedna od vrlo korisnih funkcija mplayera je integracija sa web browserom.

Firefox

Za integraciju mplayera sa Firefoxom potrebno je instalirati paket gecko-mediapalyer (potražite ga u repozitoriju vaše distribucije)

Konqueror

Konqueror zahtjeva da instalirate kmplayer.

Korištenje

Konfiguracija

Opća konfiguracijska datoteka se nalazi pod /etc/mplayer/mplayer.conf dok su korisnikove postavke spremljene unutar ~/.mplayer/config. /etc/mplayer/mplayer.conf je odlična polazna točka za konfiguraciju ~/.mplayer/config.

Primjer konfiguracije

##/etc/mplayer/example.conf|content=

# default configuration that applies to every file
[default]
# use X11 for video output
vo=xv
# use also for audio output
ao=alsa
# ao=oss # Use OSS4
# prefer using six channels audio
channels = 6
# scale the subtitles to the 3% of the screen size
subfont-text-scale = 3
# never use font config
nofontconfig = 1
# add black borders so the movies have the same aspect ratio of the monitor
# for wide screen monitors
vf-add=expand=::::1:16/9:16
# for non wide screen traditional monitors
#vf-add=expand=::::1:4/3:16

#profile for up-mixing two channels audio to six channels
# use -profile 2chto6ch to activate
[2chto6ch]
af-add=pan=6:1:0:.4:0:.6:2:0:1:0:.4:.6:2
 
#profile to down-mixing six channels audio to two channels
# use -profile 6chto2ch to activate
[6chto2ch]
af-add=pan=2:0.7:0:0:0.7:0.5:0:0:0.5:0.6:0.6:0:0

# Disable screensaver.
heartbeat-cmd="xscreensaver-command -deactivate &" # stop xscreensaver
stop-xscreensaver="yes" # stop gnome-screensaver

Osbosobljavanje VDPAU ( novije Nvidia grafičke kartice)

Za kompletnu listu podržanih kartica pogledajte ovu tablicu .

1. naćin - koristeći konfiguracijsku datoteku

Potrebno je sljedeću liniju dodati u konfiguracijsku datoteku,bilo sistemku, bilo korisničku (preporučljivo je da bude korisnička)

vo=vdpau,
vc=ffmpeg12vdpau,ffwmv3vdpau,ffvc1vdpau,ffh264vdpau,ffodivxvdpau,

Pomoću wrapper skripte

Postoji jedna trivijalna bash skripta koja traži koj vc koristiti te kad koristiti vo=vdpau.

    #!/bin/bash
    #Script to automatically find out which codec a file is using and determine whether or not to use VDPAU.

    #if no input display usage
    if [ -z "$1" ]; then
    	echo usage: $0 /path/to/file
    	exit
    fi

    #remember to change this to the path of your mplayer binary
    mplayerlocation=/usr/local/bin/mplayer-vdpau-3263604/mplayer-vdpau
    cd $mplayerlocation

    #kinda a lame way to do it, but bring up mplayer and pipe the output to a temporary file, then read which codec the file is
    ./mplayer -identify -vo vdpau $1 > /tmp/VIDEOCODEC &
    sleep 0.5
    killall mplayer
    videocodec=`cat /tmp/VIDEOCODEC | grep ID_VIDEO_CODEC | cut -c 16-25`
    rm /tmp/VIDEOCODEC

    echo "VIDEO CODEC: $videocodec"

    if [ $videocodec = "ffh264" ]; then
    	codec='h264'
    	echo \n Playing $1 with $codec codec \n
    	./mplayer -vo vdpau -vc ffh264vdpau $1

    	exit
    fi

    if [ $videocodec = "ffmpeg2" ]; then
    	codec='MPEG2'
    	echo \n Playing $1 with $codec codec \n
    	./mplayer -vo vdpau -vc ffmpeg12vdpau $1

    	exit
    fi

    if [ $videocodec = "ffwmv3" ]; then
    	codec='WMV3'
    	echo \n Playing $1 with $codec codec \n
    	./mplayer -vo vdpau -vc ffwmv3vdpau $1

    	exit
    fi

    #VC1 is not supported on most gpus
    #uncomment if it is supported on your gpu
    #if [ $videocodec = "ffvc1" ]; then
    #	codec='VC1'
    #	echo \n Playing $1 with $codec codec \n
    #	./mplayer -vo vdpau -vc ffvc1vdpau $1
    #
    #	exit
    #fi

    #if it isnt one of those it is not supported by vdpau
    #so we should play without vdpau
    ./mplayer $1
    exit

Translucentni video sa radeon karticama i uključenim compozite managerom

Kako bi omogučili translucentan video potrebno je omogučiti teksture

mplayer -vo xv:adaptor=1 <File>

no jednostavnije je dodati liniju

vo=xv:adaptor=1

u ~/.mplayer/config. Možete iskoristiti xvinfo kako bi doznali koje video modove vaša kartica podržava. Evo kako izgleda izlaz xvinfo naredbe

 ~ > xvinfo
X-Video Extension version 2.2
screen #0
  Adaptor #0: "Radeon Textured Video"
    number of ports: 16
    port base: 63
    operations supported: PutImage 
    supported visuals:
      depth 24, visualID 0x21
    number of attributes: 7
      "XV_VSYNC" (range 0 to 1)
              client settable attribute
              client gettable attribute (current value is 1)
      "XV_BRIGHTNESS" (range -1000 to 1000)
              client settable attribute
              client gettable attribute (current value is 0)
      "XV_CONTRAST" (range -1000 to 1000)
              client settable attribute
              client gettable attribute (current value is 0)
      "XV_SATURATION" (range -1000 to 1000)
              client settable attribute
              client gettable attribute (current value is 0)
      "XV_HUE" (range -1000 to 1000)
              client settable attribute
              client gettable attribute (current value is 0)
      "XV_COLORSPACE" (range 0 to 1)
              client settable attribute
              client gettable attribute (current value is 0)
      "XV_CRTC" (range -1 to 1)
              client settable attribute
              client gettable attribute (current value is -1)
    maximum XvImage size: 8192 x 8192
    Number of image formats: 4
      id: 0x32595559 (YUY2)
        guid: 59555932-0000-0010-8000-00aa00389b71
        bits per pixel: 16
        number of planes: 1
        type: YUV (packed)
      id: 0x32315659 (YV12)
        guid: 59563132-0000-0010-8000-00aa00389b71
        bits per pixel: 12
        number of planes: 3
        type: YUV (planar)
      id: 0x30323449 (I420)
        guid: 49343230-0000-0010-8000-00aa00389b71
        bits per pixel: 12
        number of planes: 3
        type: YUV (planar)
      id: 0x59565955 (UYVY)
        guid: 55595659-0000-0010-8000-00aa00389b71
        bits per pixel: 16
        number of planes: 1
        type: YUV (packed)
 ~ > 

Kontrolne tipke

ovo je popis najosnovnijih MPlayer kontrola.
Key Description
p Toggle pause/play.
Space Toggle pause/play.
Backspace Return to menu when using dvdnav.
Left Seek backward ten seconds.
Right Seek forward ten seconds.
Down Seek backward one minute.
Up Seek forward one minute.
< Go back in the playlist.
> Go forward in the playlist.
m Mute the sound.
0 Volume up.
9 Volume down.
f Toggle fullscreen mode.
o Toggle OSD state.
j Toggle subtitle visibility.
I Show filename.
1, 2 Adjust contrast.
3, 4 Adjust brightness.
j Cycle through the available subtitles.
# Cycle through the available audio tracks.

Gledanje video streamova

Ukoliko želite pogledati neki video stream

mplayer -playlist link-to-stream.asx

MPlayer sa dvd navigacijom

mplayer -nocache dvdnav://

Audio sream na jack

Editirajte ~/.mplayer/config i dodajte mu ao=jack

Upravljanje web kamerom

Ukoliko želite vašom web kamerom snimiti fotografiju koristit će te ovu naredbu

mplayer tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0 -fps 15 -vf screenshot

Ukoliko želite snimiti video

mencoder tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0:forceaudio:adevice=/dev/dsp -ovc lavc -oac mp3lame -lameopts cbr:br=64:mode=3 -o <filename>.avi

Vanjske poveznice