Page 1 of 6

Streaming Video in JWPlayer with Subsonic 3.8 (with FFMpeg)

PostPosted: Mon Dec 28, 2009 11:43 am
by Mohican
I finally managed to get this working after trawling the forum for hours!!
Along the way I made some improvements of my own that cured strange bugs, so the resulting product works real nice and smooth. 8)

I thought you guys would like to see this all laid out in a single thread... (and it is usefull to me as a memo :wink:)
Here we go:

(1) Install Subsonic 3.8 to "c:\subsonic\" (it's all lower case)

(2) Open "C:\subsonic\jetty\1130\webapp\WEB-INF\jsp\playlist.jsp" with notepad

(3) Search for string ".swf", and replace:

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


with

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


(4) Search for string "function skip", and replace:

Code: Select all
        list[0] = {
            duration:song.duration,
            file:song.streamUrl,
            title:song.title,
            type:"sound"
        };

        player.sendEvent("LOAD", list);
        player.sendEvent("PLAY");


with

Code: Select all
        list[0] = {
            duration:song.duration,
            file:song.streamUrl,
            title:song.title,
            type:"sound"
        };

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

        player.sendEvent("LOAD", list);
        player.sendEvent("PLAY");


(5) Download FFMpeg Here, and unpack all files to "c:\subsonic\transcode\"

(6) Open Firefox or Internet Explorer (or whatever else) on your PC running subsonic, open "http://localhost" and login.

(7) Go to settings > general, and enter this in "Music Mask":
Code: Select all
.mp3 .ogg .aac .flac .m4a .wav .wma .mpg .mpeg .avi .mkv .ogm .mp4


[8] Go to settings > transcoding, and add new transcoders one at a time.
Code: Select all
Example:
mpg > flv  |  mpg  |  flv  |  ffmpeg -i %s -f flv -y -s 384x240 -ar 44100 -b 192kb -ab 32kb -ac 1 -


Notes:
- I removed parameter "-re", so videos get converted super fast and sent straight away (no waiting for stream to start!!)
- s 384x240 is resolution of video
- ar 44100 is audio frequency
- b 192kb is target bitrate
- ab 32kb is target audio bitrate
- ac 1 is number of channels (1=mono, 2=stereo)
I use these values because my broadband connection's upload is crap (256kb). If you wanna stream on a better connection like a LAN, pump up all those params. :twisted:

(9) Go to Settings > Players, and make sure your default player is set to "Web Player", and that all your new transcoders are checked in (scroll down to bottom of page).

(10) Now go to Settings > Music Folders, and add your folders containing videos.

(11) 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...".

Et Voila!!! Enjoy my friends!!!

Please lemme know if you successfully used this tutorial.


Image
Image

Some Comments

PostPosted: Mon Dec 28, 2009 11:52 am
by Mohican
Some know issues, from the top of my head:
- FFmpeg is unable to auto-detect the aspect-ratio and crop or add black borders... If your videos come in various ratios (4:3, 16:9), they will be distorted. That is the reason why I chose a ratio of 1.6 above (it is halfway between 4:3 & 16:9).
- FFmpeg cannot hard-code subtitles embedded into OGM or MKV files (ex: japanese animes).
- FFmpeg cannot be told which audio stream to use (again, OGM or MKV anime files with Dual-Audio). It uses the first one available.

For these various reasons, I will experiment with "mencoder" and let you know if I can solve the issues of FFmpeg with it.

:P

Image
Image

PostPosted: Mon Dec 28, 2009 11:53 am
by Mohican
P.S to Admins: Please sticky this thread :wink:


Image
Image

PostPosted: Tue Dec 29, 2009 1:06 pm
by possebon
Mohican,

I tried this and worked fine.

I have only one issue now: After I updated and changed the JSP files, the player on subsonic does not advance (skip) to the next item.

I already put back the old files, remove the settings, without sucess.

Tried even with different browsers.

Any clue what can be wrong?

