MPlayer Tools
Powered by:
The main purpose of this package is to ease you the use of MPlayer.
The sofware package focuses on five different areas:
- mcatcher
- Graphical User Interface (MPlayer GUI Frontend)
- TV utilities
- Subtitle manipulations
- Statistical tools
- Final notes
1) mcatcher
The scripts automatically save the movie you are watching
and next time start mplayer with the same movie from the saved
position using a tiny `cdm;mstart' command.
Available commands
- mplayer
at install mplayer-tools overrides the mplayer command using a bash function,
the new command starts the mcatcher utility and then it calls the original mplayer to play the movie.
At any system that does not evaluate bash functions you need to associate movie files with mcatcher instead of mplayer.
- mstrip
the purpose of this script is to keep your logfile as small as possible while retaining as much information as possible.
You might want to run this periodically, maybe from a cron job otherwise mplayer tools may slow down after a while.
It's options are described under the mcatcher config file
You can give parameters to mstrip. mstrip passes them to msum, a utility described under
the statistical tools. This way every line selected by the msum utility will be removed
from the logfile. You might want to run msum first to see which lines will be removed.
If you don't install the stat components the parameters will have no effect.
- mhelp
mcatcher has so much configuration options that I can't expect anyone to remember them.
Use this tool as a reminder.
It lists all the available options although for now it does not provide documentation
because it simply extracts the options from the config file parser module. You can add an object (anything that mhelp lists without any parameters) as parameter and mhelp will dump it's value.
For example type mhelp lsusb to see what USB devices you have currently plugged in. You can also add a filename as a second paramter to test your settings related to the input file.
mhelp will also show the time it took to parse and evaluate the configuration file and the individual condition subject if you are dumping one.
- mstart
- if you give parameters for mstart will behave like the mplayer command with some exceptions
- mstart scans the beginning of the parameters for modes defined in the configuration file.
If one or more is found they are not passed to mplayer but pushed into the environment as if mset were used.
Read more about the modes in the config section.
- if there is a parameter -- then everyting before it is evaluated as normal commands; seperate the commands by a semicolon (do not forget that your shell may require that you escape the semicolon)
- if the first parameter (or the first one right after the modes) is `all' the behaviour described above is changed:
mstart will pass along only the files which are not yet played. This means that you can
watch a list of movies but you can start mplayer with the very same command every time. Ex:
mplay all 1.avi 2.avi 3.avi 4.avi
No matter how many times you quit the command will resume like if the four files
were only one stream. If no files are specified (only `mstart all') mstart works with all
media files from the current directory.
You can use the -shuffle mplayer option to play the files in random order but in this case
the playback will not be continued with the file you stopped.
- without parameters mstart will start the first movie saved into ~/.mplayer/mcatcher.save
but only movies from the current directory. If there are no movies saved from the current
directory mstart will start the first movie from the current firectory in lexical order
which was not watched yet (according to the mcatcher logfile).
This description may sound confusig, but take a look at the following example:
Let's say you have two files:
/mnt/moviepartition/Movie 1/Movie CD1.avi
/mnt/moviepartition/Movie 1/Movie CD2.avi
If you type the following commands:
cd /mnt/moviepartition/Movie\ 1/
mstart
you will watch the movie called "Movie CD1.avi". But let's say you don't have time to
finish the movie, so you exit mplayer and stop your computer. Then you start it again,
and you type the following commands:
cdm
mstart
and "Movie CD1.avi" will continue. Now let's say "Movie CD1.avi" terminates. The next
mstart command (without any parameters) will start "Movie CD2.avi" if you are in the
/mnt/moviepartition/Movie 1/ directory.
And what's even cooler is that you can say:
cdm
mstart all
every time when you want to continue watching the two files and you don't have to type
another mstart command if "Movie CD1.avi" terminates (you don't have to stand up :-) )
Hopefully you will find this clear and comfortable enough.
- mplay
This is a bash function wrapping mstart so it has similar functionality but it starts the mcatcher utility
in Player Mode. In this mode mplayer's output is supressed
and a more reticent output is displayed:
[FLAGS] POS/REM [LENGTH] CPUUSAGE [BUFLEVEL]
FLAGS are:
S - mcatcher will save position
D - position saving is disabled
P - movie is paused
B - A-V sync is broked
Just try it and you will understand it. Be aware that Player Mode will not
work properly if you use the `quiet' or `really-quiet' mplayer options.
Another advantage of player mode is that it has optimized terminal output (meaning that it only outputs to the terminal if the
text to show has changed).
This can be very useful if you have a slow terminal for example if your X server does not use the hardware
acceleration of your card or in some cases when you are using Xgl or compiz.
- mswitch
Has only affect if mcatcher is in player mode. Switches between displaying the current position and the remaining time.
Put the following line in your ~/.mplayer/input.conf file:
F6 run "mswitch"
This way you will be able to switch modes with a single keypress.
- cdm
cd into the current movie's directory
the scripts can save any number of movies
you can type a number after the command i.e.
cdm 1
changes to the second movie but it also moves the
movie into the first position so mstart will start this movie from this directory.
This command is implemented with a bash function that calls mlist.
- mlist
lists all the saved movies and the associated numbers you can use with the cdm command.
If a numeric parameter is given, will display only that movie (similar to cdm 1).
- mlists
lists your movie series, the number of watched episodes, the last episodes,
and the directories containing movie series.
You can type a regex to narrow the listing, ex: mlists Desperate Housewives
but saying "mlists despe" will probably do the same thing.
If you specify a number instead of a regex mlists will show the last series just like mlistd does.
Ex: mlists 0 shows the last series you watched, mlists 1 show second to last etc
If the --aux parameter is given lists the aux directories (see the mcatcher config file).
If the -l option is given lists the episodes instead of the directory.
- cds
this is a wrapper to mlists. The last directory is not displayed but cd into.
ex: "cds despe" will change directory to Desperate Housewives
a simple cds without parameters will go to the last watched show.
Can also accept a number as parameter just like mlists.
- mlista
- cda
these two commands work exactly like mlists and cds but they display/cd into the auxdir(see below) instead of the last directory.
- msave
force position saving of the currently played movie.
Put the following line in your ~/.mplayer/input.conf file:
KP_ENTER run "msave"
This way you will be able to force the position saving with a single keypress.
- mcancel
cancels any running timeouts and disables the position saving of the movies being
watched. Once you give this command no movie positions will be saved by the running
mcacther scripts except if you explicitely force it by an msave command.
Maybe you want to put a line like
F8 run "mcancel"
into your input.conf file.
- mecho
Displays a string in a special format as if it was an mplayer status message.
This way you can force osd messages.
- mlistd
Accepts a parameter (if none given uses 10) and displays the last directories where
you watched something.
- cdd
Goes back to the directory where you watched the last movie.
If you give a parameter it goes back further in the history.
- mloop
This shell script that is an alternative to `mstart all' but it forces immediate position saving
(more precisely after 4 seconds which is the mimimum) and starts an mplayer for every file.
- mset
this bash function sets the MCATCHER_MODE environment variable to the value given as parameter.
Type `mset -' to clear the environment variable. Type it without parameters to see it's current value.
Then you can compare this value in the config file conditions using the `mode' subject. See the details below.
Please note that this will only work in a plain shell not from run boxes or mc because the environment must be preserved.
- msynclog
You may have more then one computer in which case it is great to merge the logfiles so you can access the full information on both computers.
It's very simple: on one computer type into the command line msynclog without parameters. This way the script will act as a server waiting for a client.
On the other machine type msynclog <ip or hostname>. This way the script will act as a clent and will connect to the host given as a parameter.
The logfiles will be merged except for the files that are currently saved, and the scripts exit.
If you do not set the "mstrip disable_gather" option it also runs the mstrip utility and keeps only the last entry of a file.
After running displays a summary of how many entries were imported from the peer.
- mgui
Starts up the GUI. If it is already running then pops up it's main window. You can add playlists, files and directories as parameter and they will be added to the playlist.
- mguicmd
You can control the GUI from the command line or from any program that supports a command line like input. For example if you are a KDE user try going into the Control Center (kcontrol) and under Regional&Accessibility/Input Actions you can define shortcut keys to these functions.
Without any parameters mguicmd lists the available commands. These are:
- exit
Shuts down the GUI. This is the recommended way to shut down the GUI from the command line or from a script because the GUI reacts to this faster then to the signals.
- fs
Toggles fullscreen.
- next
Skip to the next file.
- osd
Show on the notification window the text given as the rest of the parameters.
- play
Start or pause playback.
- popup
Show the main window. Actually this command hides the main window for one tenth of a second first to make sure the window will pop up in the foreground.
- prev
Skip to the previous file.
- rem
Toggle Remaining Time/Position display in the main window.
- seek
Followed by only one parameter seeks relative from the current position. Example mguicmd seek -30 seeks back 30 seconds.
Followed by two parameters seeks to exact position. If the third parameter is 2 then in seconds else in percentage.
- show
Show/Hide the main window.
- stop
Stop the playback.
- volume
Followed by one parameter increases or decreases the volume. Specify a negative value to decrease the volume.
Followed by two parameters sets the absolute value of the volume in percentage to the second parameter, but only if the third is a valid integer.
The seek and the volume commands are so circumstantial because they are directly passed to MPlayer.
How it works
The mcatcher wrapper script analses mplayer's output to determine the current
file being played and the current movie position. The filename is saved into
~/.mplayer/mcatcher.save the position into an mplayer .conf file next to the
movie or into your ~/.mplayer directory. The script decides to save the movie
position on exit only if you watch the movie continuously for 12 mins
(this value is configurable in the config file) or if you
run the msave utility. The script signals that it will save the movie position
with a message to stdout and with a flashing Scroll Lock led action using
`xset led 3' commands. It also signals that A-V sync is broken with a
continuously turned on Scroll Lock led.
The mcatcher logfile
The mcatcher log file (~/.mplayer/mcatcher.log):
mcatcher logs every movie you watched. File format:
mplayer startup datetime|playtime|filename
You are free to delete any line at any time but be aware that mlists (cds) and mlistd (cdd)
uses this file to determine directories and episodes; mstart/mplay and the GUI uses it to determine which movie was not yet started.
If File::Spec::Link is installed then symlinks are resolved in the filename.
The mcatcher config file
The config file (~/.mplayer/mcatcher.conf) contains conditions, commands and assignments.
Lines beginning with # are comments.
You can also append values using the ,= operator for example like this:
option af,=extrastereo=-1
option af,=equalizer=4:3:3:0:-3:-3:0:1:2:3
Any assignment may contain objects (anything that mhelp prints out) like this:
option sub=subs/%file%.srt
The assignments may contain replacements of the form: #replace#subject#search_term#replacement_string# where the subject can contain objects and the search_term is a perl regex; for example:
option sub=subs/#replace#%file%#.avi#.srt#
See a sample configuration file in the package.
Beside the main config file you can have a directory level config file called .mcatcher.conf which will be used for every file in that directory or a file level config file. If your movie is called movie.avi then the file level config file must be called movie.avi.mconf
Commands and assignments
- mintime
timeout after what mcather decides to save the movie position.
- banneddirs
a list of directories (separated by :) where mcatcher prefers not to save movie .conf files.
This is useful if don't want other people to see your conf file or if you have a directory
in your memory (like /dev/shm) where you copied a movie and you don't want to loose
the .conf file across a restart (remount). The .conf files will also not be saved in any
subdirectory i.e. if you set banneddirs=/ every .conf file will be saved into ~/.mplayer
- noseries
Disable treating the current file as a series episode. Useful in conditions.
- shortcut
This is a hash. You can configure shortcuts with it for some files or livestream so you can start them without
remembering their complete path/name. Example: if you put the following line in the config file:
shortcut 1.fm=http://212.72.186.10:8050
then typing the command:
mplayer 1.fm
will start "mplayer http://212.72.186.10:8050"
- alias
You can define aliases using this hash for movie series so different looking files will be treated as the same series.
Example: alias sga=stargate atlantis
- term_width
Set it to the number of columns of your terminal. If you have installed the Term::ReadKey perl module
this can be autodetected. The default value is the standard 80 chars.
- term_height
Set it to the number of rows of your terminal. If you have installed the Term::ReadKey perl module
this can be autodetected. The default value is the standard 25 chars.
- dcop_width
Set it to have max length for the kde window titles (using DCOP)
If unset or less than 2 mcatcher uses unlimited. However the title is still might be chopped by konsole. You have to insert in your ~/.kde/share/config/konsolerc file under
[Desktop Entry]
the following line: AutoResizeTabs=false
to disable the chopping.
- disable_led
Set this option to 1 if you don't want any led action (maybe conserving some CPU time) when
mcatcher states that it will save the movie position or when it signals the broken A/V sync
- pos_adjustment
MPlayer cannot pinpoint the exact position in every types of movies so to make sure that
when you restart a movie the playback will continue from a point you already saw mcatcher
saves the current position minus 10 sec by default. This may also help you remember the movie
but if bothers you, set this value to 0. The default is -10 but you can set it to anything i.e.:
| pos_adjustment=-0.1 | | to go backward just a tiny bit |
pos_adjustment=-60 | if you need a few seconds to remember the movie |
pos_adjustment=10 | to go forward in the movie (I don't see the point to use this but who knows) |
pos_adjustment=0 | disable this feature |
- osdcolor
- osdfont
Try xlsfonts. Default values are lightgreen,-misc-fixed-medium-r-normal--32-0-100-100-c-0-iso8859-1
- osd_timeout
Set the timeout for osd messages produced by mcatcher and mcounter. Set it to 0 to disable them completely.
Defaults to 5 second. Please note that you cannot set the timeout for knotify.
- rem_timeout
On the second launch of msave, mcatcher displays how many time remains from the current file
(or the current position if mswitch is used). This option sets the timeout while this is displayed.
The default is 5 sec, set it to 0 to disable this feature.
- disable_cpuusage
when cpuusage is above 0.9 mcatcher disables osd messages and led flashing. This option disables this feature.
- disable_osdecho
disable echoing the status messages to the OSD
- disable_knotify
do not use the KDE Notification system for OSD messages
- knotify_title
the title used for the KDE Notification system. Defaults to "MPlayer - The Movie Player"
- knotify_fontstyle
The HTML font definitions passed to knotify. You can put anything that is accepted by a <font> tag. Defaults to size=5
- auxdir
set an auxiliary directory to use with movie series. cda will go to this directory.
- disable_osdtitles
do not echo files being played to the OSD
- disable_xterm_title
if DCOP is not available mcatcher sets the xterm title to the file being played. This command disables this behaviour.
- disable_clipinfo
do not use clip info from file headers (use only filename) to determine the name of the movie being played.
- disable_clipinfo_title
same as above but disables only the title/name from the clipinfo.
- disable_clipinfo_author
same as above but disables only the artist/author metadata.
- show_identify
mcatcher automatically adds the identify option to mplayer to determine movie properties but suppresses these lines. This command reenables them. Please note that this option is automatically turned on if mcatcher finds `-identify' in the command line.
- autosave_position
if you have frequent power losses you can save the current position from time to time.
This option sets the timeout (minimum 20 seconds). Set it to 0 to disable this feature.
- request_playermode
you can also turn on player mode using this command.
If any of the files played requests the player mode then player mode will be enabled.
- mode
you can overwrite or append to the current mode (set by mset or by the first parameters of mstart) using this command
- break
stop evaluating the config file immediately.
- option
this hash contains the options passed to mplayer. Examples:
Start in fullscreen mode:
option fs
Set subtitle position:
option subpos=96
Add (append using the comma) the extrastereo filter to the audio filters defined in the mcatcher config file:
option af,=extrastereo=-1
- mstrip
this hash contains the options used by the mstrip utility (evaluated in the order they are listed here):
- removeinexistent
If it's included in the config file then every movie that is deleted is also
removed from the log file.
- minlength
in seconds. Any entry shorter than this (playtime) will be removed from the log.
If this option is not present in the config file mstrip uses the default value of 60 seconds.
- lastepisode
If it's included in the config file then for every movie series found
in config file mstrip will keep only the last watched episode.
This way cds will still work correctly but the counters in mlists will not.
- disable_consecutivegather
mstrip gathers more entries of the same file if they are consecutive in your log into one entry with the first date and with the summarized length.
Include this option to disable this feature.
- disable_gather
If mstrip can gather multiple entries of the same file even if the entries are not consecutive but this time with the last date and the summarized length.
Include this option to disable this feature.
- maxloglines
the maximum number of lines. Unlimited by default.
- maxsize
the maximal size of the logfile in kilobytes. Unlimited by default.
- disable_logging
skip writing entries in your logfile. You may want to use this command inside conditions for example to skip logging of audio files.
- eof_treshhold
If you watched the current movie until 90% mcatcher treats it as if you've reached the end of the file. Use this option to configure this treshhold from 80% to 99%
- force_gui_osd
when mcatcher is running with the GUI using this option you can force for the video files not to use MPlayer's OSD but the GUI's notification window just like in case of the audio files.
- enable_output
when mcatcher is running with the GUI it suppresses MPlayer's console output (because it would probably end up in your ~/.xsession-errors).
Use this option to reenable the output
(and expect slighly more verbose output than usual).
- disable_guiguest
mcatcher can detect if the GUI is running whereever you start it from and if the GUI is running and no other mcatcher instance is connected to it mcatcher initiates the connection.
Use this option to prevent the connection.
- bannedwords
can contain a list separated by spaces and commas of words that must be removed from the name of the movie (displayed in OSD, xterm title), for example hun, eng
- display
for movie series using this option will override the displayed name (on OSD, xterm title)
- disable_symlinkresolve
if File::Spec::Link is installed then symlinks are dereferenced before they are logged. This command prevents it from happening.
- log_mintime
the minimum number of seconds a file mustbe played before it's logged (default: 10)
- find_sub
if you have a series in a dir with it's subtitles just make sure the subtitle file is recognized as an episode and mcatcher will pair up the episodes with the matching subtitles (even if their filename are very distinct) if you use this option.
For example if you have a file called: "battlestar.galactica.2x03.xvid.fqm.avi" and a subtitle called "BSG - 2x03.srt" then all you have to do is to set up an alias for "BSG" to "battlestar galactica" or vice versa and find_sub will be able to pair them up.
It can also take a parameter, for example find_sub 0 which will only take the first of the matching subtitles in case there are more.
- startup_script
- shutdown_script
Assign any commands to these variables and they will be run at mcatcher startup/shutdown. You can use this for example to disable and reenable your compositioning manager. Please note that the scripts you assign to these variables will be read only once when the config file is evaluated for the first time when there are no loaded media files yet.
- play_begin_script
- play_end_script
Commands assigned to these variables will be executed when a playback start/ends.
Please make sure your scripts do not block mcatcher for a long time or send them into the background using &.
Useful for notification scripts together with objects, for example:
play_begin_script=/some/script playstart %path%
play_end_script=/some/script playstop %path%
- eval
Evaluate or re-evaluate any file you want as mcatcher config file. If it's a relative path it will be searched relative to the media file's directory. If not found there then relative to ~/.mplayer
As shortlands you can use these special names: main,dir,file,command-line
For example: you have your modes defined in your main config file (~/.mplayer/mcatcher.conf) then in a directory level config file you modify the current mode so you have to re-evaluate the main config file:
mode,=something
eval main
- echo
Using MPlayer Tools you can create fairly complicated config files that can be hard to debug and sometimes mhelp is not enough especially if you have a lot of conditions. This command will dump you an object as mhelp would while the config files are being evaluated.
- undef
You can repeal anything you have set before. For example you if have requested the player mode then later you can cancel it using:
undef request_playermode
There are two special names you can undef:
globals - undef every assignment at once (mintime, banneddirs etc.)
all - reset everything to it's initial state (like it was at startup) except the environment.
Another special case: undef will not allow you to exterminate the whole environment because it can have serious sideeffects.
- printf
You can use this to debug your assignments. For example: printf subs/#replace#%file%#.avi#.srt#
- print
Works the same way printf does but it's less verbose.
Conditions
You can use conditions in the configuration file to set different commands or assignments.
These looks like this:
[subject regex]
or:
[hash(value) regex]
If the regex matches the subject the condition will evaluate to true and the commands and/or assignments before the [end] keyword will be evaluated.
As an example let's see how you can use the softsleep if the RTC is already in use:
[lsof /dev/rtc]
option nortc
option softsleep
[end]
You can also have if - elsif - else - end statements like this:
[filetype stream]
option cache=1024
[dir ^/tmp]
option nocache
[else]
option cache=8192
[end]
Of course you can have as many branches as you want and the [else] part is optional.
And finally you can use the AND and OR operators in one condition like this:
[file ^Video-\d+-\d+(_\d+)?\.avi$] or [filetype audio]
noseries
[end]
Please note that:
AND has higher priority like in the programming languages.
Conditions are evaluated only until they are needed as in C. For example if you have [something1] AND [something2] and something1 evaluates to false then something2 will not be evaluated.
mstart will identify modes written in this way:
[mode mkv]
option lavdopts=skiploopfilter=all
option framedrop
[end]
Your mode definitions can overlap and can be extremely complex but if you use this form then
mstart mkv file.mkv
will turn on the decoding optimizations for you if you have a slow machine.
The command line above is equivalent to:
mplayer -lavdopts skiploopfilter=all -framedrop file.mkv
Hashes
- option
mplayer option set previously inside the config file.
- ENV
test any environment variable. Example:
[ENV(KDE_FULL_SESSION) true] will be true if KDE is running
[ENV(LANG) en] will be true if your current language is english
Subjects
Movie series detection
The detection is based on filenames.
The filename must be formatted like this (the parts in [ ] are optional):
name [-] episode [anything].avi
Examples:
Desperate Housewives - 1x15 - Impossible.avi
Friends 312 - TOW All the Jealousy.avi
Stargate.SG1.S09E06.Beachhead.avi
The name of the TV show will be converted to lowercase and every whitespaces, underscores, dots and dashes will be converted to space.
If you have series in other (reasonable) format mail me!
Series detection on DVDs can be a lot more tricky. It is a new and untested option in mcatcher, I may even remove it if I find it unusable. It is based on the assumption that the DVDs are enumerated. The series name will be the disk label. The episode will be disk label/track, but if the label contains underscores only the last part will be used, for example if you have a disk labeled ROME_D1 an episode will be D1/3. Also, please note that detecting the dvd device to read the disk label may not work correctly. If it does not work for you please drop me a mail.
Optional perl modules
You can get them from CPAN but your distribution may also ship them.
In paranthesis you will find the package name in which ubuntu/debian ships the module (except for Sys::Proctitle which is currently not shipped).
- Term::ReadKey (libterm-readkey-perl)
install it if you use the PlayerMode and you change your terminal's size.
If installed mcatcher autodetects the size at every startup so you don't have to
edit the term_width option every time you change your terminal's width.
The module is also used by the msum and msize scripts.
- Sys::Proctitle
if you install it mcatcher will set it's proctitle to the currently played movie
and hides the ugly parameter list.
You can see this with a command like this:
ps -Af|grep mcatcher|grep -v grep
or the apposite `cmdline' file in the proc filesystem.
- Time::HiRes (installed by default on ubuntu)
mcatcher and mcounter uses the module for precise timings. Without this module the cpu usage calculations will be a lot less precise.
- Qt (libqt-perl)
- IPC::Open2 (installed by default)
- Compress::Zlib (libcompress-zlib-perl)
These three modules are mandatory if you want to use the GUI.
Optional programs
- osd_cat
mplayer uses this to draw on the screen. Lots of stuff are printed using osd_cat so you should install it. I'm sure your distro ships it. If you use ubuntu install the xosd-bin package.
- KDE3
I was KDE3 user for a really long time. That's why MPlayer-Tools uses the knotify system
to replace some OSD messages (because knotify looks a lot better than osd_cat). It also sets the terminal title using dcop if you use konsole.
And finally it also uses ksystraycmd for the GUI to have a nice system tray.
But nowadays KDE3 is becoming history so these features will probably be removed in a future version. But don't expect KDE4 support because I don't like it (see my opinions in a few words). Instead if I will have the time I will implement libnotify notifications and a GTK2 GUI.
2) Graphical User Interface (MPlayer GUI Frontend)
MPlayer Tools has a nice GUI written in PerlQT. It is not as effective as the command line interface (GUIs never are) but it is pretty self-explanatory. That is why my documentation about the GUI is short.
You have to know that the GUI is nothing more then an interconnection between some interfaces. mgui does the playlist management, the rest of the workload is done by mcatcher.
The main window
The upper black part of the main window is like a display, the movie's title and properties go there.
The row below contains the same informations mcatcher displays in player mode. In addition you can see an A-V box. If it is not 0.0 then the video and audio are out of sync. If it is not moving toward 0 and the CPU stays on 1.00 (or 0.50 or more on a dual core system) means that your system is not fast enough to play the movie.
The top scrollbar shows the current position in the movie, you can drag it. The bottom scrollbar shows the volume.
The buttons on the bottom of the main window do exactly the things that are written on them.
There are a few hidden clicks that you should know about.
- Right click anywhere but the buttons pops up the option menu.
- Left click on one of the lines of the black display should copy the text into the clipboard but it does not seem to work, so for now it also copies to stderr (you may find it in ~/.xsession-errors)
- Right click on the Stop button activates "Lazy Stop" which means stop when the current file is over.
- Left click on the Rem box will toggle Remaining time/Current Position display.
The playlist
I assume everybody knows what a playlist is. What you should know is that QListBox does not support playlist reordering by dragging (it selects on drag) so as a workaround there are two small buttons on the right-bottom corner of the playlist which moves the selected files up and down.
The playlist has 4 more buttons:
- Add
Adds files/streams/shortcuts/playlists to the current list. The popup menu that appears is self-explanatory, only two notes are required here:
- Playlist support - mgui has full M3U support including EXTINF, full PLS v2 support and partial ASX support. ASX is not very vell defined (well..., what do you expect from a Micro$oft product). You will be able to read every entry from an ASX but you will most likely loose information if you save a playlist back to ASX. Also mgui has it's own playlist format (called MTP) that is a lot more detailed (includes for example which entry is selected) and it is compressed (because I don't think anyone ever edited a playlist by hand).
- Adding "Series Next Episode" - if the file containing next episode (the same season and episode+1 or next season episode 1) is in the same directory as the last watched the next episode will be automatically added otherwise a filedialog pops up and you can locate the next episode yourself.
- Remove
Removes entries from the playlist. "Dead Entries" means files that has been deleted from your disk. The two options under "Physically Delete" also deletes files from your disk so be carefull because there is no confirmation.
- Options
See the next section for details.
- Misc
- Search - another playlist-like window appears where in the bottom textbox you can type what you search for. If you only enter letters, numbers, spaces, dots and dashes then a case insensitive substring search is performed where the words you typed will be searched and the dots will be optional. For example "d.j. crow" will match both "DJ The Crow" and "D.J. Crow" but will not match "Crow DJ". If other characters are present then the expression will be evaluated as a perl regular expression. For example typing "tiesto|faithless" will find both songs by Tiesto and Faithless. If the textbox becomes reddish it means that you have an error in your regular expression, for example an unclosed paranthesis. You have to escape it if you want to search for the paranthesis itself, like this: "\("
- Lazy Stop - Stop after the current file is finished
- Lazy Play - The first selected entry will start to blink signalling that no matter what your current play mode is it will be the next played entry. You can achieve the same behaviour if you right click on a playlist entry. Click on this option again to cancel lazy play.
- Run mstrip - runs the mstrip utility and also flushes the internal buffer.
- The rest of the options are self-explanatory
Options
- No Playlist Advance
If checked after a file is finished mgui will not start another. This is like an always turned on Lazy Stop.
- Autoresume On Startup
If checked the playback will be resumed automatically at startup.
- Use Software Volume Control
If checked mplayer's software volume control will be used. However I discourage you to use this option because MPlayer currently does not provide a way to set the initial level of the volume so the first few tenth of seconds of playback will be played at the original level which can be unpleasant.
- Show Remaining Time
If checked mgui shows the remaining time otherwise the current position.
- Disappear on minimize
Since Qt3 has no support for systray icon if you check this option if you minimize the main window it will disappear completely. You can bring it back either my mguicmd or by starting another mgui. KDE users have luck, because they still can see a systray icon, because of KDE's nice and shiny ksystraycmd.
- Sticky Playlist
If checked the playlist will follow the main window whereever you move it (in winamp style).
- No Auto position Saving
If checked the postition in the movie will not be saved automatically when using mgui only by pressing the msave button.
- Disable Update Notification
Starting from version 7.2 MPlayer Tools has update notifications. It checks for updates once a week on startup. Use this option to disable it. You should also know that while you are checking for new version with your copy of MPlayer Tools the update server collects anonymous usage statistics. I chose the UUID of your root partition as a unique identifier (NOT your IP) because there is no way I can trace you back based on this information so you don't have to worry about your privacy.
- mcatcher Default Mode
You can set a string to be the mode variable in mcatcher. You can use it in conditions.
- Place OSD Notifier
Use this option to drag around the notification window.
- Disable OSD Notifier
Using this option you can disable the notification window. The messages are displayed on the black display anyway.
- OSD Notifier Font
Using this option you can set the font of the notification window using a Font Dialog. I added this mainly for the font size but the font family and bold/italic settings are also saved across restarts.
- Show Clock On OSD
If checked the date and the time will also be displayed whenever the notification window pops up.
- Show Files On OSD
If checked whenever mgui starts a new file automatically a notification will be displayed.
- Play Modes
You can select from 7 different play modes. The names of these modes are self-explanatory.
- MPlayer Idle Mode Policy
mgui puts MPlayer in idle mode which means that it can reuse MPlayer after a file is finished. However there are also disadvantages. The possible modes are:
- Always Use Idle Mode - no file specific configuration file (somefile.avi.conf) will be loaded. Also none of your mplayer options defined in mcatcher.conf will work that depend on some condition based on the filename (path, file, ext, dir, series, filetype). On the other hand this play mode puts the least stress on your computer.
- Never Use Idle Mode - for every new file a new MPlayer is started. In this way everything works but this puts the most stress on you computer.
- Automatically Decide - starts a new mcacther only if the current file has a file specific configuration file (somefile.avi.conf).
- Never Use For Video Files - works like "Automatically Decide" except that it will never use idle mode for video files.
- Colors
Using this option you can set the foreground/background color of various components of the GUI using a Color Dialog.
Known issues
No bug reports about these issues please (only if you know a workaround), I will solve them as soon as PerlQT offers a solution (probably when QT4 support arrives, only God knows when will that be... )
- Segmentation fault at shutdown - I don't know why that happens, anyway the segfault happens after mgui shuts down successfully so don't worry about it.
- The notification window is not show all the time - This is because it is not a real notification window, i.e. the attribute WA_X11NetWmWindowTypeNotification is not set, I just crafted it from the available flags. On different window managers different behaviour can be expected. The moment perlqt will support QT4.4 I will correct this issue.
- Sometimes the notification window steals the focus so I loose one character when I type - the explanation is the same as above. That is why there is the "Disable OSD" option.
- It would be nice to have a systray icon - again, you have to wait until perlqt supports QT4.2 or use KDE
- Cutting to clipboard does not work (by clicking on the black display) - and I don't know why. If you do I beg you, please tell me!
- Partial ASX support - I don't plan on extending it; but if a file/url is not loaded from your playlist file please contact me.
3) TV utilities
MPlayer has built-in v4l capabilities however I find it uncomfortable to use them.
So here is a set of programs to make it easier.
Available commands
Recommended minimal lirc configuration
I recommend the following minimal lirc configuration. You can put them for example in your ~/.lircrc file.
You may need to change the button names as this configuration was created for my remote.
begin
button = REC
prog = mplayer
config = run tvrecord\nquit
end
begin
button = TIMESHIFT
prog = mplayer
config = run tvtimeshift\nquit
end
begin
button = STOP
prog = mplayer
config = run "killall -q -INT tvtimeshift tvrecord mloop"\nquit
end
begin
button = DISPLAY
prog = mplayer
config = run "tvtsinfo -q"
end
begin
button = ENTER
prog = mplayer
config = run "tvconf xosd"
end
begin
button = VOL_UP
prog = mplayer
config = run "tvvolume +"
end
begin
button = VOL_DOWN
prog = mplayer
config = run "tvvolume -"
end
begin
button = SNAPSHOT
prog = mplayer
config = screenshot\nosd_show_text ">>> SCREENSHOT"
end
begin
button = BOSS_KEY
prog = mplayer
config = run "mcounter;xset dpms force standby;xset +dpms"\npause
config = seek -10\nrun "xset dpms force on;xset -dpms;killall -q -HUP mcounter"
end
Please refer to lirc documentation (http://www.lirc.org/) if you don't know what these lines mean.
Of course this is very basic, you might also want to put another config=volume +1
and config=volume -1 entries with a different buttons or in a different mode.
Configuration Options
(to use with tvconf):
- brightness, contrast, saturation, hue:
example of usage:
begin
button = GREEN
prog = mplayer
config = run "tvconf brightness -20"\nosd_show_text "TV Brightness: -20"\ntv_set_brightness -20
config = run "tvconf brightness 0"\nosd_show_text "TV Brightness: 0"\ntv_set_brightness 0
end
- width, height
width and height of the TV
- tvopts
options passed to mplayer's -tv configuration option when watching the TV. Defaults to driver=v4l2:input=0:tdevice=/dev/vbi0
- dir
a place to save images, videos, thimeshift chunks.
- memdir,control,card,q
These options are explained above.
- pp
image postprocessing filter to use. The default is
lb/ha/va/dr/tn:128:256:512/al:f
which makes a pretty good job.
- chlist
filename containing the list of channels. Must contain lines like: SR7 National Geographic
- vo
video output to use with TV. Currently accepts only sdl, xv or x11
- lircconf
if you want to use a different lirc config file for the tv player here is the place to set it's filename
- font
use this option if you want to use a different fontfile with the TV (ex: a smaller so you can see the whole teletext page)
- shift_width, shift_height, shift_br
width, height and bitrate settings for tvtimeshift. Defaults to 640x480 3600kbit
- recopts
options passed to mplayer's -tv configuration option when recording or timeshifting. Defaults to driver=v4l2:alsa=1
- crop
Can be on or off. If your wider than the image of your TV tuner provides using this option you can crop off the black bands from the left/right side of your monitor
(by loosing some of the upper/lower part of the image). Just set this option to on and you will have real fullscreen image.
- cropaspect
if you use the crop option set this option to the aspect of your monitor. The default aspect is 16:10.
It can be set in any of the following formats: 1.6, 16:10, 16/10.
- osdcolor,osdfont
color and font passed to osd_cat (to display channel,volume,timeshift info).
Try xlsfonts. Default values are lightgreen,-misc-fixed-medium-r-normal--32-0-100-100-c-0-iso8859-1
- chunksize
The size in MB of the avi chunks tvrecord will create. The default is 4092 which keeps a FAT filesystem happy; 0 means infinite.
- +,-,@
next channel,previous channel and recall channel. Example:
begin
button = CH_UP
prog = mplayer
config = tv_step_channel 1\nrun "tvconf +"
end
begin
button = CH_DOWN
prog = mplayer
config = tv_step_channel -1\nrun "tvconf -"
end
begin
button = RECALL
prog = mplayer
config = tv_last_channel\nrun "tvconf @"
end
- And finally you can use channel presets like this:
begin
button = 9
prog = mplayer
config = tv_set_channel 50\nrun "tvconf 50"
end
which will jump to the 50th item in the channel list file.
4) Subtitle manipulation scripts
- sub2srt
a simple script that converts a .sub into an .srt
usage:
sub2srt [framerate] file [[framerate] file ...]
The default framerate is 23.976
- srtshift
see srtshift --help for a list of parameters
Examples:
shift with 2 seconds:
srtshift 2 subtitles.srt
shift with -2 seconds starting from 21 minutes
srtshift -2 21:00 subtitles.srt
change fps and put the result in output.srt
srtshift 23.976-25 subtitles.srt output.srt
Sometimes the only problem with an SRT is that it was converted from a SUB with the
wrong fps value. In this case either 23.976-25 or 25-23.976 will correct the file.
If not, try different combinations with framerates 23.976, 24, 25 and 29.97.
As a rule of thumb the second value should be your movie's fps.
Some subtitle files contain really long lines that can take up the whole screen.
In this case try breaking these long entries like this:
srtshift -b subtitles.srt
This feature is very experimental. The script can decide at which charater to break the long
entry but there is no way it could determine correctly where to break the time interval
so try using:
srtshift -b -m subtitles.srt
which will leave a strange looking mark at every broken subtitle.
Now you can adjust the timing by hand. When you are done a simple
srtshift subtitles.srt
will remove the marks.
- srtadjust
sometimes to correct a subtitle file you would have to say for example:
srtshift 13.42 29.97-23.976 subtitles.srt
These parameters are really hard to guess or calculate. In this case:
cp subtitles.srt subtitles.csrt
Then open subtitles.csrt with a text editor and on the beginning of the file
put a line containing 4 time values for example:00:00:55,522 00:02:46,410 01:36:59,580 01:47:30,400
The first 2 means where the first entry starts and where it should start,
the last 2 means where the last entry starts and where it should start.
You can determine these values by watching the movie's beginning and end.
There is no need to put exactly the first and last entries but the longest the
distance between the entries the more precise the adjustment will be.
When you are done just type:
srtadjust
and the subtitles.srt file will contain the correct subtitle file.
Of course this only works if the subtitle file was created for the movie version you have.
If there are extra or missing subtitles in the file your work is not over yet.
5) Statistical tools
- mcounter
a small script that measures a time interval until it receives
a HUP signal, then displays the measured time using osd_cat.
For an example of usage see the BOSS_KEY above.
- msum
summarizes the second entries (playtime) from your mcatcher.log file.
You can give any number of regular expressions to filter the summarized entries. Example:
msum 'Stargate SG1' '!3x'
summarizes all watched Stargate episodes except season 3.
msum 'comedy|action'
summarizes all movies containing (in the filename) either `comedy' or `action'.
Dirnames in the regexes are normalized to their full path.
For example if you are in the /mnt/Movies/ directory then:
msum ./Friends.+avi
has the same effect as
msum /mnt/Movies/Friends.+avi
Use the --head or -h and --tail or -t options summarize only the first or last part of the
results. They can be repeated as many times as you want, i.e.:
msum --head 100 -t 3 --head 1
If you give a negative number to the head or tail parameter it will be interpreted as the
number of total lines minus the parameter ex:
msum -h -1
will summarize every entry except the last one.
Use --minlength or -l to filter entries that are too short.
Use --maxlength or -L to filter entries that are too long.
Example: msum -l 60 -L 120 will display enties played from one to two minutes.
Use --series or -s with a regex parameter to show only entries belonging to the matched series.
Use --filetype or -f with a regex parameter to show only entries with matching filetype. Ex: msum -f audio will show only audio files.
If there is a shortcut to a file msum will display the shortcut in paranthesis.
If no number of output lines are requested msum displays as many as fits on the screen.
- msize
mplayer-tools <= 5.2 used to have a script called moviesize. This is a rewrite from scratch of that script, this version is faster and more configurable.
The script displays a nice table with the properties of all the media files (audio or video) starting from the current directory.
Use the option `-s' to save it to a file. If you do not supply a filename it will save to msize.nfo.
You can control the order by fields using the -o option and the display mode using the -m option. Please type msize --help for details.
You can also filter by type the files to scan using the -t option.
- rsize
The name rsize comes from real size. If you want to compose a CD or DVD with minimal wasted space the utilites like du might not be the best.
rsize summarises the real sizes of the files/directories (not their disk usage) which is more relevant on an ISO/UDF filesystem.
Give as a first parameter your disk's size in megabytes. For a DVD it is minimum 4482 MB (this is the default), for a CD 703 MB.
Use the options -k,-m,-g or -t to summarize in kilobytes,megabytes,gigabytes ot terrabytes. If none of them is given every file will be shown in the most expressive way.
Or use the -h option to give hints of what to copy to a DVD (this forces the display mode to megabytes).
The rest of the parameters are the file/directory names you want to summarize. If none given it uses all the files/directories in the current directory.
5) Final notes
At first the mcatcher.conf file may seem complicated. See a sample file in the doc/ directory. The config file is not compatible with versions <=5.2 that is why it has been renamed.
mplayer-tools <=5.2 used to have options to start the X server automatically if it isn't already running for both mcatcher and tv.
This has been removed starting from verion 6.0 since nowadays every distribution ships their linux with an X display manager so probably no one would use the option anyway.
Version 6.0 also introduces conditions in the config file and dynamically loadable modules from the mplayer-tools library.
If you find any bugs (which you probably will) or have any ideas regarding to the package, do not hesitate to contact me.
My email address can be found in the AUTHORS file in the package.
mplayer-tools © 2009 Soós Gergely
mplayer-tools comes with ABSOLUTELY NO WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
This is free software, and you are welcome to redistribute it under certain conditions. See the GNU General Public License for more details.