Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

MPlayer/MEncoder Tips and Tricks

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Message
Author
User avatar
garrincha
Posts: 2335
Joined: 2006-06-02 16:38

MPlayer/MEncoder Tips and Tricks

#1 Post by garrincha »

MPLAYER TIPS & TRICKS

Last Edit (23.05.2009)

MPlayer is a high quality media player with feature rich options that can play almost every known media files. It can play media such as DVD, VCD, CD, DVB, web-stream, and in any containers such as SMplayer, KMplayer, MythTV, Kaffeine, etc. MPlayer by itself is a command-line tool (CLI), however there is a graphical frontend called gmplayer that come by default with at least one skin theme (mplayer-skin-blue). If you are either not comfortable with CLI or need features like DVD navigational menus I would suggest you use SMplayer which is available in the Debian repository.

Please consulate the MPlayer documentations at mplayerhq website for features, supported input formats, supported video & audio codecs, and supported video & audio output devices.

This HOW-TO explains how to setup MPlayer on your Debian system. Feel free to add your own tips and tricks and examples are also welcome.

Note:
1.In all instance, the console/terminal prompt # refer to 'root' usage and $ refer to normal usage.
2.I use apt-get in all instances of package management but feel free to use your own such as aptitude or synaptic.

MPlayer is in the main Debian repository. To get the Debian MPlayer,

Code: Select all

# apt-get update
# apt-get install mplayer
This will get you setup quickly with standard mplayer and gmplayer with default blue-skin theme.

I would recommend that you install MPlayer using either of the two methods below:

Method 1
Install from the Debian-Multimedia repository maintained by Christian Marillat as it's more up to date though it requires some non-free packages. Open the /etc/apt/sources.list file with an editor of your choice, in this case nano:

Code: Select all

# nano -w /etc/apt/sources.list
Add the following lines:

Code: Select all

deb http://www.debian-multimedia.org branch main
deb-src http://www.debian-multimedia.org branch main
Replace 'branch' with etch (or oldstable), lenny (or stable), squeeze (or testing) or sid (or unstable) for your version of Debian box, e.g.:

Code: Select all

deb http://www.debian-multimedia.org squeeze main
deb-src http://www.debian-multimedia.org squeeze main
Save and exit from the editor. Check the Debian-multimedia.org site for specifics on other arch, repositories, mirrors, updates about some packages and FAQs.
Get the apt-key:

Code: Select all

# apt-get install debian-multimedia-keyring
Update and install MPlayer:

Code: Select all

# apt-get update
# apt-get install mplayer w32codecs
For x86_64 PC, there is a w64codecs binary codecs. If you want to have a mozilla based browser plugin:

Code: Select all

# apt-get install mozilla-mplayer
Method 2
Install MPlayer from source files, i.e., the daily Subversion (SVN) snapshots which is the recommended method and it's generally stable or download via SVN. There is a quick compilation and installation instructions in the mplayerhq's README page.

To get SVN snapshots:
Debian-multimedia source and binaries page.

To download via SVN, make sure that you have the package subversion installed before doing SVN checkout:

Code: Select all

$ svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
A quick summary of installation instructions:
1. Update and install the necessary developmental libraries and build tools:

Code: Select all

# apt-get update
# apt-get build-dep mplayer
# exit
2. For source tar file, unpack it. Change to the mplayer directory. First run this to see all available configuration options:

Code: Select all

$ ./configure --help
Gentoo wiki has a page explaining some of the configuration options: Gentoo wiki Mplayer.

3. Compile with your specific configurations, e.g., dvb, lirc, and other optimisations enabled or disabled then build the *.deb package all with one command:

Code: Select all

$ DEB_BUILD_OPTIONS="--enable-gui --enable-menu" fakeroot debian/rules binary
4. Change to directory where the *.deb MPlayer file is located and install:

Code: Select all

# dpkg -i mplayer*.deb
Once MPlayer is installed, I highly recommended you to read the huge manual page for mplayer:

Code: Select all

$ man mplayer
Or read the online version: Mplayer online manual.

MPLAYER PLAYBACK
In the terminal run without options:

Code: Select all

$ mplayer
You'll get list of basic options. The basic playback of a video file in local directory:

Code: Select all

$ mplayer /path/to/your/video
You will notice that the console will fill up with a lot of output - this can be useful information for debugging. For increased verbosity, use the -v option:

Code: Select all

$ mplayer -v /path/to/your/video
To playback in full screen, use the -fs option:

Code: Select all

$ mplayer -fs /path/to/your/video
By default mplayer will scale a video with a different aspect ratio , e.g., to playback fullscreen with an aspect ratio of 16:9:

Code: Select all

$ mplayer -monitoraspect 16:9 -fs /path/to/your/video
To loop the playback use the -loop option. Playback two times and exit:

Code: Select all

$ mplayer -loop 2 /path/to/your/video
To loop forever:

Code: Select all

$ mplayer -loop 0 /path/to/your/video
This will resulted in smoother playback looping twice, and will get rid of the irritating jump between end and start of last video in the option:

Code: Select all

