Skip to content

Fusion Network

Jinzora FlashPlayer/FFMPEG Intergration (CentOS 5x)

Image

What is it?

Jinzora is a system for streaming media content (Audio/Video) threw a nice interactive web interface. You can find info about this excellent project here: http://en.jinzora.com/

This tutorial gives one method for adding a fully embedded flash player into Jinzora. This is not yet a standard feature for Jinzora and you may break things by adding this in. So you have been warned! Proceed on at your own risk (however, if you post in the forums or PM me on the jinzora forums im happy to help if you have problems... Username: eureka)


How?

 

We will be using the ffmpeg project to convert your media files to a .flv which will then be send over the wire via flashplayer. This is done on-the-fly and will NOT save the resulting .flv file. Below are some pros and cons of this method.

PROs:

  • You only have to have one copy of each file.
  • You do NOT have to re-encode your files to .flv This is done for you on-the-fly (Keep your files as avi/mp3..etc)
  • Your media will play on anything that has a working flash player installed (7/9/10 i believe are working versions)

CONs:

  • This dosnt yet work perfectally in linux. Its getting better but its not perfect. i.e. the fullscreen mode is clunky and not entirely functional. Some people have problems with the flashplayer not showing up but still playing sound..etc
  • You have to have a good(ish) system to do this with multiple streams at the same time.
  • If you get ahead of the streaming media the flash player will think its the end of the video/song and restart the trans code/streaming process (can cause headakes). My temp fix for this is to pause your videos for up to 3 minutes before allowing them to play (depending on the speed of your server/connection).

Suggested specs?

This is something im not very sure about, I will list the specs of my server below so you have something to compare to. However, my server also functions as a multi-site webserver, email server, game server, voice server..... Needless to say, its got some horse power

CPU: Dual AMD Opteron 248 (2.0 Ghz/ea) RAM: 2GB ecc (i suggest more than this) HDD: 1.1 TB in Raid5 OS: CentOs 5.1 (Linux!)

Credit where its due.

To be fair i did not write this on my own or even come up with the idea. This is an update to the original article posted by Thor on the jinzorahelp forums. I have simply updated it with what it took to make it work with my server, ive also compiled all of the fixes in the origional thread in hopes to make this a one-stop-fix doc for this mod. You can see the original post/thread here:

http://en.jinzorahelp.com/forums/viewtopic.php?f=18&t=5588

Lets get started!

First you need to have ffmpeg installed on your system. This can be done with the below commands. *note that they must be ran as root or sudo. Also, i am asuming you are on a Redhat/CentOS/Fedora based system. For doing this on a Debian base replace yum with apt-get. Or your favorate package manager. For convinence i have tried to list the commands needed for both CentOS/RedHat and Ubuntu/Debian

Redhat/CentOS:

  yum install ffmpeg

 Ubuntu:

  sudo apt-get install ffmpeg

Once you have ffmpeg installed we need to create a directory to start our work in and to download some files.

Mkdir /home/username/jinzora_ffmpeg Cd /home/username/jinzora_ffmpeg wget http://www.roguesaints.net/tutorials/jinzora/flvplayer.tgz

Extract this file to /jinzroa2_installdir/services/services/players. Make sure that the /flvplayer/temp folder is chmoded to 0777

chmod 0777 /jinzora2_installdir/services/services/players/flvplayer/temp wget http://www.roguesaints.net/tutorials/jinzora/ufo.js

Make sure that ufo.js is in the same folder as flvplayer.php or else things aren’t going to work too well.

Locate the pid.php file in the flvplayer dir (/jinzora_installdir/services/players/ffmpeg/pid.php) and change where it says wwwrun to the User that apache runs as (On redhat/cent this is apache, on debian/ubuntu this is www-data).

Next we have to change our videotable.tpl. Download this one…

wget www.roguesaints.net/tutorials/jinzora/videotable.tpl

Make a backup of your old file incase it breaks something…

cp /jinzora_installdir/templates/slick/videotable.tpl /jinzora_installdir/templates/slick/videotable.tpl_bak

Now you can copy over the old one.

cp videotable.tpl /jinzora_installdir/templates/slick/ Overwrite? Y

Now that you have these files we can move on to the next step.

We need to edit your settings.php file to enable the flvplayer. Locate the file settings.php in your Jinzora2 installation.

Mine is located here /var/www/html/jinzora2/settings.php

 

Look for this line.

{geshi head="In file /$jinzora_dir/settings.php"}$embedded_player Change it to this. $embedded_player = "flvplayer";{/geshi}

Now we are going to edit blocks.php. This should be located in this directory.

/Jinzora2_installdir/frontend/frontends/slick/

 

Locate this line…

{geshi head="In File blocks.php"}$tArr[$i]['playlink'] = $display->playlink($child, "High", false, false, true,false,false,false); You can replace it with these lines. $tArr[$i]['playlink_high'] = $display->playlink($child, "High", false, false, true,false,false,false,"high"); $tArr[$i]['playlink_medium'] = $display->playlink($child, "Medium", false, false,true,false,false,false,"medium"); $tArr[$i]['playlink_mobile'] = $display->playlink($child, "Mobile", false, false, true,false,false,false,"mobile");{/geshi}

 

We need to make the different display levels work now (Thanks to nmacy).

Make a backup of the display.php file.

{geshi head="Backup display.php"}cp /jinzora_installdir/frontend/display.php /jinzora_installdir/frontend/display.php_bak{/geshi}

 

Open up the file display.php located in /jinzora_installdir/frontend/display.php and look for the following line.

{geshi head="In file display.php"}function playLink($node, $text = false, $title = false, $class = false, $return = false, $random = false, $linkOnly = false, $clips = false) Change it to this. function playLink($node, $text = false, $title = false, $class = false, $return = false, $random = false, $linkOnly = false, $clips = false, $quality="mobile") Now find this line. $linkText = '<a href="' .urlize($arr).'"'; Replace it with this line. $linkText = '<a href="' . urlize($arr).'&flvquality='.$quality.'"';{/geshi}

 

For most people this should be all you have to do. However on centos ffmpeg is located in a different place than what the flvplayer stream.php file has listed. I had to do this to fix the problem.

{geshi head="Type this in cmd line."}which ffmpeg {/geshi}

This will tell you where ffmpeg is located on your system. (Mine is located in /usr/local/bin/ffmpeg).

Edit your stream.php in your flvplayer dir.

Open /jinzora_installdir/services/services/players/flvplayer/stream.php

{geshi head="In File stream.php"}Look for this line. passthru('/usr/bin/ffmpeg -re -y -ss '.$pos.' -i "'.$file.'" -ar 44100 -async 1 '.$q.' -f flv - &'); Change this to. passthru('/usr/local/bin/ffmpeg -re -y -ss '.$pos.' -i "'.$file.'" -ar 44100 -async 1 '.$q.' -f flv - &');{/geshi}

 

That’s it! You shouldn’t have to restart your apache or anything like that. Now when you go to your jinzora install and click on the name of a video/song you will get a list of “High, Medium, Low, and Download” for your selections. Clicking on one of the first three will popup a new window with the flash player in it along with your media!

 

Hope this worked for you, If you have problems post a comment or a reply on this forum.

http://en.jinzorahelp.com/forums/viewtopic.php?f=18&t=5588

You cant PM me on the forums any time you would like, My username is Eureka, I am a working man ;) so it may take a while till you hear from me but i try to answer all email within 1/2 days.

 

-Eureka