Archive
Which media player to use?
When I started to use Linux, I played movies with mplayer. Then the development of mplayer seemed to slow down (stopped?) and I switched to VLC. VLC is very easy to use and it plays everything, so I’m very satisfied with this player.
A few days ago I discovered mpv, which is a fork of mplayer2 and MPlayer. It shares some features with the former projects while introducing many more.
It seems that mplayer and mplayer2 are dead, but mpv is developed actively (check it out on github).
I just ran through its feature list and I saw that if you quit with Shift-q (i.e. Q), then mpv will resume from that position next time you start the same movie. Cool.
So next to VLC you can keep mpv too.
black screen with VLC and mplayer
Problem
When trying to play a video, I get a black screen. It’s the same with VLC and mplayer.
Solution
mplayer:
alias mplayer='mplayer -vo x11'
VLC:
Go to Tools -> Preferences -> Video. At the Output, choose “X11 video output (XCB)” from the dropdown list. If it doesn’t work, untick the option “Accelerated video output (Overlay)”.
mplayer doesn’t quit
Problem
When I play a song with mplayer (from the package mplayer2), the song is played but mplayer doesn’t quit, I don’t get the prompt back. This is annoying if I want to play sound effects from a script and tens of mplayer processes are hanging…
Solution
Add the “-ao alsa
” switch as a temporary solution (tip from here):
mplayer -ao alsa audio.mp3
Play an interlaced video without those funny lines
Problem
I wanted to watch a DVD but it was interlaced, thus it contained lots of disturbing horizontal lines. How to get rid of those lines? Is there a way to filter them out?
Solution
Mplayer has an option for that :) Try this:
mplayer -vf pp=lb interlaced_video.iso
This procedure is called deinterlacing.
Tip from here. Image borrowed from here.
Update
VLC can do this too. Available under Video -> Deinterlace. You can also choose the deinterlacing method under Video -> Deinterlace mode.
Play the first 30 seconds of a song with mplayer
mplayer -endpos 00:00:30 song.mp3
I have an alarm script that loads a bunch of MP3s and starts playing them in random order in the morning. However, some songs are very long, some of them are boring, etc. So I prefer playing just the first X seconds of each song.
This tip is from here.
Screenshot and video information with mplayer
Let our test file be “/tmp/test.wmv
“.
Getting video info
mplayer '/tmp/test.wmv' -ao null -vo null -frames 1 -identify
It will produce a long output. You can refine the output:
(mplayer '/tmp/test.wmv' -ao null -vo null -frames 1 -identify | grep ID_) 2>/dev/null
Again, it will produce a long output that I omit. The video length is here (given is sec.):
ID_LENGTH=119.93
Another interesting line is the video summary:
(mplayer '/tmp/test.wmv' -ao null -vo null -frames 1 -identify | grep 'VIDEO:') 2>/dev/null
Sample output:
VIDEO: [WMV3] 320x240 24bpp 1000.000 fps 386.0 kbps (47.1 kbyte/s)
Taking a screenshot at a given time
mplayer '/tmp/test.wmv' -ss '20' -noautosub -frames 1 -ao null -vo png:outdir='/tmp'
Here we take a screenshot from the video at 20 sec. The output file will be /tmp/00000001.png
(mplayer gives this name automatically).
Ref.: I found these tricks in this project.
Configure Midnight Commander to open files with custom application
Problem
You use Midnight Commander (mc) for all your file operations. So far it’s not a problem :) However, when you hit Enter on a file, you would like to set what application mc should use for opening the given file.
For instance, you want to open an .avi
file with VLC instead of X player, etc.
Solution
Steps to follow:
cd ~/.mc cp /etc/mc/mc.ext . ln -s mc.ext bindings
That is, copy the global mc.ext
to your local .mc
directory and put a symbolic link on it called bindings
. Now you can start customizing your local mc.ext
file.
Don’t forget to restart mc after editing mc.ext
!
Examples:
(1) You want to open all your video files with VLC. You also want to add support for .wmv
files.
# add these lines regex/\.([wW][mM][vV])$ Include=video # modify the include/video section include/video #Open=(mplayer %f >/dev/null 2>&1 &) # for mplayer Open=(vlc %f >/dev/null 2>&1 &) # for VLC
(2) Open .docx
files with OpenOffice.org.
# add these lines regex/\.([Dd][oO][cC][xX])$ Open=(ooffice %f &)
(Thanks for the mc mailing list for their help).