$ mplayer /path/to/your/video -loop 2
To playback 45 seconds from start of the video:

Code: Select all

$ mplayer /path/to/your/video -ss 45
1 hr & 30 mins from start of the video:

Code: Select all

$ mplayer ~/path/to/your/video -ss 01:30:00
MPLAYER PLAYBACK: FRAMEBUFFER
It's possible to run MPlayer from the console in framebuffer mode. Assuming that you have already setup the framebuffer and ALSA:

Code: Select all

$ mplayer -vo fbdev /path/to/your/video
To go full screen (may be too CPU intensive using 'scale' option):

Code: Select all

$ mplayer -vo fbdev -fs -vf scale=1440:900 /path/to/your/video
KEYBOARD SHORTCUT
Some useful default keyboard control (check man page for full list):

Code: Select all

right arrow/left arrow: Seek forward/back 10 seconds
up arrow/down arrow: Seek forward/back 1 minute
page up/page down: Seek forward/back 10 minutes
< and > : Move backward and forward in playlist
p, space: Toggle pause
f : Toggle full-screen
t : Toggle stay-on-top
q, Esc: Stop playing and quit
+ and - : Adjust audio delay by +/-0.1 seconds (100ms)
j : Rotate through subtitles
/, 9 and *,0 : Decrease/increase volume
m : mute sound
scroll wheel: Seek forward/back
MPLAYER CONFIGURATION FILE
Mplayer configuration files are usually located in ~/.mplayer/ for user setting and /etc/mplayer/ for system-wide setting. You can set up most of the frequently used configuration in ~/.mplayer/config. If you do not have a config file in ~/.mplayer, just copy the system wide one:

Code: Select all

$ cp /etc/mplayer/mplayer.conf ~/.mplayer/config
You can also copy & edit the /etc/mplayer/input.conf file to ~/.mplayer. So if you always use these playback options:

Code: Select all

$ mplayer /path/to/your/video -vo xv -ao alsa -channels 2 -alang=de,en -slang=en
As an example, you could put these configurations in your ~/.mplayer/config file:

Code: Select all

vo=xv
ao=alsa
channels=2
alang=en,de
slang=en
This will play the same configuration as the command-line options above:

Code: Select all

$ mplayer /path/to/your/video
DVD PLAYBACK
MPlayer has good support for DVD playback but not for DVD menus and navigation (for these I would suggest you try the latest package SMPlayer or xine). The graphical gmplayer has a limited menu features including playback, titles, chapters, audio language & subtitle language. MPlayer simply skips the menu system and goes straight to the first video in the title. Some DVDs have several titles each containing stuffs like main feature, deleted scenes, etc. To start playback of the first title in the DVD:

Code: Select all

$ mplayer dvd://1
To get more information, use -v option:

Code: Select all

$ mplayer -v dvd://
You'll see output like these:

Code: Select all

Reading disc structure, please wait...
There are 4 titles on this DVD.
There are 1 angles in this DVD title.
DVD successfully opened.
audio stream: 0 format: ac3 (5.1) language: en aid: 128.
audio stream: 1 format: dts (5.1) language: en aid: 137.
audio stream: 2 format: ac3 (stereo) language: en aid: 130.
number of audio channels on disk: 3.
subtitle ( sid ): 0 language: en
subtitle ( sid ): 1 language: en
number of subtitles on disk: 2
Mplayer will attempt to play from /dev/dvd but if that device doesn't exist or you want to point it to a different device, use the -dvd-device option. Playback from /dev/hdc:

Code: Select all

$ mplayer dvd://1 -dvd-device /dev/hdc
The -dvd-device option can also be used to playback a DVD image on your filesystem or VOB files directory:

Code: Select all

$ mplayer dvd://1 -dvd-device /path/to/dvd.iso

Code: Select all

$ mplayer dvd://1 -dvd-device /path/to/VOB/directory
To specify chapters or range of chapters, use the -chapter option, e.g., playback of chapter 3 to 6 on title #1:

Code: Select all

$ mplayer dvd://1 -chapter 3-6
To specify audio language, use the -alang option. It can accept multiple languages, MPlayer will playback the first language and fall back on the next:

Code: Select all

$ mplayer dvd://1 -alang de,en
To specify subtitle title, use the -slang option:

Code: Select all

$ mplayer dvd://1 -alang de,en -slang en
By default you will not be able to playback some encrypted DVDs especially the commercial one. To playback these DVDs you'll need the libdvdread library and from the Debian-Multimedia repository, the libdvdcss library for decrypting the content (Note: be aware that there are different legal ramifications of thesepackages in different country):

Code: Select all

# apt-cache search libdvdread
# apt-cache search libdvdcss

Code: Select all

# apt-get install libdvdread3 libdvdcss2
(S)VCD PLAYBACK
(S)VCD playback in mplayer is similar to DVD playback, just use the vcd:// argument. It can play .bin files from (S)VCD:

Code: Select all

$ mplayer vcd://1
STREAM PLAYBACK
MPlayer supports playback from many different audio and video streams, e.g., to play a mms stream, pass the URL on the command line:

Code: Select all

