Page 1 of 1

Change default video bitrate

PostPosted: Tue Sep 04, 2012 4:00 pm
by DasBoot
I posted some instructions on how to change the default video bitrate as a reply to a feature request. It later dawned upon me that this reply might actually be considered a mod so I'll just repost it here where it is more likely to be found. Given the popularity of that thread it seems I'm not the only one looking for this feature...

These instructions are based on a standard Debian Linux installation. If you use something else you might have to adjust some paths.

Setting the default video bitrate currently requires going in to the source, editing a single .java file, recompiling it and replacing it in the subsonic WAR archive. In short you'll want to get the source, edit net/sourceforge/subsonic/controller/VideoPlayerController.java and change the DEFAULT_BIT_RATE setting (I set it to 400). Once done you compile this single java file into a single .class file. To get the file to compile you need to feed javac a classpath which contains all it needs. In my case (where the source is located under /var/src):
Code: Select all
javac -classpath /var/subsonic/jetty/3060/webapp/WEB-INF/lib/\*:/var/subsonic/jetty/3060/webapp/WEB-INF/classes:/usr/share/subsonic/subsonic-booter-jar-with-dependencies.jar net/sourceforge/subsonic/controller/VideoPlayerController.java

Now replace the original VideoPlayerController.class file in /usr/share/subsonic/subsonic.war (WEB_INF/classes/net/sourceforge/subsonic/controller/VideoPlayerController.class with the newly compiled version:
Code: Select all
mkdir -p WEB-INF/classes/net/sourceforge/subsonic/controller/
cp net/sourceforge/subsonic/controller/VideoPlayerController.class WEB-INF/classes/net/sourceforge/subsonic/controller/
jar uf /usr/share/subsonic/subsonic.war WEB-INF/classes/net/sourceforge/subsonic/controller/VideoPlayerController.class

Restart subsonic. You now have a default video bitrate of whatever you set DEFAULT_BIT_RATE to, in my case 400.

I attached the modified VideoPlayerController.class (default bit rate is set to 400). This class file comes from the most recent beta (4.7b3), if you don't feel like going through all the motions AND if you trust me to not have included all sorts of nastyness in this class file you can try to use it. You'll have to do the replacement of the class in the WAR yourself, though... The .class file is packed in a ZIP file to circumvent this forum's braindead attachment filter ('The extension class is not allowed'). Unpack the zip into the path mentioned above (WEB-INF/classes/net/sourceforge/subsonic/controller/) and follow the instructions on how to replace the class file within the WAR.

Re: Change default video bitrate

PostPosted: Thu Sep 06, 2012 6:53 pm
by malefico
I try to compile in WindowsXP videoplayercontroller.java but and error occurs:
error: package javax.servlet.http does not exit
import javax.servlet.http.HttpServletRequest;

help please!!

Re: Change default video bitrate

PostPosted: Thu Sep 06, 2012 9:55 pm
by DasBoot
malefico wrote:I try to compile in WindowsXP videoplayercontroller.java but and error occurs:
error: package javax.servlet.http does not exit
import javax.servlet.http.HttpServletRequest;

help please!!


javax.servlet.http.HttpServletRequest is included in subsonic-booter-jar-with-dependencies.jar.

Your classpath should include all needed JARs. Have a look at the classpath I used (on Linux). I assume this jar can be found somewhere under the Subsonic installation directory in Windows (probably C:\Program Files\Subsonic) but since I don't have any Windows systems around here you better have a look for it. Include this jar in the classpath for the compiler, also include the Windows-equivalents of the other parts of the classpath I used.

Re: Change default video bitrate

PostPosted: Wed May 29, 2013 6:36 pm
by graememk
I have compiled the videocontroller.java for subsonic 4.8, only thing I have changed is the default bitrate to 400. :D

Follow the instructions in the first post to update

G

Re: Change default video bitrate

PostPosted: Sat Nov 30, 2013 4:06 am
by lolomm
Can u also add a version with default 3000?
thx a lot