Webcam Recording On Kaltura CE4 Using Red5

by Roni Cohen

This post assumes you have a working Kaltura CE 4.0 server. To easily install CE4 check out “How to setup Kaltura CE 4.0 VMWare image in 15 minutes“.

Welcome to the second video tutorial in our video posts series on installing and using Kaltura CE 4.0.

In this post, we show how to use a webcam to capture video using the Kaltura Contribution Wizard in CE 4 and the open source Red5 media server. As always we try to keep the knowledge and steps as general as we can so the guide will fit any Kaltura installation (VMWare, Cloud, Install, On Prem, etc.).

Note, that different Linux distributions (Debian or Fedora) behave differently and often use different commands. While the below installation steps are the same, the specific commands may vary between distros (for example, in CentOS we use yum to install packages, while in Ubuntu the command will most likely be apt-get).

This video tutorial will guide you through installation of the Red5server and its configuration in Kaltura CE 4.0 for enabling webcam recording.

Red5 Installation and Webcam Support

Part 1 – Installing Red5

Red5 is an open source Media Server capable of RTMP streaming and Flash webcam recording.  To install Red5 on CentOS follow the steps below:

Make sure that your hosts file is configured correctly. If you’re using the VMWare image;
vim /etc/hosts
Insert this line at the end: 127.0.0.1     kaltura
Restart Apache: service httpd restart

Install the Java SDK;
yum -y install java-1.6.0-openjdk java-1.6.0-openjdk-devel

Download and install the Red5 server:

wget trac.red5.org/downloads/0_9/red5-0.9.1.tar.gz
tar xvfz red5-0.9.1.tar.gz
mv red5-0.9.1 red5
mv red5 /usr/share/
cd /usr/share/red5

Test Red5 is executing:
sh red5.sh
Hit Ctrl+C when the “Installer Service Created” message is shown

Create an init script for Red5:
vi /etc/init.d/red5
And add to it the following file contents -
http://blog.kaltura.org/wp-content/uploads/2011/12/Red5-Init-script.txt

Enable executable permission & start the service:
chmod +x /etc/init.d/red5
/etc/init.d/red5 start

Check Red5 server status:
/etc/init.d/red5 status
If the screen shows: “red5 (pid XXXXX) is running…” – then we’re good to go!

To open the Red5 Ports (if necessary), run the following commands:

/sbin/iptables -I RH-Firewall-1-INPUT -p tcp -m tcp --dport 1935 -j ACCEPT
/sbin/iptables -I RH-Firewall-1-INPUT -p tcp -m tcp --dport 8088 -j ACCEPT
/sbin/iptables -I RH-Firewall-1-INPUT -p tcp -m tcp --dport 5080 -j ACCEPT
/sbin/iptables -I RH-Firewall-1-INPUT -p tcp -m tcp --dport 1936 -j ACCEPT
/sbin/service iptables save

To check that the ports are open, visit: http://www.yougetsignal.com/tools/open-ports/

Enter your server ip and in the port number: 5080, 1935, 8088, 1936
Click the “Check” button. If the flag is green, the port is open

Test the RED5 installation by opening following URL in browser

http://yourip:5080/

 

Part 2 – Configuration

Adding Webcam support -
Head to: http://yourip:5080/
Click on “Install a ready-made application”
Select “oflaDemo” and click on “install”

To verify the oflaDemo is running well, do the following:
Go to: http://your.server.com:5080/demos/ofla_demo.html
In the server address above the connect button enter:
rtmp://yourserver.com/oflaDemo
And click “connect” and watch the video play
If the video plays well – you’re good to go!

Configure Kaltura to use your brand new Red5:
cd /usr/share/red5/webapps/oflaDemo
mv streams streams_x
mkdir  /opt/kaltura/web/content/webcam

ln -s /opt/kaltura/web/content/webcam ./streams – adding webcam and streams save location

ln -s /opt/kaltura/web/content /usr/share/red5/webapps/oflaDemo/streams

Adjust the Kaltura Contribution Wizard uiConf file:

vi /opt/kaltura/web/content/uiconf/kaltura/samplekit/kcw_2.6.4/kcw_samplekit.xml
Add the RTMP URL of your site (search for “rtmp” in the file):
change to “<serverUrl>rtmp://yourip/oflaDemo</serverUrl>

Configure Kaltura to use your brand new Red5 -

To record using the webcam log in to KMC->content tab, upload sub tab and in KCW select webcam as the upload method.

 