$ mplayer mms://url/path/to/video.wmv
Sometime it's much smoother playing off CLI instead of embedded plugins in the web-browser. If you want to play the stream in the browser, you'll need the plugin package mozilla-mplayer.

You can use the playlist for stream from web radio for example. To create a playlist open a text editor, copy & past the stream URL and save it as whatever name you choose and playback it with the -playlist option:

Code: Select all

$ mplayer -playlist /path/to/your/stream/playlist/file
You can also rip and save the stream with the -dumpstream and -dumpfile options:

Code: Select all

$ mplayer -dumpstream mms://url/path/to/video.wmv -dumpfile your_dumped_stream.wmv

ANALOGUE & DIGITAL TV CARD PLAYBACK
If you have a TV tuner card whether it's a PCI or USB it should be a simple matter of using mplayer to play and also record your favourite TV show. Setting up your TV tuner is beyond the scope of this HOWTO, nevertheless I'll point you to the excellent linuxtv.org website for V4L-DVB cards and the IVTV driver website for cards like Conexant's and Hauppauge's PVR 1xx/2xx/3xx, etc. Also, you can check my HOWTO for Hauppauge WinTV-HVR-1110 DVB-T card in this forum.

Taking DVB-T card as an example, once you have it setup you can test your DVB card, scan channels and use mplayer to play & record your show. Install some dvb utilities such as dvb-apps, dvbsnoop, dvbstream and dvbtune. Follow this guide for scanning channels and creating a channels.conf file. Put the channels.conf file in ~/.mplayer directory. To play a DVB-T channel:

Code: Select all

$ mplayer dvb://"stream name" 
where stream name can be found in the ~/.mplayer/channels.conf file, it must be exact string of words as in the channels.conf file, e.g:

Code: Select all

$ mplayer dvb://"BBC ONE" 
To record a channel:

Code: Select all

$ mplayer -dumpstream dvb://"BBC ONE" -dumpfile bbc_one.ts
To convert your recorded video to another format you could use MEncoder which is part of the MPlayer package. Mencoder can also be used in place of MPlayer to record stream, as this simple options demonstrate:

Code: Select all

mencoder -ovc copy -oac copy -o bbc_one.ts dvb://"BBC ONE"
You can watch this show in anorther terminal:

Code: Select all

$ mplayer /path/to/bbc_one.ts
See these guides for more detail including options for analogue TV:
linuxtv.org Mplayer
linuxtv.org Mencoder.


SUBTITLE & OSD MENU
MPlayer can handle most subtitles, see subtitles and On-Screen-Display (OSD) for detail.
There are many text subtitle like *.srt (SubRip) or *.ssa (Sub Station Alpha) file that you could download and play in MPlayer with -sub option:

Code: Select all

$ mplayer -sub /path/to/your_subtitle /path/to/your/video
If you have a video called matrix.avi and a subtitle file for this video called matrix-de.srt in the same directory, you can rename the subtitle file and play the video without -sub option:

Code: Select all

$ mv matrix-de.srt matrix.srt
$ mplayer matrix.avi
You can specify a subtitle font other than the default. Check that there is a true-type font for mplayer subtitle like DejaVuSans which is located in /usr/share/fonts/truetype/ttf-dejavu/ directory. To change the subtitle font size, i.e. enlarging or reducing it:

Code: Select all

$ mplayer -subfont-text-scale 3 /path/to/your/video
You can use a menu.conf file for OSD to navigate the DVB channels, playlist files and directories – useful if you have a remote control and lirc setup. Copy, paste and save it as ~/.mplayer/menu.conf:

Code: Select all

<txt name="man" file="manpage.txt"/>
<filesel name="open_file"/>
<filesel name="open_list" file-action="loadlist '%p'" auto-close="yes"
    title="Open a playlist: %p" />
<dvbsel title="Channel List" name="dvbsel" />
<pt name="jump_to"/>
<console name="console0" height="80" vspace="0">Welcome to MPlayer</console>
<txt name="man" file="manpage.txt"/>
<pref name="general_pref" title="General">
      <e name="autoq"/>
      <e name="autosync" />
      <e name="framedrop"/>
      <e name="quiet"/>
      <e name="softsleep" />
</pref>
<pref name="demuxer_pref" title="Demuxer">
      <e name="aid"/>
      <e name="alang" />
      <e name="cache"/>
      <e name="channels"/>
      <e name="dvdangle" />
      <e name="forceidx"/>
      <e name="fps"/>
      <e name="hr-mp3-seek"/>
      <e name="idx"/>
      <e name="mc"/>
      <e name="ni"/>
      <e name="nobps"/>
      <e name="srate"/>
      <e name="vid"/>
</pref>
<pref name="osd_sub_pref" title="OSD & Subs">
      <e name="ffactor"/>
      <e name="noautosub"/>
      <e name="osdlevel"/>
      <e name="sid"/>
      <e name="slang"/>
      <e name="subdelay"/>
      <e name="subfps"/>
      <e name="subpos"/>
      <e name="unicode"/>
      <e name="utf8"/>
      <e name="vobsubid"/>
