Back

Webcam Recording On Kaltura CE4 Using Red5

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.

[kaltura-widget uiconfid=”6420041″ entryid=”1_z66r13ds” width=”551″ height=”330″ addpermission=”” editpermission=”” /]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 –
https://corpkalturacom.kinsta.cloud/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: https://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
https://yourip:5080/

Part 2 – Configuration

Adding Webcam support –
Head to: https://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: https://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 

Let's Get Going