Stay tuned for the next video of enabling RTMP delivery via Red5 and live streaming option. Please share any other use cases you wish to use on top of Red5 or other FMS This post was able to complete thank to these two great posts: Install Red5 on Centos, Install Red5 on Ubuntu *Note they might contain different steps, codes and problems than what we describe in this post. 

To enable live stream and RTMP using CE4 and Red5 read: RTMP VOD and Live Stream using Red5 

16 Responses to “Webcam Recording On Kaltura CE4 Using Red5”

  1. This works for KCW but not for krecord.
    When trying to connect using krecord, I’m getting:
    [code] => SERVICE_FORBIDDEN [desc] => The access to service [startsessionAction] is forbidden

    In CE3 the same code works.

    • Hi Inon,

      From the error you posted, it seems to be relate to the KRecord configuration and not to the Red5 installation.
      SERVICE_FORBIDDEN shows when the KS used doesn’t have the sufficient permissions to perform a specific API call.
      In the case of calling startsession, this may relate to a false partner id, server URL, admin or user secret…
      Do you have a publicly available link where we can see the KRecord you setup?

      • Hi Zohar,

        I’ve terminated the CE4 instance.
        I use the Krecord sample code, replacing my host name, partnerId, subPid, and admin key from Kaltura KMC.
        When I do that with CE3 it works, not not with CE4. Do I need to edit the user and allow this option? BTW, the webcam recording from KCW works fine.
        If you want, I can setup a CE4 instance.

      • Oh, I’ve tried both the admin and user keys.

  2. Try this –
    Go into the admin console, configure the the account (under actions), scroll to the bottom, check “Limited Access to legacy Services – PS2 API” and save.

  3. Hi,
    tried this on Kaltura 4 CE VMware provided on the kaltura.org website and cannot as I have a problem with yum (locked itself).
    Has anyone else had the issue and how did you fix it?
    Thanks,
    Fred

  4. I have solved my problem by following the instructions found here http://forums.fedoraforum.org/showthread.php?t=166816

    Thanks,
    Fred

  5. I have a few issues and I hope you can help me:
    - when I restart the server, the red5 service does not restart automatically. Not such a big deal for now as I can do it manually but would be nice to get it to work
    - I can no longer view the videos in the OflaDemo (i did before creating the symlinks). The connection is shown as ‘green’ and I seem to be connected, no videos show in the top left corner for me to select. Not sure whether that is the expected behaviour
    - I have setup exactly as stated in your post but the webcam recording doesn’t work (when I select my webcam on my Mac, the green light doesn’t show and I don’t get a video feed) – perhaps I need to do something in Kaltura?

    I use Kaltura mainly through the Moodle 2 plugins (I have the connection with that working fine e.g. videos can be uploaded and shown)

    Any help would be greatly appreciated.
    Thanks, Fred

  6. I ran into a problem when I was creating symlinks. Second symlink gave me File Exists error. However the problem was /opt/kaltura/web/content/webcam did not exist. I have created that path and symlinks worked fine. Just a heads up if anyone runs into the same problem.

  7. The webcam seems to upload but the video is all messed up. For example, I might upload a 15 second clip where I am moving around the screen, but it turns out to be a 1:20 minute clip and the first 45 seconds is still (like I’m stuck) and then sometimes the video just doesn’t record properly at all. So I can record via webcam… but I’ve tried several different webcams and computers and it is very, very buggy.

    I notice you guys keep saying “install FMS, Wowza, or Red5″ but doesn’t the oflaDemo only work with Red5? I have a copy of FMS installed… but I’m not sure how to use the “oflaDemo” which is a Red5 application (not Wowza or FMS).

  8. what is the preferred way to change the quality of the webcam recordings? Default, they look pretty bad.

    I tried the following:
    duplicate and assign the following to a partner
    KCW webcam for KMC UItemplate

    That works, but if I try to input any values for quality, keyFrameInterval, bandwidth, etc, then upon trying to use the webcam again, I get black screen with errors.

    Is there a more preferred way to increase the quality on a per partner basis?

  9. “To verify the oflaDemo is running well, do the following:
    Go to: http://your.server.com:5080/demos/ofla_demo.html
    In the server address above the connect button enter:
    rtmp://yourserver.com/oflaDemo
    And click “connect” and watch the video play
    If the video plays well – you’re good to go!”

    ** Please add the following after the section above. It is impotant or integration will not work!!

    Enable Red5 to follow soft links – fixes the “media not found issues”
    vim /usr/share/red5/conf/context.xml

    Add this inside the content object:

    Restart red5 server
    service red5 restart

  10. Trackbacks

Leave a Reply