</pref>
<pref name="audio_pref" title="Audio">
      <e name="abs"/>
      <e name="af"/>
      <e name="ao"/>
      <e name="delay"/>
      <e name="mixer"/>
</pref>
<pref name="video_pref" title="Video">
      <e name="bpp"/>
      <e name="brightness"/>
      <e name="contrast"/>
      <e name="display"/>
      <e name="double"/>
      <e name="dr"/>
      <e name="fs"/>
      <e name="geometry"/>
      <e name="hue"/>
      <e name="icelayer"/>
      <e name="noslices"/>
      <e name="panscan"/>
      <e name="rootwin"/>
      <e name="saturation"/>
      <e name="vm"/>
      <e name="vo"/>
      <e name="vf"/>
      <e name="xineramascreen"/>
 </pref>
<cmdlist name="pref_main" title="Preferences" ptr="<>" >
    <e name="General ..." ok="set_menu general_pref"/>
    <e name="Demuxer ..." ok="set_menu demuxer_pref"/>
    <e name="Osd/Subtitles ..." ok="set_menu osd_sub_pref"/>
    <e name="Audio ..." ok="set_menu audio_pref"/>
    <e name="Video ..." ok="set_menu video_pref"/>
</cmdlist>

<cmdlist name="main" title="MPlayer OSD menu" ptr="<>" >
      <e name="Pause" ok="pause"/>
      <e name="Prev/Next" ok="pt_step 1" cancel="pt_step -1"/>
      <e name="Jump to ..." ok="set_menu jump_to"/>
      <e name="Open ..." ok="set_menu open_file"/>
      <e name="Open playlist ..." ok="set_menu open_list"/>
      <e name="DVB" ok="set_menu dvbsel"/>
      <e name="Help" ok="set_menu man"/>
      <e name="Pref" ok="set_menu pref_main"/>
      <e name="Console" ok="set_menu console0"/>
      <e name="Quit" ok="quit"/>
</cmdlist>
To activate the menu and to get nice OSD & subtitle font, put these lines in your ~/.mplayer/conf file:

Code: Select all

font=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf
ffactor = 0.75
subfont-text-scale=3
subfont-osd-scale=3
menu=yes
SCREEN-CAPTURE
To make a screen capture:

Code: Select all

$ mplayer /path/to/your/video -vf screenshot
Press 's' key to take a screenshot, it will be saved in the format shot00xx.png in the same directory. To make a continuous capture, caplock s to 'S', run the above command and press the capital 's' key.

Other method: first play it with x11 output driver (no hardware acceleration) and pause the video (spacebar or p):

Code: Select all

$ mplayer -vo x11 /path/to/your/video
Open a second terminal:

Code: Select all

$ import screenshot.jpg && display screenshot.jpg
A cross-hair will appear, click on the video window and an image window will open up and it will be saved as screenshot.jpg in the directory where the screenshot was invoked. These require the package imagemagick for the import, display commmands and other powerful tools, so install it:

Code: Select all

# apt-get install imagemagick
.
Convert (from imagemagick) a video file of arbitrary format to a sequence of images:

Code: Select all

$ mplayer -nosound -vo jpeg /path/to/your/video
For best quality try png format and n for any number from 0 to 9 for compression quality with 9 being the highest quality but slow processing:

Code: Select all

$ mplayer -nosound -vo png:z=n /path/to/your/video
For example:

Code: Select all

$ mplayer /path/to/your/video ss 10:00 -vo jpeg
This will begin screen capture several frames/sec, beginning 10 minutes into the video. Press <Ctrl> + C as soon as you've collected enough images to choose from. You can use imagemagick's display tool to look at each image:

Code: Select all

$ display 00001.jpg
Note: If you use the capture options You will end up with an extremely large collection of numbered JPEG images in the directory, unless you end the process or seek to fixed number of frames.

CREATING AN EDITED VIDEO FOR PLAYBACK
One of the nicest features of mplayer is the ability to edit out contents in a video for example you might want to edit video with questionable contents for your kids or you might want to edit out an annoying character from a movie or to skip commercials. You can use a feature called EDL (Edit Decision List) to do all of these.

To use EDL, simply play the video you want to edit by running mplayer with -edlout option:

Code: Select all

$ mplayer -edlout sample.edl /path/to/your/video
As mplayer goes through the video, when you see a scene you want to edit or skip, hit 'i' and mplayer will write the start time in the file and set it to skip for 2 seconds, hit 'i' again to end the edited/skipped scene. The file sample.edl is basically a text file with each line containing a start time and end time in seconds, and an action, for example:

Code: Select all

4.504500 11.594916 0
416.290863 423.256165 0
The begin and end seconds are in floating point format and the action is a number, either a zero or a one. If action is 0, mplayer will skip the scene between the begin and end points entirely. If the action is 1, mplayer will mute the scene. When you have finished with the video you just go back to the EDL file and tweak the timings. Once completed, run mplayer with the -edl option:

Code: Select all

$ mplayer -edl sample.edl /path/to/your/video
MPLAYER TROUBLESHOOTING
If your playback is slow or jerky, try this example:

Code: Select all

