Archive for January, 2009

Gapless Playback of Multiple Videos with MPlayer

Saturday, January 10th, 2009

MPlayer has the reputation of a stable, full-featured, flexible and portable audio/video playback software. The greatest thing invented since the wheel.

But I encountered an annoying issue on my very first day of my new project while trying to play a sequence of video files with MPlayer on a Linux box. There would always be flicker between the videos.

Fortunately, there’s a nice solution to this. Unfortunately I tried tons of options until I discovered it. The solution is the -fixed-vo argument. The best you could do without it, is something like:

In a fresh X instance (without a desktop environment):

xsetroot -solid black

mplayer -fs -rootwin -playlist some.m3u

This almost works. It only leaves a single black frame between videos. You can even restart MPlayer (to avoid a long running MPlayer process) between videos and the black frame is still hardly noticeable.

Of course -fixed-vo looks even better, as there is absolutely no flicker between the videos, and it works great with or without a desktop environment. That’s any desktop environment. The disadvantage, of course, is that at this point I’m not sure how a few weeks old Mplayer process that has played thousands of short videos will behave. Let’s hope MPlayer/XOrg can handle this…

P.S.

Here’s how my app invokes mplayer: it opens a pipe to the following command:

/usr/bin/mplayer -fs -fixed-vo -slave -idle -nolirc -msgmodule -msglevel demuxer=9:statusline=0

you can then write to the stdin of the pipe commands like: loadfile ‘/path/file.avi’

you can watch the pipe’s stdout for a message like “DEMUXER: ds_fill_buffer: EOF reached (stream: video)”

Now you know when the file you began to play finished.

Beyond fossil fuels

Wednesday, January 7th, 2009

Like it or not, a large part of the EU is now off natural gas. I don’t mean to bitch too much but both my home and office heating is out. I’m cold. I’m glad for my reduced carbon footprint :-|

Personally, I’m off gasoline too. Or at least temporarily I am. If only everyone else was like that too. And permanently. And get rid of coal too. Now that would be the day…