PostPosted: Wed Dec 30, 2009 8:11 am
by Mohican
possebon wrote:Mohican,
I have only one issue now: After I updated and changed the JSP files, the player on subsonic does not advance (skip) to the next item.


I realised I have this issue too.
I modified the tutorial, please re-read it.

PostPosted: Wed Dec 30, 2009 1:02 pm
by possebon
Basically,

What you changed on tutorial is to do not change the JWPlayer version, Am I right?

PostPosted: Thu Jan 07, 2010 1:56 am
by deejay2302
Does not Work. I have correctly read the Tutorial!

The problem is i dont see a Web Player, and i hear only short sound and it stops. Then is see stream loading and Firefox crashed.

I have test with AVI Videos.
*Edit* Tested with wmv,mpg. Same Failure!

Tested with Internal Flash Player and with external Player(VLC Player).VLC Player play a second and stops.

What i doing false ?

I have DSL 16000 and 1024 Kbits Uploadspeed. So i mean thats not my connection.

Please Help! :(

PostPosted: Thu Jan 07, 2010 3:31 am
by Mohican
Have u got all necessary Codecs for FFmpeg installed on your PC?
I recommend to install the "K-Lite Mega Codec Pack", it contains almost every Codecs known to man.

PostPosted: Thu Jan 07, 2010 5:07 pm
by deejay2302
I have installed the codec Pack from u here.

Is that a problem with codec format?

When Avi files I would understand that there are potential problems. As there are indeed several codec types. But in MPG?

These codec packs like K-Lite I do not like the fact that I already had several system crashes. Are there still updates from FFMPEG? On the side of it I only found updates for Linux.

PostPosted: Thu Jan 07, 2010 8:06 pm
by fermunky
I did this and only added avi as it turns out I do not have any MPG files, and it plays fine. I was wondering why I didn't have the ability to scroll through the vid though?

In the process of adding the rest of the transcoders. Thanks!

Excellent!

PostPosted: Sun Jan 17, 2010 4:41 pm
by Enzomatrx
This is awesome thank you so much!

I used this guide and applied it to a FreeNAS box that has Subsonic installed.

My videos are transcoding over the web into the flash player perfectly now!

My next task is to modify the main page layouts for subsonic to put the player in a column on the right (or make a pop-out link somehow), because going in Full-Screen isn't always beneficial if I want to view videos while also working in another window.

Thanks!

Transcoding Syntax

PostPosted: Mon Jan 25, 2010 4:07 am
by onewalrus
Have mercy on an inept user here. I have followed this tutorial, but am pretty sure I don't understand the part about "enter transcoders one at a time'. I don't know which attributes to enter into the "new transcoder" window. Are there three transcoder steps in the example used? If so, what goes into each step? My player comes up, but plays nothing, I'm certain because of my stupidity on the transcoder configuration.

Please have mercy on me with an explanation written for a first-grader!

Thanks,
Paul

A gracious tip o' the hat to Mohican for the most excellent graphical answer in prompt response to my puzzled query!

PostPosted: Mon Jan 25, 2010 9:09 am
by Mohican
Screenshot of what it should look like:

Image

Transcoding solved but... ?

PostPosted: Mon Jan 25, 2010 6:04 pm
by onewalrus
A gracious tip o' the hat to Mohican for the most excellent graphical answer in prompt response to my puzzled query!


SOLUTION?
: The below worked for three tests of transcoding avi file, then stopped working. Upon restarting the Subsonic server, I now receive the message "get flash player" where the player was before. I have installed flash-10 three times and it will not stick.


This transcoding line did not work:
ffmpeg -i %s -f flv -y
I had to change it to this:
ffmpeg -re -y -i %s -ar 44100 -f flv -



Paul/Pablo/Onewalrus

skipping forward on player

PostPosted: Tue Jan 26, 2010 2:43 pm
by LeTsRiPiT
I think that I have all parts of this inplace but I am unable to skip forward during the playing of a video is there a work around on this?
________