$ mplayer -cache 8192 -cache-min 4 mms://url/path/to/video.wmv
This will allow you to have 8MB cache that will fill to 4% before starting, and the buffer will build up from there. You can use this option in the example for playing web stream and playlist especially if the server has bad connection or a lot of buffering.

The xv video output option is the default that most media players are set to. It use the XVideo extension in X for hardware acceleration. To test whether your card has support for it:

Code: Select all

$ xvinfo
If you have trouble playing with the default xv driver, try with different video output driver using the -vo option. To playback with x11 driver for example:

Code: Select all

$ mplayer -vo x11 /path/to/your/video
The x11 option will playback without any hardware acceleration. All display, scaling of video is done by software so it's very CPU-intensive. To scale to full screen for example use the -zoom option.
To get a quick listing of -vo drivers:

Code: Select all

$ mplayer -vo help
Check the manual page or the online mplayer manual for detailed descriptions of video output drivers.
To change video resolution:

Code: Select all

$ mplayer -vm -screenw 640 -screenh 480 /path/to/your/video
This is useful especially if you have few video memory and need to change video resolution. If you get strange output or couldn't get any video, try x11 (not recommend) however it will not allow you to change the size of the video especially full screen - use the -zoom option where possible.

To normalise the volume, this will maximise the volume of the audio track without distortion:

Code: Select all

$ mplayer -af volnorm 4 /path/to/your/video
Sometimes on an older/slower PC, mplayer will have a hard time playing certain videos, you can use the mplayer's framedrop for playback with less CPU power (note if your system is really too slow you'll miss a lot of stuffs from your video):

Code: Select all

$ mplayer -framedrop /path/to/your/video
Addendum :
See:
http://www.mplayerhq.hu/design7/news.html
News
2009-02-20, Friday :: Video Acceleration and You
posted by Compn

There are several ways to speed up the playback of 1080 H.264 files in MPlayer.

First is to use the newly added VDPAU output. It allows the newer Nvidia video cards to decode the video without using much CPU. It is in SVN MPlayer (Nvidia binary driver 180.37 or newer required), you can find known bugs and report bugs HERE. (Linux, Solaris and FreeBSD only)
How to get the SVN version is described on the download page and snapshot tarballs are available as well.

Second is to use MPlayer with the experimental multithreaded FFmpeg-mt branch, which allows you to use multiple cores/CPU. (all OS and CPU supported)

To install, copy and paste this line:
git clone git://repo.or.cz/mplayer && cd mplayer && git checkout origin/mt && git submodule init && git submodule update && ./configure && make && make install
To enable threading run mplayer -lavdopts threads=N file.mkv where N is the number of threads you want to use.
NOTE: FFmpeg-mt has problems with packed b-frames.

A Windows build of MPlayer using FFmpeg-mt can be found at http://kovensky.project357.com.

Third is to use the multithreaded CoreAVC codec with the CoreAVC-for-linux project. The CoreAVC decoder costs $15 USD. (Linux ONLY)(Windows users only need this PATCH)

Fourth, FFmpeg has added some optimizations from the x264 project. To fully utilize these you will need to make sure a recent version of YASM is installed and detected by the latest SVN MPlayer when compiling. (32bit x86 CPU only!)

Fifth, using -lavdopts skiploopfilter=all:fast=1 may cause artifacts, but will allow you to play larger files in realtime. (all OS and CPU supported) (use -lavdopts skipframe=nonref:skiploopfilter=all:fast=1 for even more speedup, skipframe also works with VDPAU.)

There is also a rejected PATCH which adds support for the new multithreaded binary VC-1/WMV3 codec.
MENCODER

Some useful links for encoding video using MEncoder, maintaining audio/video synchronization, VCD/(S)VCD, and some example scripts:

1. Mplayerhq: Using MEncoder to create VCD/SVCD/DVD-compliant files
2. Gentoo wiki's MEncoder HOWTO, and How to create a DVD with MEncoder.

CREATING PAL compliant DVD

For format constraints, please read the link for mplayerhq in no. 1 above. Generally, I use for widescreen PAL DVD (720x576):
* aspect ratio: 16/9
* framerate: 25
* ofps: 25
* vcodec: mpeg2video
* sample rate: 48000
* vrc_buf_size: 1835
* abitrate: 192 kbps for stereo (can be up to 1536; 384 kbps for 5.1 channel sound)
* vbitrate: 4900 (can be up to 9800, but longer encoding, better quality and limited to up to 1 hr of video on a single layer DVD)
* keyint: 15

The video will be encoded to *.ac3 audio, but you could also use *.mp2 audio (for PAL DVD only). I use the script below to encode my DVB-T MPEG-TS video to DVD. Open a text editor like nano, copy & paste the script below:

Code: Select all

#!/bin/sh
read -p "Name of video1: " VIDEO1;
mencoder -of mpeg -mpegopts format=dvd:vaspect=16/9:vframerate=25 -vf scale=720:576,harddup \
-srate 48000 -af lavcresample=48000 -ofps 25 \
-ovc lavc -oac lavc -lavcopts vcodec=mpeg2video:\
vrc_buf_size=1835:\
keyint=15:\
vrc_maxrate=9800:\
vbitrate=4900:\
aspect=16/9:\
acodec=ac3:abitrate=192 \
${VIDEO1}.mpg -o ${VIDEO1}-output.mpg
Save & exit . Make the file executable:

