Streaming Video in JWPlayer with Subsonic 3.8 (with FFMpeg)

Tutorials, tips and tricks.

Moderator: moderators

How useful was this Tutorial:

Mohican is God!
13
57%
Mohican is Satan!
3
13%
I don't believe in either...
7
30%
 
Total votes : 23

Streaming Video in JWPlayer with Subsonic 3.8 (with FFMpeg)

Postby Mohican » Mon Dec 28, 2009 11:43 am

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
Last edited by Mohican on Wed Dec 30, 2009 8:10 am, edited 5 times in total.
User avatar
Mohican
 
Posts: 8
Joined: Mon Dec 28, 2009 11:04 am
Location: Wales, UK

Some Comments

Postby Mohican » Mon Dec 28, 2009 11:52 am

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
Last edited by Mohican on Mon Dec 28, 2009 12:11 pm, edited 2 times in total.
User avatar
Mohican
 
Posts: 8
Joined: Mon Dec 28, 2009 11:04 am
Location: Wales, UK

Postby Mohican » Mon Dec 28, 2009 11:53 am

P.S to Admins: Please sticky this thread :wink:


Image
Image
User avatar
Mohican
 
Posts: 8
Joined: Mon Dec 28, 2009 11:04 am
Location: Wales, UK

Postby possebon » Tue Dec 29, 2009 1:06 pm

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?
possebon
 
Posts: 10
Joined: Wed Oct 21, 2009 11:41 pm

Postby Mohican » Wed Dec 30, 2009 8:11 am

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.
Image
Image
User avatar
Mohican
 
Posts: 8
Joined: Mon Dec 28, 2009 11:04 am
Location: Wales, UK

Postby possebon » Wed Dec 30, 2009 1:02 pm

Basically,

What you changed on tutorial is to do not change the JWPlayer version, Am I right?
possebon
 
Posts: 10
Joined: Wed Oct 21, 2009 11:41 pm

Postby deejay2302 » Thu Jan 07, 2010 1:56 am

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! :(
21.681 Artists
58.141 Albums
674.091 Songs
5072,14 GB (~ 49.341 Hours)
User avatar
deejay2302
 
Posts: 163
Joined: Tue Oct 06, 2009 5:36 pm
Location: Germany

Postby Mohican » Thu Jan 07, 2010 3:31 am

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.
Image
Image
User avatar
Mohican
 
Posts: 8
Joined: Mon Dec 28, 2009 11:04 am
Location: Wales, UK

Postby deejay2302 » Thu Jan 07, 2010 5:07 pm

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.
21.681 Artists
58.141 Albums
674.091 Songs
5072,14 GB (~ 49.341 Hours)
User avatar
deejay2302
 
Posts: 163
Joined: Tue Oct 06, 2009 5:36 pm
Location: Germany

Postby fermunky » Thu Jan 07, 2010 8:06 pm

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!
fermunky
 
Posts: 16
Joined: Wed Oct 28, 2009 2:28 pm

Excellent!

Postby Enzomatrx » Sun Jan 17, 2010 4:41 pm

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!
Enzomatrx
 
Posts: 4
Joined: Sun Jan 17, 2010 4:38 pm

Transcoding Syntax

Postby onewalrus » Mon Jan 25, 2010 4:07 am

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!
Last edited by onewalrus on Mon Jan 25, 2010 4:19 pm, edited 1 time in total.
Pablo
User avatar
onewalrus
 
Posts: 22
Joined: Tue Feb 26, 2008 3:46 am
Location: Colorado Springs, Colorado USA

Postby Mohican » Mon Jan 25, 2010 9:09 am

Screenshot of what it should look like:

Image
Image
Image
User avatar
Mohican
 
Posts: 8
Joined: Mon Dec 28, 2009 11:04 am
Location: Wales, UK

Transcoding solved but... ?

Postby onewalrus » Mon Jan 25, 2010 6:04 pm

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
Last edited by onewalrus on Tue Jan 26, 2010 10:30 pm, edited 1 time in total.
Pablo
User avatar
onewalrus
 
Posts: 22
Joined: Tue Feb 26, 2008 3:46 am
Location: Colorado Springs, Colorado USA

skipping forward on player

Postby LeTsRiPiT » Tue Jan 26, 2010 2:43 pm

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?
________
Last edited by LeTsRiPiT on Tue Feb 08, 2011 9:56 pm, edited 1 time in total.
LeTsRiPiT
 
Posts: 21
Joined: Fri Jul 24, 2009 10:16 pm

Next

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 0 guests