Specify Max Video Bitrate

Got an idea? Missing something? Post your feature request here.

Moderator: moderators

Re: Specify Max Video Bitrate

Postby Drashna » Fri Aug 17, 2012 1:22 am

Drashna wrote:Found a dead simple way to change the default bitrate. Open the "videoplayer.jsp" file in "WEB-INF\jsp" and find this line:
Code: Select all
        var maxBitRate = ${model.maxBitRate};
Should be line 21. Now, create a new line *before* that one, making sure it still exists. Now add the following on that new line:
Code: Select all
        var maxBitRate = 300;
Change the 300 to whichever you want, just make sure it matches an entry in the drop down list. The end result here should look something like this:
Code: Select all
        var maxBitRate = 300;
        var maxBitRate = ${model.maxBitRate};
Works on for me.

Sorry. that' should be *after* the original line. Just note, that it won't display the correct value.
Drashna
 
Posts: 39
Joined: Fri Aug 05, 2011 9:20 pm

Re: Specify Max Video Bitrate

Postby m0ore4ustin391 » Fri Aug 17, 2012 3:38 am

Thanks Drashna for the PM. I took the time to re-write your directions to help these guys out.

Drashna's method (re-written)

1 - Open the "videoplayer.jsp" (Default C:\subsonic\jetty\2583\webapp\WEB-INF\jsp\videoplayer.jsp)
2 - Find the first line you come across that says "var maxBitRate"
3 - Directly below that add this line "var maxBitRate = 500;" without quotes. This will set the Max Bitrate for video streaming to 500kbps.
Your finished code should look something like this:

var player;
var position;
var maxBitRate = ${model.maxBitRate};
var maxBitRate = 500;
var timeOffset = ${model.timeOffset};


After you have changed the code make sure you restart subsonic, after you have restarted subsonic stream one of your videos and you will be able to see the quality difference. The video will no longer be in 1000kbps quality even though the drop down menu shows 1000kpbps. I know this is hard to understand but trust me it works. I also did the same method above to the "videoplayer.jsp" file in the "C:\subsonic\jetty\2583\webapp\WEB-INF\jsp\rest" folder. Not sure if this matters but I did it anyways and all my movies stream at 500kbps default (remember even though the drop down menu says 1000kbps it is actually streaming at 500kbps because we modified the code to do so).

Hope this helps you guys and I hope they add this feature to the backbone of the program so it will allow us to set the default and max video streaming bit rate in the settings GUI. Thanks again Drashna for helping me out!
m0ore4ustin391
 
Posts: 11
Joined: Tue Aug 14, 2012 10:05 pm

How to specify a different default video bitrate

Postby DasBoot » Mon Sep 03, 2012 1:58 pm

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').
DasBoot
 
Posts: 12
Joined: Sun Apr 04, 2010 10:52 pm

Previous

Return to Feature Requests

Who is online

Users browsing this forum: No registered users and 3 guests