Play .rar files with mplayer v2.0: now with seeking

It really started bothering me that its impossible to seek in media files when using my previous playrar script:

Now im writing a bit more complex version which supports seeking!

I got a tips about using rarfs, a FUSE based filesystem mounter. What it does is making your .rar archives into a virtual filesystem. (like the .rar archive really isnt a archive, but real files on a filesystem)
This makes your media files seekable. (mkv,avi,iso(vob), younameit)

Firstly you need to install rarfs on your system. You need to install some deps:
sudo apt-get install automake1.9 libfuse-dev subversion
When you have done this, you are ready to checkout the svn tree on sourceforge:
svn co https://rarfs.svn.sourceforge.net/svnroot/rarfs rarfs
cd rarfs/trunk/rarfs/
./configure && make && sudo make install

(seems here i got a error with doc/Makefile.in, borked release in trunk)
FIX: touch doc/Makefile.in
./configure
make
sudo make install
ls -l /usr/local/bin/rarfs

If it returned your file in /usr/local/bin/rarfs we are good to go!

Now we can mount a .rar file with the following command: rarfs bladdiblah.rar /tmp/rar
This seems a bit hard to type everytime you want to play a file, so we make a shellscript to fix this:
#!/bin/bash
RARFILE=$1
TMPDIR="/tmp/playrar/"
RARFS="/usr/local/bin/rarfs"
if [ ! -d /tmp/playrar ]; then
mkdir -p /tmp/playrar
fi
$RARFS $RARFILE $TMPDIR
mplayer -fs $TMPDIR/`ls $TMPDIR`
fusermount -u $TMPDIR

What this script does, is to mount the file, play the files inside the rar file, and then unmount the .rar archive.
You can easily wget this script: playrar.sh
Place it in $PATH and give it chmod +x playrar.sh (and change your media player as suited)

This howto was intended to Ubuntu users, but should be done on other linux distributions as well (maybe OS X as well?)

One step closer to easier movie playback :-)

Tags: , , ,

Play .rar files with vlc / mplayer

UPDATE: Ive made a more complex version of this post with seeking:
http://dingleberry.me/2009/08/play-rar-files-with-mplayer-v2-0-now-with-seeking/

Are you tired of having to unpack *.rar archives to watch them?
There is a solution for us linux users.

Firstly you should install unrar.

On a debian or derivate:
apt-get install unrar

Then you should make a shell wrapper, e.x.: /usr/local/bin/playrar

Make it look like something like this: (change mplayer to your preferrable videoplayer)

unrar p -inul $1 | mplayer -

And do a:
chmod +x /usr/local/bin/playrar

Now you can do a:
playrar blablabla.rar

And your video will be shown without unpacking it.
The only catch is that you can’t seek in the video if its multipart-rar archive.

Tags: , , ,