|Description:||Wrapper script for mplayer which adds resumable playback; disables X, KDE, and Gnome screensavers; restores last volume levels; sends output to selected display|
|Tested On:||Aptosid; Arch Linux; Kubuntu|
|Requires:||mplayer zenity (optional: alsa-lib xdialog kdialog)|
|License:||GNU GPL v3 * SEE DISCLAIMER *|
|Feedback:||comments – issues|
- Volume Restoration
- File Manager Integration
- Keyboard Shortcuts
- Installation Instructions
mplayerstart is a wrapper script for mplayer – it starts mplayer for you and adds some functionality, including the ability to resume video and audio playback from a saved position, send video output to another display, disable the screensaver during playback (X, KDE3, KDE4, and Gnome screensavers), and restore volume levels when resuming.
When integrated into your file manager and keyboard shortcuts, mplayerstart can be used to have resumable playback simply by clicking on a file or pressing a key. (If you play a video part way, quit, then click on the file again, it will resume playback where you left off.)
mplayerstart --help Creates resume file for resumable playback; disables X, KDE, and Gnome screensavers; restores last volume levels; starts mplayer in full-screen mode; sends output to selected display. Usage: mplayerstart [OPTIONS] ~/video/movie1.avi mplayerstart [OPTIONS] ~/.mplayerstart/movie1.avi.resume mplayerstart --resumelast mplayerstart --resumepre mplayerstart --rewind mplayerstart --tvmode MODE Options: --tv sends output to TV Display ignored when playing audio; overrides tvmode setting --tvmode off sets TV-out mode off for future videos also cancels '--tvmode once' --tvmode on sets TV-out mode on for future videos --tvmode auto sets TV-out mode to auto-detect for future videos video will play on current display only works with separate X screens, not xinerama --tvmode once prepares to play only the next video on TV-out overrides prior tvmode for next play only --resume resumes playing file from last stop point --resumelast resumes playing last played media file --resumepre resumes playing previous-to-last played media file --rewind deletes last played resume file --mopt "OPTIONS" passes additional playback OPTIONS to mplayer Note: Resume files are auto-deleted after 60 days. Current data folder for resume files: ~/.mplayerstart Current TV option: -xineramascreen 2 Default Mplayer options: -vo xv -idx -fs -alang en
# Play the movie from the resume point (if any) and create a new resume point mplayerstart --resume movie.avi # Play the movie from it's beginning (don't resume) and create a new resume point mplayerstart movie.avi # Resume playback of last played media file mplayerstart --resumelast # Resume playback of a movie specifying the resume file mplayerstart ~/.mplayerstart/movie.resume # Rewinds the last played file so next playback will be from the start mplayerstart --rewind # Resume playback and send output to TV mplayerstart --resume --tv movie.avi
mplayerstart plays video files in full screen mode without a GUI. To quit playback press ‘q’. For other keyboard shortcuts see ‘man mplayer’.
Audio files are played back in GUI mode (gmplayer by default). When the audio file is done playing, press ‘q’ or close mplayer. The .resume file will not be saved until you quit mplayer.
Tip: If you want to quit mplayer without saving the resume point, press PageUp repeatedly until mplayer quits. (PageUp fast-forwards 10 minutes – thus the end of file will be reached and no resume point will be saved.) Alternatively, use the rewind command following playback (see the Keyboard Shortcuts section below).
By editing the User Options section at the top of the script, you can tell mplayerstart how to use your TV display. By default, it uses xinerama screen 2 for TV output, which is a typical setup with KDE4. You can change this to the X :1 display if you use a separate X display for your TV. Alternatively, mplayerstart can xinit a new X display just for mplayer, as described in the NVidia TV-OUT wikibook.
Along with the resume point, mplayerstart stores the volume levels for each file played, and will restore the volume level when resuming. For this functionality, amixer must be installed (installed with alsa-lib in Arch Linux). By default, mplayerstart restores the Master and PCM mixer controls. You can change this in the User Options section of the script.
File Manager Integration
The real power of mplayerstart is realized when it is integrated with your file manager. The following instructions are for KDE, but Gnome will be similar.
The first step is to create several menu items for mplayerstart commands. To do so, right-click on the K start button and select Menu Editor. Preferably in the Multimedia folder, right-click on the list of programs and select New Item. Give the new item the name “Mplayerstart Resume”.
In the command box for the “Mplayerstart Resume” item, enter:
Uncheck the “Enable launch feedback” box, and save the menu.
The next step is to associate .avi, .mpg, and other video file types with “Mplayerstart Resume”. In your file manager (Dolphin or similar), right-click on an AVI file and select Properties. Click the small wrench icon (Edit file type). Click Add. Select “Mplayerstart Resume” from the appropriate menu and click OK. Select “Mplayerstart Resume” in the Application Preference Order list, and use the Move Up button to move it to the top of the list. (This will make “Mplayerstart Resume” the default player for this media type.) Click OK, and OK again. Repeat this procedure for other video types, such as MPG, WMV, MKV, etc.
You can now simply click on a video file to have resumable playback. If you quit playback by pressing ‘q’, then play that file again, it will resume from where you left off.
Note that an alternative method in KDE for setting file associations is by using K|System Settings|Advanced|File Associations.
You can also associate the “Mplayerstart Resume” menu item with .resume files. This allows you to browse the list of resumable files (located in ~/.mplayerstart by default) and click on a .resume file to resume playback. You can do this with your file association editor or manually. Note: Due to the dot at the beginning of its name, ~/.mplayerstart is a hidden folder. You may not be able to see it listed in your home folder unless you have View|Show Hidden Files enabled in your file manager.
You can add additional menu items to enable more features in mplayerstart. For example, to create a menu item that sends output to the TV, create a menu item named “Mplayerstart TV” and use the command:
mplayerstart --resume --tv
Associate “Mplayerstart TV” with the same media file types (.avi, etc), but don’t make it the first item in the Application Preference Order list. That way when you want to play a video on the TV, you can right-click on the file and select Open With… “Mplayerstart TV”.
To create a keyboard shortcut which automatically resumes playback of the last video played, create a menu item named “Mplayerstart ResumeLast”. Use this command:
On the Advanced tab in the menu editor, set the Current Shortcut Key to Ctrl-Alt-R (or similar). Save the menu. There is no need to associate this menu item with a file type. Anytime you now press Ctrl-Alt-R, playback of the last resumable file will begin.
Other suggested keyboard shortcuts:
|Menu Item||Command||Keyboard Shortcut||Function|
|Ctrl-Alt-R||resumes playback of the last video played|
|Ctrl-Alt-P||step backward through previous resumable files|
|Ctrl-Alt-W||start last played video at beginning next time it is played|
|“Mplayerstart TV Once”||
|Ctrl-Alt-T||playback the next video on the TV|
|“Mplayerstart TV ON”||
mplayerstart --tvmode on
|Ctrl-Alt-Shift-T||playback all videos on the TV|
|“Mplayerstart TV AUTO”||
mplayerstart --tvmode auto
|Ctrl-Alt-A||playback videos on the current display|
|“Mplayerstart TV OFF”||
mplayerstart --tvmode off
|Ctrl-Alt-M||playback all videos on the monitor|
Follow the standard Script Installation Instructions. Alternatively, for Debian and Ubuntu a deb package and a PPA repository are available. On Arch Linux, mplayerstart can be installed automatically using the AUR.
Before running mplayerstart, install required packages using your package manager. For example, on Debian/Ubuntu:
apt-get install mplayer zenity
For volume level restoration, alsa-utils (amixer) is required.
For pop-up messages (eg File Not Found), zenity is used by default. xdialog or kdialog may also be used (set your preference in the User Defaults section at the top of the script). (kdialog is installed by default with KDE4. xdialog can be installed from extra in Arch Linux.)
By default, mplayerstart saves its .resume files and temporary files in ~/.mplayerstart/. You can change this by editing the User Options section. During playback, mplayerstart needs about 100MB of temporary free space in whatever folder you choose.
In addition, the User Defaults section of the script allows you to configure your default mplayer video options, TV display settings, and other features.