Video to Flash Converter

"

YouTube-like Video in Jinzora!

Thanks to Thor83

"

This is a project which I feel I have adopted. It was originally posted by Thor83 in a forum topic called 'A fully embedded Player for Jinzora2 using ffmpeg'.

Without Thor83 it is unlikely that this project would be around today. I have taken what he has done and created a number of fixes and workarounds for known issues that I encountered while following his instructions. I wanted to give back to the community which has given so much to me, so I have taken it on myself to attempt to maintain a functioning set of instructions/files for this project.

This OpenDevelopment extension utilizes FFmpeg to transcode virtually any video format to a .flv-file. The transcoded .flv-file can be streamed through
Jeroen Weijering's FLV Media Player.

FFmpeg will convert almost anything into a .flv-file (if it doesn't have more than two audio channels that is) on-the-fly and in real-time. Your video files do not have to be pre-converted, no additional copies are stored and the original file stays untouched.

Features


  • By using this embedded player no player has to be installed on the client.
  • All the end-user needs is a web browser with support for Adobe Flash 9+.
  • The JW FLV Media Player supports both audio and video.
  • FFmpeg converts almost all video formats to .flv.
  • The JW FLV Media Player supports play lists.
  • Quality selection for streaming over slower/faster connections.
  • Video launches in a pop-up window.

Installation


Requirements

Tested on:

  • Windows XP
  • Fedora 9
  • Ubuntu 7.04 & 7.10 & 8.04
  • MacOS 10.4+

Instructions

First you need to have ffmpeg installed on your system. This can be done with the below commands. *note: These commands 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

(CentOS/Redhat/Fedora)

 

yum install ffmpeg

(Ubuntu/Debian)

 

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.

tar -xvszf flvplayer.tgz

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 shure 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/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).

vim /jinzora_installdir/services/services/players/ffmpeg/pid.php

(CentOS/Redhat/Fedora)

locate: $processes=shell_exec('ps -U wwwrun -u wwwrun -o comm,pid');
Replace with: $processes=shell_exec('ps -U apache -u apache -o comm,pid');

(Ubuntu/Debian)

locate: $processes=shell_exec('ps -U wwwrun -u wwwrun -o comm,pid');
Replace with: $processes=shell_exec('ps -U www-data -u www-data -o comm,pid');

 

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.

 

$embedded_player Change it to this. $embedded_player = "flvplayer";

 

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

 

/Jinzora2_installdir/frontend/frontends/slick/

 

 

 

Locate this line…

$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");

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

 

Make a backup of the display.php file.

cp /jinzora_installdir/frontend/display.php /jinzora_installdir/frontend/display.php_bak

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

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.'"';

 

 

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.

 

Find out here ffmpeg really is: which ffmpeg

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

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 - &');

POSSIBLE FIX FOR AUDIO PROBLEMS (Related to AC-3 or Other Audio CODEC):

Open: stream.php

Locate: passthru('/usr/local/bin/ffmpeg -re -y -ss '.$pos.' -i "'.$file.'" -ar 44100 -async 1 '.$q.' -f flv - &');

Replace with: passthru('/usr/local/bin/ffmpeg -re -y -ss '.$pos.' -i "'.$file.'" -ar 44100 -ac 2 -async 1 '.$q.' -f flv - &');

 

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.

Known Issues/Feature Requests


  • Sometimes the stream will get ahead of the FFmpeg encoding and will reset the player to the beginning. This in-turn appears to kill, then restart the FFmpeg encoding. (The player restarts buffering the file over and over in an endless loop).
  • Somewhat slow full screen video performance on Linux (Possibly a flash issue). [EDIT] Looks like this is a flash issue so not much i can do here. They did just release a new version... I suggest updating if you are on linux! [\EDIT]

Author Bio


I'm interested in computers and hardware/software modding. I am a Linux System Administrator by trade and for fun, spending most of my time on the computer.

I like extreme sports and enjoy playing paintball. Online, my kicks are strategy games and first person shooters (Call of Duty 4).



Releases