Page 1 of 1

Playing video from RAR files

PostPosted: Tue Jul 03, 2012 12:37 pm
by Zmegolaz
HI,

I posted in the Feature Requests subforum how to play video from RAR files, and though this might be a good place to put it too.
This guide is for Linux, but can probably be converted to any other OS.

Install unrar
Install ffmpeg
Make symbolic links to these in the Subsonic transcode folder.
Log in to the Subsonic interface as an admin.
Add a new transcoding in Settings -> Transcoding -> Add transcoding.
Convert from: rar
Convert to: flv
Step one:
Code: Select all
unrar p -inul %s

Step two:
Code: Select all
ffmpeg -ss %o -i pipe:0 -async 1 -b %bk -ar 44100 -ac 2 -v 0 -f flv -vcodec libx264 -preset superfast -threads 0 -

Go to Settings -> General and add " rar" to Video files to make it recognize the .rar files.

You might want to add " -s %wx%h" in step two (before the last dash (-)) if you're using a mobile device, to lower the resolution. This seems to screw up the aspect ratio, but that's another thread's problem. I have set it to " -s 640x360", since most of my videos are 16:9.

This extracts the rar archive, outputs the content to stdout, pipes it to ffmpeg which transcodes it and output the finished video to the player.
It will probably work with compressed archives too, I haven't tried.
There are som drawbacks while skipping in the video. As soon as you start playing, the server starts transcoding, and don't stop until everything is done. As long as you don't jump further than the transcoding has gotten, it works.
You can use Subsonic's drop down menu to skip, but this takes some time, and I suspect it transcodes everything from the beginning up to that point.

Happy videoing!