Archive
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).
My mplayer settings
To customize mplayer, modify the file ~/.mplayer/config. Every time you launch mplayer, settings are read from this file. Reduce command-line arguments and put them in this file.
Here is my config file:
# Write your default config options here! # Font font=/home/jabba/.mplayer/fonts/comic.ttf fs = "1" #subfont-text-scale = "3" subfont-text-scale = "4" #subfont-text-scale = "5" subcp = "iso-8859-2" #aspect="4:3" #aspect="16:9" # audio output: ALSA # PulseAudio caused a problem in Jaunty 9.04 beta ao=alsa # video driver vo=xv # Find subtitle files (1: load all subs containing movie name) sub-fuzziness=1 # Font encoding subfont-encoding=unicode # Subtitle file encoding utf8=yes # Resample the font alphamap (10: bold black outline) ffactor=10 # Font size (2: proportional to movie width) subfont-autoscale=2 # Font blur radius (default: 2) subfont-blur=1.0 # font outline thickness (default: 2) subfont-outline=1.0
For subtitles I use the Comic font. Download it somewhere and specify its absolute path. Videos start in fullscreen (fs). Previously I had some problems with the accents in Hungarian subtitles but with subcp I managed to solve it. The other settings are mainly for the subtitles.