Code: Select all

$ chmod +x your_mencode_script
Run it in the same directory as the video:

Code: Select all

$ ./your_mencode_script
When prompted to type in the name of input video file, type in only the filename (as labeled by 'VIDEO1') not including the extension. Of course if the original video has the same extension as the output it will be overwriten. To keep the original video, either rename -o ${VIDEO1}.mpg to something like -o ${VIDEO1}-output.mpg or redirect the output to a different directory like -o /path/to/other/directory/${VIDEO1}.mpg.

LINKS
1. Offical MPlayer Documentation.
2. Multimedia Dynamite, Linux Journal, October 1st, 2007.
3. julian67's HOWTO: Multiple / Sequential Video Thumbnails
Last edited by garrincha on 2009-05-23 11:41, edited 8 times in total.
Maurice Green on Usain Bolt's 9.58: "The Earth stopped for a second, and he went to Mars."

User avatar
canci
Global Moderator
Global Moderator
Posts: 2502
Joined: 2006-09-24 11:28
Has thanked: 136 times
Been thanked: 136 times

#2 Post by canci »

Thank you so much! This is what I was looking for...

Do you, by any chance, also know how to specify the subfont size
via command line? My font is always so big, but with gmplayer it's OK,
'cause there's an option to decrease the size... TNX!
Image Stable / Asus VivoBook X421DA / AMD Ryzen 7 3700U / Radeon Vega Mobile Gfx (Picasso) / 8 GB RAM / 512GB NVMe

READ THIS:

* How to Post a Thread Here
* Other Tips and Great Resources

User avatar
garrincha
Posts: 2335
Joined: 2006-06-02 16:38

#3 Post by garrincha »

canci wrote:Thank you so much! This is what I was looking for...

Do you, by any chance, also know how to specify the subfont size
via command line? My font is always so big, but with gmplayer it's OK,
'cause there's an option to decrease the size... TNX!
This should do it:

Code: Select all

$mplayer -subfont-text-scale 3 ~/path/to/you_video.avi
EDIT: 3 is default (I think) decrease it for smaller font and increase it for bigger font.
Maurice Green on Usain Bolt's 9.58: "The Earth stopped for a second, and he went to Mars."

User avatar
canci
Global Moderator
Global Moderator
Posts: 2502
Joined: 2006-09-24 11:28
Has thanked: 136 times
Been thanked: 136 times

#4 Post by canci »

Yay! You go! :D
Image Stable / Asus VivoBook X421DA / AMD Ryzen 7 3700U / Radeon Vega Mobile Gfx (Picasso) / 8 GB RAM / 512GB NVMe

READ THIS:

* How to Post a Thread Here
* Other Tips and Great Resources

TonyT
Posts: 575
Joined: 2006-09-04 11:57

#5 Post by TonyT »

Good post!
re the debian-multimedia key, this is the key, the preceding characters are unnecessary:
# gpg --keyserver pgp.mit.edu --recv-keys 07DC563D1F41B907
# gpg --armor --export 1F41B907 | apt-key add -

You can also use this pgp url:
gpg --keyserver hkp://wwwkeys.eu.pgp.net --recv-keys 1F41B907
gpg --armor --export 1F41B907 | apt-key add

User avatar
actionM
Posts: 890
Joined: 2007-05-01 02:11

#6 Post by actionM »

Now how did I let this post slip by my eye for so long! I've been waiting for someone to break this down for me. I'm gonna give this a shot.

User avatar
garrincha
Posts: 2335
Joined: 2006-06-02 16:38

#7 Post by garrincha »

TonyT wrote:Good post!
re the debian-multimedia key, this is the key, the preceding characters are unnecessary:
# gpg --keyserver pgp.mit.edu --recv-keys 07DC563D1F41B907
# gpg --armor --export 1F41B907 | apt-key add -

You can also use this pgp url:
gpg --keyserver hkp://wwwkeys.eu.pgp.net --recv-keys 1F41B907
gpg --armor --export 1F41B907 | apt-key add
Ah, yes there is no need for the last 8 characters, I simply c&p my old note as this is how I always get the key. For anyone really lazy enough, you could always do

Code: Select all

# apt-get install gui-apt-key
to get a small GUI.
Maurice Green on Usain Bolt's 9.58: "The Earth stopped for a second, and he went to Mars."

User avatar
actionM
Posts: 890
Joined: 2007-05-01 02:11

#8 Post by actionM »

After installing mozilla-mplayer, I'm wandering why some of the wmv files load in the browser and some do not. And the ones that don't load in the browser can be saved and opened with mplayer. Any ideas?

User avatar
garrincha
Posts: 2335
Joined: 2006-06-02 16:38

#9 Post by garrincha »

