Spis treści
MPlayer jest odgrywarką filmów pod LINUXem (działa pod wieloma innymi Unixami, i systemami opartymi na innych procesorach niż x86, zobacz sekcja 6). Wyświetla większość plików MPEG, VOB, AVI, VIVO, ASF/WMV, QT/MOV oraz FLI, korzystając z wielu własnych, XAnim oraz Win32 DLL kodeków. Możesz również oglądać VideoCD, SVCD, DVD, 3ivx, a nawet filmy DivX (i nie potrzebujesz wcale biblioteki avifile. Kolejną dużą zaletą mplayera jest szeroki wachlarz sterowników wyjścia. Mplayer działa z X11, Xv, DGA, OpenGL, SVGAlib, fbdev, AAlib, DirectFB, ale możesz też korzystać z GGI i SDL ( i w ten sposób z wielu sterowników dostarczanych przez SDL) oraz z niskopoziomowych sterowników specyficznych dla danej karty (dla Matrox, 3Dfx i Radeon) także! Większość dostępnych sterowników wspiera sklaowanie programowe i sprzętowe, możesz więc cieszyć się oglądaniem filmów w trybie pełnoekranowym. MPlayer wspiera wyświetlanie poprzez pewne sprzętowe karty dekodujące MPEG , takie jak DVB i DXR3/Hollywood+ ! A co powiesz na ładne, duże, antyaliasowane podtytuły z cieniem (wspieranych jest 9 typów!!!) z europejskim ISO 8859-1,2 (węgierskimi, angielskimi, czeskimi itd.), cyrylicą, koreańskimi fontami oraz OSD?
MPlayer jest oparty na GPL, ale zawiera pewien kod nie-GPL, którego nie wolno rozpowszechniać w formie binarnej, a także zawiera bibliotekę OpenDivX, która jest na specjalnej licencji. Wciaż jednak rozwijamy się w kierunku GPL.
Rozprowadzanie MPlayera w formie binarnej i/lub w pakietach binarnych jest aktualnie niemożliwe zarówno ze względów technicznych jak i prawnych. Szczegółową informację na ten temat można znaleźć w drugiej części tego pliku i jest zalecane przeczytanie go.
Nie napisałem żadnych kodeków, tylko kilka odgrywarek. Spędziłem wiele czasu poszukując najlepszego sposobu, aby rozkodować złe, uszkodzone pliki wejściowe (zarówno MPEG jak i AVI), oraz by zrobić perfekcyjną synchronizację A-V w poszukiwanych możliwościach. Moja odgrywarka jest wybitnie dobra w odgrywaniu uszkodzonych plików MPEG (co jest użyteczne w pewnych VCD), a także odgrywa złe pliki AVI, których nie potrafi odtworzyć słynny windows media player. Nawet pliki AVI bez indeksowania są odgrywane i możesz dodatkowo przebudować ich indeksowanie za pomocą opcji -idx, co umożlliwia wyszukiwanie. Jak widzisz, stabilność i jakość, to dla mnie najważniejsze rzeczy, ale również prędkość jest zadziwiająca.
Wszystko zaczęło się rok temu... Próbowałem wielu odgrywarek pod linuxa (mtv,xmps,dvdview,livid/oms,VideoLAN, xine,xanim,avifile,xmmp) ale wszystkie miały jakieś wady. Głównie z odtwarzaniem szczególnych plików oraz z synchronizacją obrazu i dźwięku. Większość z nich nie potrafi odgrywać plików w obu formatach MPEG1/2 i AVI (DivX). Wiele z nich miało również problemy z jakością obrazu oraz prędkością. Postanowiłem więc napisać nowy lub zmodyfikować jeden z tych programów...
W tym rozdziale spróbuję przeprowadzić cię przez proces kompilacji i konfiguracji MPlayera. To nie jest proste, ale też niekoniecznie musi być trudne. Jeśli zaobserwujesz inne zachowanie, niż to, które opiszę, proszę, przeszukaj tą dokumentację, a znajdziesz wyjaśnienie. Kiedy zobaczysz linki, przeczytaj uważnie dokumenty, które one wskazują. Zajmie ci to trochę czasu, ale warto to zrobić.
Potrzebna ci będzie dość nowa wersja systemu. W Linuksie wymagane są jądra 2.4.x, ale z 2.4.10 i wyższymi czasami możesz napotkać problemy ( licencja, błędy jądra, itp.) więc są one odradzane.
WYMAGANIA SPRZĘTOWE
KODEKI
KARTY GRAFICZNE
There are generally two kind of videocards. One kind (the newer cards) has hardware YUV acceleration support, the other cards don't.
KARTY YUV
They can display and scale (zoom) the picture to any size that fits in their memory, with small CPU usage (zooming doesn't increase it!), thus you get a nice and very fast fullscreen playing.
Karty bez YUV
Fullscreen playing can be achieved by either zooming
(by software, this is slooow), or changing to a smaller videomode, for
example to 352x288. If you don't have YUV accel, this latter method is
the recommended one. Throughout MPlayer, this behaviour can
be switched on by using the -vm
option and with
the following drivers :
KARTY DŻWIĘKOWE
WŁAŚCIWOŚCI
usleep()
to tune
A/V sync, with +/- 10ms accuracy. However sometimes the sync has to be tuned
even finer. The new timer code uses PC's RTC (Real Time Clock) for this task,
because it has precise 1ms timers. This requires root, or a setuid root
MPlayer binary (or a little kernel hacking, but that's unadvised). You
can see the new timer's efficiency in the status line. Note: NEVER install
setuid MPlayer binary on a multiuser system! It's a clear way for everyone
to gain root.Then build MPlayer:
./configure make make install
ALWAYS browse the output of ./configure, and the
configure.log
file, they contain info about what will be built,
and what won't. You may also want to view config.h and config.mak files.
Though not mandatory, the fonts should be installed in order to gain OSD, and subtitle functionality. Download mp-arial-iso-8859-*.zip and/or optional (if exists) language updates. It's VERY RECOMMENDED to check section 1.5 for details.
mkdir ~/.mplayer/font cd ~/.mplayer/font unzip mp-arial-iso-8859-1.zip
Only one thing remains: copy the codecs.conf file from the etc
directory (relative to the MPlayer tree) to $HOME/.mplayer/codecs.conf
.
You should also check the manpage and example.conf
for available options, and insert them
into your config file, $HOME/.mplayer/config
.
The GUI needs GTK (it isn't GTK, but the panels are). The skins are stored
in PNG format, so gtk, libpng (and their devel stuff) has to be installed.
You can build it by specifying --enable-gui
during ./configure .
Then, to turn on GUI mode, you either
-gui
optiongui=yes
in your config fileln -s /usr/local/bin/mplayer /usr/local/bin/gmplayer
,
and call gmplayer
instead.
Since GTK doesn't run from a setuid root binary, you can't use the GUI and the new timer code (mentioned above) together (unless you run MPlayer as root, of course).
As MPlayer doesn't have a skin included, you have to download them
if you want to use the GUI. See the download page.
They should be extracted to the usual system-wide directory (/usr/local/share/mplayer/Skin
),
or to $HOME/.mplayer/Skin
. MPlayer by default looks in
these directories for a default named directory, but you can use the
-skin newskin option, or the skin=newskin config file
directive to use the skin in */Skin/newskin
directory.
Yes, MPlayer also supports many kinds of subtitles. Currently 8 kinds of subtitle can be used by the subreader code. To see what are these subtitle formats, see subreader.c, line ~30.
About DVD subtitles, read the DVD section.
MPlayer introduces a new subtitle format called MPsub. It was designed by me (Gabucino). Basically its main feature is being dynamically time-based (although it has frame-based mode too). Example (from DOCS/tech/mpsub.sub) :
# first number : wait this much after previous subtitle disappeared
# second number : display the current subtitle for this many seconds
15 3
A long, long time ago...
0 3
in a galaxy far away...
0 3
Naboo was under an attack.
So you see, the main goal was to make subtitle editing/timing/joining/cutting easy. And,
if you - say - get an SSA subtitle but it's badly timed/delayed to your
version of the movie, you simply do a mplayer dummy.avi -sub source.ssa
-dumpmpsub . A dump.mpsub
file will be created in the
current directory, which will contain the source subtitle's text, but in
MPsub format. Then you can freely add/substract seconds to/from the
subtitle.
Subtitles are displayed with a technique called 'OSD', On Screen Display. OSD is used to display current time, volume bar, seek bar etc.
INSTALACJA OSD i SUB
You need an MPlayer font package to be able to use OSD/SUB feature. There are many ways to get it:
After that, UNZIP the files to ~/.mplayer/font/ . Now you have to see a timer at the upper left corner of the movie (switch it off with 'o') .
OSD has 3 states: (switch with 'o')
You can change default behaviour by setting osdlevel=
variable in config file.
2.3. Video & Audio output devices
2.4. MEncoder - An All-Purpose Encoder
This section is about how to enable watching/grabbing from V4L compatible TV tuner.
Compilation
--enable-tv
flag to ./configure
,
and recompile.Hint: if MPlayer prints ioctl: can't sync
or something
like this, your tuner can't capture the requested image size. Try using
width=640:height=480
options.
Hint #2 : are the colors fucked up? Then your tuner can't display
in YV12 colorspace. Try YUY2, UYVY or if none of these works: RGB32 (this one
with -vo sdl
).
You can specify these with the outfmt=YV12
option see below.
Available options
on | use TV input | ||
driver |
dummy - NULL TV input :) Used for testing only, generates dummy
input. v4l - captures images from standard V4L interface (default /dev/video0 ) |
||
device | specify other
device than the default /dev/video0 |
||
input | give from which
input of the TV tuner you which to grab from (e.g. television,
s-video, composite, ...) Prints the available ones during init. |
||
freq | specify the frequency to set the tuner (e.g. 511.250) | ||
outfmt | in which output
format to display images (rgb32, rgb24, yv12,
uyvy) The following option must have the same setting ! |
||
width | the width of the output window, in pixels | ||
height | the height of the output window, in pixels | ||
norm | available: PAL, SECAM, NTSC | ||
channel | set the tuner to the given channel | ||
chanlist |
available: us-bcast, us-cable, europe-west, europe-east, etc |
Keyboard control
h or l | select previous/next channel | ||
n | change norm | ||
b | change channel list | ||
Examples
Dummy output, to AAlib :)
mplayer -tv on:driver=dummy:width=640:height=480 -vo aa
Input from standard V4L
mplayer -tv on:driver=v4l:width=800:height=600:device=/dev/video0:input=television:outfmt=yv12 -vo xv
file | mplayer [options] [path/]filename | ||
VCD | mplayer [options] -vcd trackno /dev/cdrom | ||
DVD | mplayer [options] -dvd titleno [/dev/dvd] | ||
net | mplayer [options] http://site.com/file.[mpg|avi] | ||
mplayer -vo x11 /mnt/Films/Contact/contact2.mpg mplayer -vcd 2 /dev/cdrom mplayer -afm 3 /mnt/DVDtrailers/alien4.vob mplayer -dvd 1 /dev/dvd mplayer -abs 65536 -delay -0.4 -nobps ~/movies/test.avi
3.1. Sterowanie za pomocą kalwiatury
<- or -> | seek backward/forward 10 seconds | ||
up or down | seek backward/forward 1 minute | ||
pgup/pgdown | seek backward/forward 10 minutes | ||
< or > | seek backward/forward in playlist | ||
p or SPACE | pause movie (press any key) | ||
q or ESC | stop playing and quit program | ||
+ or - | adjust audio delay by +/- 0.1 second | ||
/ or * | decrease/increase volume | ||
o | toggle OSD: none / seek / seek+timer | ||
m | toggle using master/pcm volume | ||
z or x | adjust subtitle delay by +/- 0.1 second | ||
(the following keys are valid only when using DirectShow DivX codec or DivX4 codec with -vc divx4) | |||
1 or 2 | adjust contrast | ||
3 or 4 | adjust brightness | ||
5 or 6 | adjust hue | ||
7 or 8 | adjust saturation | ||
(the following keys are valid only with TV input support | |||
h or l | select previous/next channel | ||
n | change norm | ||
b | change channel list |
Obsługa GUI z klawiatury
, and . | previous / next file | ||
gray - or + | decrease / increase volume | ||
enter | start playing | ||
space | pause | ||
s | stop | ||
a | about | ||
l | load file | ||
b | skin browser | ||
e | toggle equalizer | ||
p | toggle playlist | ||
f | toggle fullscreen | ||
m | toggle mute |
Sterowanie wejściem TV
h or l | select previous/next channel | ||
n | change norm | ||
b | change channel list |
3.2. Sterowanie za pomocą LIRC
Linux Infrared Remote Control - użyj łatwego w budowie, domowej roboty odbiornika IR, (prawie) dowolnego pilota i kontroluj za jego pomocą swoje linux box! Więcej na ten temat na www.lirc.org.
Jeśli zainstalowałeś pakiet lirc, możesz skompilować MPlayera z włączeniem obsługi LIRC stosując: ./configure --enable-lirc.
Jeżeli wszystko poszło dobrze, MPlayer wyśle na starcie komunikat, że inicjalizacja LIRC zakończyła się sukcesem. Zawiadomi cie także wtedy, gdy pojawią się błędy. Jeśli nie wspomni o LIRC w ogóle, oznacza to, że obsługa LIRC nie została wkompilowana. To tyle :-)
Aplikacja dla MPlayera nazywa się - nie zgadłbyś - mplayer_lirc. Rozumie ona następujące polecenia:
PAUSE | - zatrzymuje odgrywanie (pauza). Naciśnięcie dowolnego klawisza powoduje wznowienie odgrywania; | ||
QUIT | - wyjście z MPlayer; | ||
RWND | - 10 sek wstecz; | ||
FRWND | - 60 sek wstecz; | ||
FWD | - 10 secs naprzód; | ||
FFWD | - 60 sek naprzód; | ||
INCVOL | - zwiększenie głośności o 1%; | ||
DECVOL | - zmniejszenie głośności o 1%; | ||
MASTER | - użyj głównego kanału miksera; | ||
PCM | - użyj kanału pcm miksera; | ||
Nie zapomnij ustawić flagę powtarzania dla RWND/FWD w .lircrc. Oto fragment z mojego .lircrc:
begin remote = CU-SX070 prog = mplayer_lirc button = Tape_Play repeat = 1 config = FFWD end begin remote = CU-SX070 prog = mplayer_lirc button = Tape_Stop config = QUIT end
Jeśli nie odpowiada ci standardowa lokalizacja pliku lirc-config (~/.lircrc) użyj przełącznika -lircconf <nazwa_pliku>, aby podać inny plik.
3.3. Obsługa potoków z sieci, bądź jako pipe
MPlayer can play files from network, using the HTTP protocol. Configuring it is simple, just recompile MPlayer with
./configure --enable-streaming
MPlayer can NOT read ASF files from network by the MMS protocol, only by plain HTTP.
MPlayer can read from stdin (NOT named pipes). This can be for example used to play from FTP:
wget ftp://micorsops.com/something.avi -O - | mplayer -
To build the package, get the cvs version, or .tgz and uncompress it, and cd into programs directory:
cd main fakeroot debian/rules binary
(... mplayer detects hardware/software, builds itself and.. ) dpkg-deb: building package `mplayer' in `../mplayer_0.18-1_i386.deb'.
And now just become root, and:
dpkg -i ../mplayer_0.18-1_i386.deb as root.
Here's how it looks like:
eyck@incubus:/src/main$ sudo dpkg -i ../mplayer_0.18-1_i386.deb Password: (Reading database ... 26946 files and directories currently installed.) Preparing to replace mplayer 0.17a-1 (using ../mplayer_0.18-1_i386.deb) Unpacking replacement mplayer ... Setting up mplayer (0.18-1) ...
To build the package you will need GNU make (gmake, /usr/ports/devel/gmake), native BSD make will not work.
To run MPlayer you will need to re-compile the kernel with "options USER_LDT" (unless you are running -CURRENT, where this is default). If you have a CPU with SSE also use "options CPU_ENABLE_SSE" to use it (FreeBSD-STABLE required, or use kernel patches).
If MPlayer complains about "CD-ROM Device '/dev/cdrom' not found!" make a
symbolic link: ln -s /dev/(your_cdrom_device) /dev/cdrom
There's no DVD support for FreeBSD yet.
MPlayer should work on Solaris 2.6 or newer.
AVI file playback works best on Solaris x86, because you have the option to use the win32 codecs on the x86 platform, or can use MMX/MMX2/3DNow/etc instructions for MP3/DivX/DVD/whatever. On Solaris SPARC, you'll find quite a few AVI files with non working video and/or audio playback, because the video/audio codecs using the Win32 DLLs are not available. However, DivX/OpenDivX movies should work, when using libavcodec.
On UltraSPARCs, MPlayer takes advantage of their VIS extensions (equivalent to MMX), currently only in libmpeg2, libvo and libavcodec, but not in mp3lib. You can watch a VOB file on a 400Mhz CPU. You'll need mLib installed.
To build the package you will need GNU make (gmake, /opt/sfw/gmake), native Solaris make will not work. Typical error you get when building with solaris' make instead of GNU make:
% /usr/ccs/bin/make make: Fatal error in reader: Makefile, line 25: Unexpected end of line seen
On Solaris SPARC, you need the GNU C/C++ Compiler; it does not matter if GNU C/C++ compiler is configured with or without the GNU assembler.
On Solaris x86, you need the GNU assembler and the GNU C/C++
compiler, configured to use the GNU assembler! The mplayer code on
the x86 platform makes heavy use of MMX, SSE and 3DNOW!
instructions that cannot be compiled using Sun's assembler
/usr/ccs/bin/as
.
The configure script tries to find out, which assembler program is used by your "gcc" command (in case the autodetection fails, use the "--as=/whereever/you/have/installed/gnu-as" option to tell the configure script where it can find GNU "as" on your system).
Error message from configure on a Solaris x86 system using GCC without GNU assembler:
% configure ... Checking assembler (/usr/ccs/bin/as) ... , failed Please upgrade(downgrade) binutils to 2.10.1...
(Solution: Install and use a gcc configured with "--with-as=gas")
Typical error you get when building with a GNU C compiler that does not use GNU as:
% gmake ... gcc -c -Iloader -Ilibvo -O4 -march=i686 -mcpu=i686 -pipe -ffast-math -fomit-frame-pointer -I/usr/local/include -o mplayer.o mplayer.c Assembler: mplayer.c "(stdin)", line 3567 : Illegal mnemonic "(stdin)", line 3567 : Syntax error ... more "Illegal mnemonic" and "Syntax error" errors ...
For DVD support you must have the patched libcss installed. Patch: http://www.tools.de/solaris/mplayer/.
Due to two bugs in solaris 8 x86, you cannot reliably play DVDs using a capacity >4GB:
On Solaris with an UltraSPARC CPU, you can get some extra speed by using the CPU's VIS instructions for certain time consuming operations. VIS acceleration can be used in MPlayer by calling functions in Sun's mediaLib.
VIS accelerated operations from mediaLib are used for mpeg2 video decoding and for color space conversion in the video output drivers.
MPlayer is reported to compile on StrongARM. Use the following command line:
./configure --target=arm-linux --disable-css --with-x11libdir=/usr/arm/lib --with-x11incdir=/usr/arm/lib --disable-gcc-checking
6.5. Silicon Graphics Indigo / IRIX
Reported working. You'll probably have to use the sgi ao driver. Anyone has closer info?
Works. Only has -vo x11
output which is even much slower
than on Linux, since QNX has only X emulation which is VERY slow.
No closer info yet.
NOTE: Do *NOT* send bugreports, help & feature requests directly to the authors!
Read Appendix C and subscribe to mplayer-users mailing lists.
The MPlayer project:
Main testers:
The codecs, libs:
Their code is not used in current player version, but I've got some ideas or other technical help from:
Appendix A/2 - maintainerzy kodu i dokumentacji MPlayera
Homepage
English documentation
Tłumaczenia dokumentacji
Platformy sprzętowe/porty
Kod MPlayera:
sterowniki libvo:
sterowniki libao2:
NARZĘDZIA:
Pozostałe:
There are some public mailing lists on MPlayer. Subscribing can be achieved on the following addresses:
This list is about mplayer development! Talking about interface/API changes, new libraryes, code optimization, ./configure changes, and send patches here. Do NOT send bugreports, user questions, feature requests here! This list should be kept low-traffic.
Send matrox-related questions here
Things related to the hardware decoder card called DVB.
Send only questions about CVS changes here. (if you don't understand why a change is required or you've better fix) Be sure in that your target developer reads this list!
NOTE: language of above lists are ENGLISH, unless explicitly stated otherwise. Please do not send messages using other language!
NOTE: you can reach the searchable mailing list archives here.
Appendix C - How to report bugs
Special system/cpu-specific bugs/problems:
Various A-V sync and other audio problems:
General audio delay or jerky sound (exists with all or many files):Video-out problems:
First note: options -fs -vm and -zoom are just recommendations, not (yet) supported by all drivers. So it isn't a bug if it doesn't work. Only a few driver supports scaling/zooming, don't expect this from x11 or dga.
OSD/sub flickering:
- x11 driver: sorry, it can't be fixed now
- xv driver: use -double option