.2.1. MPlayer and MEncoder
MPlayer
is a command-line video player with an optional graphical interface which aims to provide speed and flexibility.
Other graphical front-ends to MPlayer
are available from the FreeBSD Ports Collection.
MPlayer
can be installed using the multimedia/mplayer
package or port.
Several compile options are available and a variety of hardware checks occur during the build process.
For these reasons, some users prefer to build the port rather than install the package.
When compiling the port, the menu options should be reviewed to determine the type of support to compile into the port.
If an option is not selected, MPlayer
will not be able to display that type of video format.
Use the arrow keys and spacebar to select the required formats.
When finished, press Enter
to continue the port compile and installation.
By default, the package or port will build the mplayer
command line utility and the gmplayer
graphical utility.
To encode videos, compile the multimedia/mencoder
port.
Due to licensing restrictions, a package is not available for MEncoder
.
The first time MPlayer
is run, it will create ~/.mplayer
in the user’s home directory.
This subdirectory contains default versions of the user-specific configuration files.
This section describes only a few common uses.
Refer to mplayer(1) for a complete description of its numerous options.
To play the file testfile.avi
, specify the video interfaces with -vo
, as seen in the following examples:
% mplayer -vo xv testfile.avi
% mplayer -vo sdl testfile.avi
% mplayer -vo x11 testfile.avi
# mplayer -vo dga testfile.avi
# mplayer -vo 'sdl:dga' testfile.avi
It is worth trying all of these options, as their relative performance depends on many factors and will vary significantly with hardware.
To play a DVD
, replace testfile.avi
with dvd://[replaceable]
N -dvd-device
[replaceable]
DEVICE`, where [replaceable]
N is the title number to play and [replaceable]
DEVICE is the device node for the [acronym]
DVD.
For example, to play title 3 from [path]
/dev/dvd`
:
# mplayer -vo xv dvd://3 -dvd-device /dev/dvd
|
The default DVD device can be defined during the build of the MPlayer port by including the WITH_DVD_DEVICE=/path/to/desired/device option.
By default, the device is /dev/cd0
.
More details can be found in the port’s Makefile.options
.
|
To stop, pause, advance, and so on, use a keybinding.
To see the list of keybindings, run mplayer
-h
or read mplayer(1).
Additional playback options include -fs
-zoom
, which engages fullscreen mode, and -framedrop
, which helps performance.
Each user can add commonly used options to their ~/.mplayer/config
like so:
mplayer
can be used to rip a DVD
title to a .vob
.
To dump the second title from a DVD
:
# mplayer -dumpstream -dumpfile out.vob dvd://2 -dvd-device /dev/dvd
The output file, out.vob
, will be in MPEG
format.
Anyone wishing to obtain a high level of expertise with UNIX® video should consult mplayerhq.hu/DOCS as it is technically informative.
This documentation should be considered as required reading before submitting any bug reports.
Before using mencoder
, it is a good idea to become familiar with the options described at mplayerhq.hu/DOCS/HTML/en/mencoder.html.
There are innumerable ways to improve quality, lower bitrate, and change formats, and some of these options may make the difference between good or bad performance.
Improper combinations of command line options can yield output files that are unplayable even by mplayer
.
Here is an example of a simple copy:
% mencoder input.avi -oac copy -ovc copy -o output.avi
To rip to a file, use -dumpfile
with mplayer
.
To convert input.avi
to the MPEG4 codec with MPEG3 audio encoding, first install the audio/lame
port.
Due to licensing restrictions, a package is not available.
Once installed, type:
% mencoder input.avi -oac mp3lame -lameopts br=192 \
-ovc lavc -lavcopts vcodec=mpeg4:vhq -o output.avi
This will produce output playable by applications such as mplayer
and xine
.
input.avi
can be replaced with dvd://1 -dvd-device
/dev/dvd
and run as root
to re-encode a DVD
title directly.
Since it may take a few tries to get the desired result, it is recommended to instead dump the title to a file and to work on the file.
.2.2. The xine Video Player
xine
is a video player with a reusable base library and a modular executable which can be extended with plugins.
It can be installed using the multimedia/xine
package or port.
In practice, xine
requires either a fast CPU with a fast video card, or support for the XVideo extension.
The xine
video player performs best on XVideo interfaces.
By default, the xine
player starts a graphical user interface.
The menus can then be used to open a specific file.
Alternatively, xine
may be invoked from the command line by specifying the name of the file to play:
.2.3. The Transcode Utilities
Transcode
provides a suite of tools for re-encoding video and audio files. Transcode
can be used to merge video files or repair broken files using command line tools with stdin/stdout stream interfaces.
In FreeBSD, Transcode
can be installed using the multimedia/transcode
package or port.
Many users prefer to compile the port as it provides a menu of compile options for specifying the support and codecs to compile in.
If an option is not selected, Transcode
will not be able to encode that format.
Use the arrow keys and spacebar to select the required formats.
When finished, press Enter
to continue the port compile and installation.
This example demonstrates how to convert a DivX file into a PAL MPEG-1 file (PAL VCD):
% transcode -i input.avi -V --export_prof vcd-pal -o output_vcd
% mplex -f 1 -o output_vcd.mpg output_vcd.m1v output_vcd.mpa
The resulting MPEG
file, output_vcd.mpg
, is ready to be played with MPlayer
.
The file can be burned on a CD
media to create a video CD
using a utility such as multimedia/vcdimager
or sysutils/cdrdao
.