Setup Subsonic on Ubuntu to Stream / Access Your Video Collection

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading ... Loading ...

Subsonic is a wonderful cross platform music streaming software. With a little bit of hacking it can incarnate to its video streaming avatar with on the fly video encoding and streaming capability, allowing you to remotely access and view your video collection.  I have discussed this for Windows machine using Subsonic 3.8 here. A couple of things have changed, so lets go over all the steps involved for Ubuntu using Subsonic 4.1 (latest version on the day of this post).

Step 1: Installation

Steps for installation is reproduced from the Subsonic.org website with some hacks to allow video encoding

First,  we install Java:

sudo apt-get install openjdk-6-jre

Then download the Subsonic .deb package and install it by doing:

sudo dpkg -i subsonic-x.x.deb

Notice that the installer configures your system to start Subsonic automatically when booting. After installing, open the Subsonic web page on http://localhost:4040.

Transcoders

To make use of Subsonic’s powerful transcoding feature, it’s highly recommended to install some third-party transcoders:

sudo apt-get install lame flac faad vorbis-tools ffmpeg

For the video encoding to work for all formats I would recommend that you do not install ffmpeg in the step above, instead install ffmpeg with support for various restricted codecs as described here.

Advanced configuration

To change the port number, Java memory settings or other startup parameters, edit the SUBSONIC_ARGS variable in /etc/default/subsonic.

To restart Subsonic, do

sudo service subsonic restart

Step 2: Enable Video

Once you have the basic subsonic setup and working, you can proceed with the steps involved in enabling the video streaming capability.

Open the file /var/subsonic/jetty/1806/webapp/WEB-INF/jsp/playlist.jsp using your preferred text editor, say gedit

sudo gedit /var/subsonic/jetty/1806/webapp/WEB-INF/jsp/playlist.jsp

And find the following line in it

swfobject.embedSWF("<c:url value="/flash/jw-player-5.0.swf"/>", "placeholder", "340", "24", "9.0.0", false, flashvars, params, attributes);

Replace “24″ with “30″ (this determines the height of the video player and we would change this to a larger number say 255 to have video play in small window, as mentioned later).

swfobject.embedSWF("<c:url value="/flash/jw-player-5.0.swf"/>",  "placeholder", "340", "30", "9.0.0", false, flashvars, params,  attributes);

Save the file (you have to be root to edit this file).

Next, in the same file go to the function skip(index) and find the following code

if (song.format == "aac" || song.format == "m4a") {
list[0].provider = "video";
}

and replace it with the following

if (song.format == "aac" || song.format == "m4a" || song.format == "mp4" || song.format == "mkv" || song.format == "avi" || song.format == "mpeg" || song.format == "mpg" || song.format == "flv") {
list[0].provider = "video";
}

Now open your browser and login to your subsonic server by pointing your browser to http://localhost:4040 (http://locahost:portno if you changed the port for subsonic)

Go to Settings > General, and replace the content of “Music Mask” with this:

.mp3 .ogg .aac .flac .m4a .wav .wma .mpg .mpeg .avi .mkv .ogm .mp4 .flv

Now go to Settings > Transcoding, and add new transcoders one at a time, corresponding to .mpg, .avi, .mkv, .mp4, and .mpeg. Example for avi to flv is given below (entry for each box is separated by |):

avi > flv  |  mpg  |  flv  | ffmpeg -re -y -i %s -ar 44100 -sameq -deinterlace -f flv -

This setting would yield the best video quality over a LAN and should work for high speed connections, if you want to stream video over not so fast internet connection, then you might want to tweak it a bit. You don’t need to setup transcoding for flv files as they get played by default by the embedded player in Subsonic. Once you are done setting up transoding option for all video format, your Settings > Transcoding page should look like this

Now go to Settings > Players, and make sure your default player for your chosen current player is set to “Web Player”, and that all your new transcoders are enabled as shown below (scroll down to bottom of page to ensure this).

Its the time to add videos. Go to Settings > Music Folders, and add folder (s) containing videos.

Use the browsing system, and try to play a video with the default Player. After a few seconds the sound should start playing. Right Click on the JWPlayer, and select “Toggle Fullscreen” to start video in full screen mode.

If you want to be able to watch videos in windowed setting, try this additional hack.

To play the video in windowed mode, once again open /var/subsonic/jetty/1806/webapp/WEB-INF/jsp/playlist.jsp and replace the number “25″ from above to “255″, and then open /var/subsonic/jetty/1806/webapp/WEB-INF/jsp/index.jsp. Change

<frameset rows="70%,30%" border="0" framespacing="0" frameborder="0">

to

<frameset rows="40%,60%" border="0" framespacing="0" frameborder="0">

Beware, this would hide the playlist for the web player. That is all, now you should be able to stream video using Subsonic setup in Ubuntu 10.04.

Note: Seeking works for pre-converted flv files as well as most avi files (after a while), unfortunately there isn’t a fix known for displaying the progress bar for the progress of video encoding (you can skip to places within already encoded video portions). If you know of a working fix, please do share with us.

If you found this useful, please consider leaving a comment or liking us on Facebook or following us on Twitter or subscribing to the RSS feed to have future articles delivered to your feed reader.

You might also like

Cross Platform Music and Video Streaming with Subsonic Update: See...
Subtunes: Itunes like UI for subsonic music player If you like...
How to Install or Remove DEB Packages Using dpkg (Ubuntu / Debian) This post explains...
Simple Streaming Music Server Using Apache musicindex While there...

About the Author

has written 1321 posts on this blog.

Meditating towards his "nerdvana", lifehacker is a teacher by the day and a nerdy blogger by the night. He lives to learn and yearns to learn living.

One Comment on “Setup Subsonic on Ubuntu to Stream / Access Your Video Collection”

Trackbacks

  1. Cross Platform Music and Video Streaming with Subsonic | Hack Your Life!

Write a Comment

Gravatars are small images that can show your personality. You can get your gravatar for free today!

*

Copyright © 2013 Hack Your Life!. All rights reserved.
Proudly powered by WordPress. Developed by Deluxe Themes