I hardly use the web browser to play the video as it's crappy with my PII 350mHz CPU. However, I did noticed that sometimes the *.wmv video doesn't play or was being difficult in the browser with mozilla-mplayer plugin. I don't really have an idea at the moment, I would *guess* that it's either some problems with mozilla(?), iceweasel(?), maybe other browsers like the mozilla-firefox? I'll see if I can find any bug reports later on.
Maurice Green on Usain Bolt's 9.58: "The Earth stopped for a second, and he went to Mars."

User avatar
garrincha
Posts: 2335
Joined: 2006-06-02 16:38

#10 Post by garrincha »

I just checked the debian mozilla-mplayer bug reports - it is listed as one of the outstanding bugs (#422511), apparently:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=422511

EDIT: Correct link posted. Should be bug report #422511.
Last edited by garrincha on 2007-08-14 00:18, edited 1 time in total.
Maurice Green on Usain Bolt's 9.58: "The Earth stopped for a second, and he went to Mars."

User avatar
actionM
Posts: 890
Joined: 2007-05-01 02:11

#11 Post by actionM »

OK, thanks.

User avatar
ingo
Posts: 195
Joined: 2007-04-15 14:15
Location: http://www.hi-motorbiketours.com

#12 Post by ingo »

Brilliant, I think I might be getting somewhere after reading your post. I downloaded sopcast, entered the channel incl. the mplayer command, but this is what I am getting after calling up mplayer... Any ideas???
Playing http://localhost:8908/tv.asf.
Resolving localhost for AF_INET6...
Couldn't resolve name for AF_INET6: localhost
Resolving localhost for AF_INET...
Connecting to server localhost[127.0.0.1]: 8908...
connect error: Connection refused
STREAM_ASF, URL: http://localhost:8908/tv.asf
Resolving localhost for AF_INET6...
Couldn't resolve name for AF_INET6: localhost
Resolving localhost for AF_INET...
Connecting to server localhost[127.0.0.1]: 8908...
connect error: Connection refused
Failed, exiting.
Resolving localhost for AF_INET6...
Couldn't resolve name for AF_INET6: localhost
Resolving localhost for AF_INET...
Connecting to server localhost[127.0.0.1]: 8908...
connect error: Connection refused
No stream found to handle url http://localhost:8908/tv.asf


Exiting... (End of file)
[1]+ Exit 152 ./sp-sc-auth sop://broker.sopcast.com:3912/6418 3908 8908 >/dev/null

User avatar
garrincha
Posts: 2335
Joined: 2006-06-02 16:38

#13 Post by garrincha »

ingo wrote: Connecting to server localhost[127.0.0.1]: 8908...
connect error: Connection refused
No stream found to handle url http://localhost:8908/tv.asf


Exiting... (End of file)
[1]+ Exit 152 ./sp-sc-auth sop://broker.sopcast.com:3912/6418 3908 8908 >/dev/null
It could be that the stream is bad or connection is poor as I had similar output like this before. Sometime, I try playing the stream again and it might come back. It's essentially p2p streaming. Just make sure that the channel url is for sopcast stream - check the sopcast site or google for it. The channel number is usually append in where 'xxxx' is:

Code: Select all

$ ./sp-sc sop://broker.sopcast.com:3912/xxxx 3908 8908 > /dev/null &
EDIT: Btw, try this stream in the directory where you put the sopcast script, i.e. ~/sp-sc and tell me if it works for you:
./sp-sc sop://broker1.sopcast.com:3912/22508 3908 8908 > /dev/null &
I'm watching this at the moment.
Maurice Green on Usain Bolt's 9.58: "The Earth stopped for a second, and he went to Mars."

User avatar
ingo
Posts: 195
Joined: 2007-04-15 14:15
Location: http://www.hi-motorbiketours.com

#14 Post by ingo »

Thanks very much for your reply! Naturally I was a little late this morning with your stream, but I did get somewhere else:
ingo@dicker:/home/ingo/downloads/sopgui-0.3$ mplayer http://localhost:8908/tv.asf
MPlayer dev-SVN-rUNKNOWN-4.1.2 (C) 2000-2007 MPlayer Team
CPU: AMD Athlon(tm) XP 2500+ (Family: 6, Model: 10, Stepping: 0)
CPUflags: MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0
Compiled with runtime CPU detection.
Can't open joystick device /dev/input/js0: No such file or directory
Can't init input joystick
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing http://localhost:8908/tv.asf.
Resolving localhost for AF_INET6...
Couldn't resolve name for AF_INET6: localhost
Resolving localhost for AF_INET...
Connecting to server localhost[127.0.0.1]: 8908...
Cache size set to 320 KBytes
Cache fill: 0.00% (0 bytes) nop_streaming_read error : Resource temporarily unavailable
Cache fill: 0.00% (0 bytes)
Win32 LoadLibrary failed to load: avisynth.dll, /usr/lib/codecs/avisynth.dll, /usr/lib/win32/avisynth.dll, /usr/local/lib/win32/avisynth.dll


Exiting... (End of file)
ingo@dicker:/home/ingo/downloads/sopgui-0.3$
Could it really be that I need win libraries? I thought I had those - at least those necessary for playing DVDs. I am going to check your original mail again...

Yep, I've got the win codecs, course I have. So what went wrong above?

User avatar
garrincha
Posts: 2335
Joined: 2006-06-02 16:38

#15 Post by garrincha »

ingo wrote: Win32 LoadLibrary failed to load: avisynth.dll, /usr/lib/codecs/avisynth.dll, /usr/lib/win32/avisynth.dll, /usr/local/lib/win32/avisynth.dll
I don't *think* that avisynth.dll is a decoder, I mean why the heck it's a window dll libraries :). It's more likely to be when thing doesn't work and an indication that there is some other problem. It could be you're trying to play some problematic stream or file.

Did you actually tried playing the sopcast channel that I posted above?

Sometime it might work if you play a stream as playlist (not the sopcast stream though). Just copy & past the stream url in your text editor and save it as any name you wish and pass the the -playlist option when playing with mplayer.
Maurice Green on Usain Bolt's 9.58: "The Earth stopped for a second, and he went to Mars."

User avatar
ingo
Posts: 195
Joined: 2007-04-15 14:15
Location: http://www.hi-motorbiketours.com

#16 Post by ingo »

The stream I tried it on was the one you had posted but it was the next morning that I tried to play it, so that might have been the reason.

Will wait for Saturday and the next round of Premiership games to give it another try - will report back or be too depressed to log on - depending on the outcome...

Cheers for all your help, anyway :)

reassuringlyoffensive
Posts: 45
Joined: 2007-10-16 15:21
Location: England, UK

How I got Mplayer to stream everything.

#17 Post by reassuringlyoffensive »

--REVISED 16 Jan 2008--

If you haven't already you should

apt-get remove xine-plugin totem-mozilla mozilla-plugin-vlc kaffeine-mozilla helix-player mozilla-helix-player

apt-get install mplayer mozilla-mplayer w32codecs (And RealPlayer, try and get a deb file and use the "dpkg -i"command, see bottom of how-to. Check if it's in the repo first. You can watch RM streams with MPlayer, but it's a bit random. You need w64codecs if you run a 64bit Debian)

Then paste the following settings into gedit $HOME/.mplayer/mplayerplug-in.conf (don't worry if it's empty or if you didn't already have this file there). They improve streaming a great deal with certain sites which have caused problems.


download=1
cachesize=1024
cache-percent=25
keep-download=0
dload-dir=$HOME
noembed=0
autoplay=1
enable-wmp=1
enable-qt=1
enable-rm=0
enable-gmp=1
enable-dvx=1
enable-mpeg=1
enable-mp3=1
enable-midi=0
enable-pls=1
enable-ogg=1
enable-smil=1
enable-helix=1
nomediacache=0
nopauseonhide=1
rtsp-use-tcp=0
rtsp-use-http=0

Then rm $HOME/.mozilla/firefox/pluginreg.dat

If you use RealPlayer, make sure you change the values of rm, smil and helix to '0' in the MPlayer conf.

Keep-download is an easy way to save streaming media, just change the value to 1 and it will download to your home directory. For an explaination of what the other settings do check out http://mplayerplug-in.sourceforge.net/config.php

You can add vo= and ao= if you want to change the default video and audio output. Otherwise you don't really need those settings in the list. You can add other settings from the link above if you think they will be useful to you.

Works great for me as outlined above. Only have problems with abcnews.com due to their belief that only Microsoft users matter. No big loss though.

Also, make sure you completely remove Helix Xine, VLC and Totem Mozilla plugins as they conflict with MPlayer, and Helix conflicts with RealPlayer.

Nathan

FYI: The Ubuntu RealPlayer will work in Debian, and there is a fix in my Ubuntu how-to for when RealPlayer stutters or freezes while playing. There are also other tips and fixes that will work in Debian. Go here.
Last edited by reassuringlyoffensive on 2008-02-16 03:09, edited 16 times in total.
"Imagination is a quality given a man to compensate him for what he is not, and a sense of humour was provided to console him for what he is."

User avatar
ingo
Posts: 195
Joined: 2007-04-15 14:15
Location: http://www.hi-motorbiketours.com

#18 Post by ingo »

Cheers Nathan, but I've got the sopcast player up and running now... Good advice though if it works ;)

reassuringlyoffensive
Posts: 45
Joined: 2007-10-16 15:21
Location: England, UK

#19 Post by reassuringlyoffensive »

ingo wrote:Cheers Nathan, but I've got the sopcast player up and running now... Good advice though if it works ;)

That's good. I posted it as these settings gave me the best performance. Mplayer doesn't start too soon, BBC streams work well (even real) and stage6 (divx.com) works well too.

Give it a try.

Nathan
"Imagination is a quality given a man to compensate him for what he is not, and a sense of humour was provided to console him for what he is."

reassuringlyoffensive
Posts: 45
Joined: 2007-10-16 15:21
Location: England, UK

#20 Post by reassuringlyoffensive »

My MPlayer how-to should work better with rm and ram streams now.

Nathan
"Imagination is a quality given a man to compensate him for what he is not, and a sense of humour was provided to console him for what he is."

Post Reply