Compiling the kaltura nginx with live rtmp

Hello,
I’m trying to add https://libraries.io/github/kaltura/nginx-rtmp-module to the exisisting kaltura-nginx vod module, is this possible ? as i’ve been trying and i keep getting an error when I do issue the make command and i get the following response:

In file included from /usr/include/x86_64-linux-gnu/sys/sysctl.h:23:0,
from src/os/unix/ngx_linux_config.h:54,
from src/core/ngx_config.h:26,
from /home/nginxlive/nginx-vod-module-master//ngx_child_http_request.c:1:
/home/nginxlive/nginx-vod-module-master//ngx_child_http_request.c:76:28: error: ‘ngx_http_headers_in_t’ has no member named ‘if_match’
{ ngx_string(“If-Match”), offsetof(ngx_http_headers_in_t, if_match) },
^
/home/nginxlive/nginx-vod-module-master//ngx_child_http_request.c:76:2: error: missing initializer for field ‘offset’ of ‘ngx_child_request_hide_header_t’ [-Werror=missing-field-initializers]
{ ngx_string(“If-Match”), offsetof(ngx_http_headers_in_t, if_match) },
^
/home/nginxlive/nginx-vod-module-master//ngx_child_http_request.c:41:8: note: ‘offset’ declared here
off_t offset;
^
In file included from /usr/include/x86_64-linux-gnu/sys/sysctl.h:23:0,
from src/os/unix/ngx_linux_config.h:54,
from src/core/ngx_config.h:26,
from /home/nginxlive/nginx-vod-module-master//ngx_child_http_request.c:1:
/home/nginxlive/nginx-vod-module-master//ngx_child_http_request.c:78:33: error: ‘ngx_http_headers_in_t’ has no member named ‘if_none_match’
{ ngx_string(“If-None-Match”), offsetof(ngx_http_headers_in_t, if_none_match) },
^
/home/nginxlive/nginx-vod-module-master//ngx_child_http_request.c:78:2: error: missing initializer for field ‘name’ of ‘ngx_child_request_hide_header_t’ [-Werror=missing-field-initializers]
{ ngx_string(“If-None-Match”), offsetof(ngx_http_headers_in_t, if_none_match) },
^
/home/nginxlive/nginx-vod-module-master//ngx_child_http_request.c:40:12: note: ‘name’ declared here
ngx_str_t name;
^
cc1: all warnings being treated as errors
make[1]: *** [objs/addon/nginx-vod-module-master/ngx_child_http_request.o] Error 1
make[1]: Leaving directory `/home/nginxlive/nginx-1.2.9’
make: *** [build] Error 2

Hi,

I am little confused by “I’m trying to add https://libraries.io/github/kaltura/nginx-rtmp-module to the exisisting kaltura-nginx vod module”… I think what you meant is you want to compile both the vod module and the rtmp module into the Nginx.
You’re in luck:) I already did so since the next CE version will include the option to perform live streaming using Nginx’s RTMP module thus eliminating the need for Wowza.
I already built kaltura-nginx packages that include both rtmp and vod modules and the needed configuration for both RTMP streaming and HLS manifest generation so you can play the stream over HTTP.

The packages are in the nightly repo, for RPM, edit /etc/yum.repos.d/kaltura.repo, if using CentOS/RHEL 7, set:

[Kaltura]
name = Kaltura Server
baseurl = http://installrepo.origin.kaltura.org/releases/rhel7/RPMS/$basearch/
gpgkey = http://installrepo.kaltura.org/releases/RPM-GPG-KEY-kaltura
gpgcheck = 1
enabled = 1

If you’re using RHEL/CentOS 6, set:

[Kaltura]
name = Kaltura Server
baseurl = http://installrepo.origin.kaltura.org/releases/nightly/RPMS/$basearch/
gpgkey = http://installrepo.kaltura.org/releases/RPM-GPG-KEY-kaltura
gpgcheck = 1
enabled = 1

Then run:

# yum clean all
# yum update kaltura-nginx
# service kaltura-nginx restart

For deb based systems, edit /etc/apt/sources.list.d/kaltura.list and set:

deb [arch=amd64] http://installrepo.origin.kaltura.org/repo/apt/debian-nightly lynx main

then run:

# aptitude update
# aptitude install kaltura-nginx

To stream use:
rtmp://$NGINX_HOST:1935/kLive/stream
to get the HLS manifest for playback, use:
http://$NGINX_HOST:$NGINX_PORT/hlsme/stream.m3u8

To use this with the HTML5 Kaltura player, go to KMC->Upload->Live Stream Entry->under Live Stream Type select Manual Live Stream URLs, provide a name and then in the URL input http://$NGINX_HOST:$NGINX_PORT/hlsme/stream.m3u8 and uncheck “Akamai HD protocol…”

Make sure you’re using kaltura-html5lib of version 2.48.1 which is the latest stable. This version uses HLS.JS and plays videos using HLS by default.

BTW, the spec files for building both deb and RPM are also available:


Also and regardless of adding RTMP support, I’ve upgraded Nginx to the latest stable which is 1.10.2.
The RTMP configuration is under:
/etc/nginx/nginx.conf
for RPM based system
or:
/opt/kaltura/nginx/conf/nginx.conf
for deb based systems

HLS manifest and fragments are placed in /var/tmp/hlsme/
and served by means of additional configuration under /etc/nginx/conf.d/kaltura.conf for RPM based systems and /opt/kaltura/nginx/conf/kaltura.conf for deb.

The RTMP module has many additional configuration options apart from this basic config we ship with, you can find full documentation here:

Hi Jess,
Thanks a lot for the quick response, starting today I’ll try and add the new nginx streaming configuration to our cluster.
Fingers crossed :slight_smile:

Regards,
Jacob R.

Hi again Jess,
Seems i get Reloading nginx configuration: /opt/kaltura/nginx/sbin/nginx: error while loading shared libraries: libavcodec.so.57: cannot open shared object file: No such file or directory, when trying to run apt-get install kaltura-nginx after adding the repo, the OS I use is ubuntu 14.04, also tried installing ffmpeg because i know it has the respective library in it, but I still get the error.
Please advise.

Thanks in advance.
Jacob R.

Hi @razvan_iacob,

Which kaltura-ffmpeg have you got?
Should be 3.1.3-2+b3. If it isn’t, please make sure you upgrade.

Thanks,

root@test:/etc/apt/sources.list.d# dpkg --list |grep kaltura
ii kaltura-base 12.3.0-2 all Kaltura Open Source Video Platform
ii kaltura-batch 12.3.0-1 all Kaltura Open Source Video Platform - batch server
ii kaltura-clipapp 1.3-1+b2 all Kaltura Video Presentations Manager
ii kaltura-db 12.0.0-1+b1 all Kaltura Open Source Video Platform - batch server
ii kaltura-dwh 11.3.0-2+b3 amd64 Kaltura Open Source Video Platform - Analytics
ii kaltura-ffmpeg 3.1.3-2+b2 amd64
ii kaltura-ffmpeg-aux 2.1.3-1 amd64
ii kaltura-front 12.3.0-1 all Kaltura Open Source Video Platform - frontend server
ii kaltura-html5-studio 2.0.7-1 all Kaltura Open Source Video Platform - frontend server
ii kaltura-html5lib 2.48.1-1 all Kaltura Open Source Video Platform - HTML5 player
ii kaltura-kclip 1.1.2.1-1 all Kaltura Video Presentations Manager
ii kaltura-kcw 2.2.4-1+b3 all Kalture Contribution Wizard
ii kaltura-kdp 2.7.0-1 all Kaltura Dynamic Player
ii kaltura-kdp3 3.9.9-1+b3 amd64 Kaltura Dynamic Player
ii kaltura-kdp3wrapper 37-1 all KDP3 Wrapper
ii kaltura-kdpwrapper 11-1 all KDP Wrapper
ii kaltura-kmc 5.40.3-3+b2 all Kaltura Management Console
ii kaltura-krecord 1.7-1 all Kaltura kRecord - used for recording from web cam
ii kaltura-kupload 1.2.16-1 all Kaltura kupload widget
iF kaltura-nginx 1.10.2-1 amd64 Nginx web/proxy server - for Kaltura
ii kaltura-pentaho 4.2.1+b2 amd64 Pentaho Open Source Data Integration Community Edition (CE).
ii kaltura-postinst 1.0.31-1+b3 all Kaltura Open Source Video Platform
ii kaltura-sphinx 2.2.1-3+b5 amd64 Sphinx full-text search server - for Kaltura
ii kaltura-widgets 10.9.0-1+b4 all Kaltura Open Source Video Platform - widgets meta package

Also i tried removing kaltura-ffmpeg and reinstalling it, it keep installing kaltura-ffmpeg 3.1.3-2+b2 not b3

Hi @razvan_iacob,

+b2 should be fine.
What’s the ouput for:
# ldd /opt/kaltura/nginx/sbin/nginx |grep libavcodec.so
?
should find /opt/kaltura/ffmpeg-3.1.3/lib/libavcodec.so.57 which is part of the kaltura-ffmpeg package.

My folder structure is:
drwxr-xr-x 8 root root 4096 Nov 1 12:41 ./
drwxr-xr-x 10 root root 4096 Nov 1 13:51 …/
drwx------ 2 kaltura root 4096 Oct 25 11:56 client_body_temp/
drwxr-xr-x 2 root root 4096 Nov 1 12:41 conf/
drwx------ 2 kaltura root 4096 Oct 25 11:56 fastcgi_temp/
drwx------ 2 kaltura root 4096 Oct 25 11:56 proxy_temp/
drwx------ 2 kaltura root 4096 Oct 25 11:56 scgi_temp/
drwx------ 2 kaltura root 4096 Oct 25 11:56 uwsgi_temp/

Seems I’m missing the sbin folder altogether, probably I did something when trying to add the rtmp libraries to the kaltura-nginx, I’ll reinstall everything from scratch.

Thanks a lot Jess, really appreciate the help.

Ok. so i reinstalled Kaltura,

root@test:/opt/kaltura/nginx/sbin# ldd /opt/kaltura/nginx/sbin/nginx |grep libavcodec.so
libavcodec.so.57 => /opt/kaltura/ffmpeg-3.1.3/lib/libavcodec.so.57 (0x00007f2b02cd0000)
But I still get the error /opt/kaltura/nginx/sbin/nginx: error while loading shared libraries: libavcodec.so.57: cannot open shared object file: No such file or directory

Seems I managed to get it working, just need to re-deploy front-end.

Regards,
Jacob R.

Hi @razvan_iacob,

Not sure what you mean by “re-deploy front-end”? does it work for you now?

Sorry making you wait Jess, seems that everything is working. One question tho, can i deploy the nginx module with older kaltura CE versions ?

Regards,
Jacob R.

Hi @razvan_iacob,

When you say older versions, how old?:slight_smile:

Well… is CE 11.18 too old ?

The idea is that on my my cluster has CE 11.18, centos 6.7,
Nginx is on a separate server.
ffmpeg is on the front node installed. ( rpm -q kaltura-ffmpeg
kaltura-ffmpeg-2.7.2-4.x86_64 )
html5lib are also on the front node ( kaltura-html5lib-v2.49-2.noarch )

The nginxconfigurations on the nginx server consists of nginx.conf with the rtmp directive, i am able to stream to it, i can see the ts packets in /var/hlsme and var/dashme getting created, in the kaltura.conf from the nginx directory i have added the two locations by hand as it seems the script did not auto add them , location /dashme {
open_file_cache off;
root /var/tmp;
add_header Cache-Control no-cache;
# To avoid issues with cross-domain HTTP requests (e.g. during development)
add_header Access-Control-Allow-Origin *;
}
location /hlsme {
open_file_cache off;
types {
application/vnd.apple.mpegurl m3u8;
}
root /var/tmp;
add_header Cache-Control no-cache; # Prevent caching of HLS fragments
add_header Access-Control-Allow-Origin *; # Allow web player to access our playlist
}

The problem is I cannot view the stream in any type of player not even in jwplayer, i get no error in the error logs from nginx.

In jwplayer - I get crossdomain access denied.( 2048 )… and in the kaltura player, the loader just keeps spinning.
I have no var/www to add crossdomain.xml on the nginx…what should I do ?
The root for seems to be set in kaltura.conf and it is /etc/nginx/static, the folder did not exist, created it, added the crossdomain.xml. same results :frowning:

Hi @razvan_iacob,

If you’re running Nginx on a separate server than the rest, you can easily upgrade only the kaltura-nginx and kaltura-ffmpeg packages on that one node, without upgrading the others.

Do not upgrade ffmpeg on the front or batch machines without upgrading kaltura-base to latest because newer versions of ffmpeg may not work with older versions of the server code but upgrading ONLY the Nginx node is safe enough. kaltura-nginx can be used in stand alone mode without having a full Kaltura Server cluster as well.

So in my CE 11.18 cluster i have a server only for nginx. On the nginx node this is what i have deployed:

yum list installed |grep kaltura
kaltura-a52dec.x86_64
kaltura-base.noarch 11.19.0-4 @Kaltura-noarch
kaltura-ffmpeg.x86_64
kaltura-lame.x86_64 3.99.5-3 @Kaltura
kaltura-libopencore-amr.x86_64
kaltura-monit.x86_64 5.18-1 @Kaltura
kaltura-nginx.x86_64 1.10.2-3 @Kaltura
kaltura-postinst.noarch
kaltura-release.noarch
kaltura-x264.x86_64 0.140-2.20140104 @Kaltura

When i ran the yum update kaltura-nginx. it did it with no errors but in nginx.conf there were no lines for rtmp server i added them by hand from a test server i have and in kaltura.conf also, the locations were not added, had to add them by hand. I am able to stream to the nginx server from FMLE, i can see the chunks in /var/tmp/dashme and hlsme/ but I cannot see the stream in any player.

This is what i have in sources:

URL: http://kaltura.org/

[Kaltura]
name = Kaltura Server
baseurl = http://installrepo.origin.kaltura.org/releases/nightly/RPMS/$basearch/
gpgkey = http://installrepo.kaltura.org/releases/RPM-GPG-KEY-kaltura
gpgcheck = 1
enabled = 1

we currently do not have the nightly so commented. We do have plans to add that.

#[Kaltura-testing]
#name = Kaltura Server arch independent
#baseurl = http://installrepo.kaltura.org/releases/nightly/RPMS/$basearch/
#gpgkey = http://installrepo.kaltura.org/releases/RPM-GPG-KEY-kaltura
#gpgcheck = 1
#enabled = 0

#[Kaltura-testing-noarch]
#name = Kaltura Server arch independent
#baseurl = http://installrepo.kaltura.org/releases/nightly/RPMS/noarch
#gpgkey = http://installrepo.kaltura.org/releases/RPM-GPG-KEY-kaltura
#gpgcheck = 1
#enabled = 0

I have the same thing configured with the lates kaltura version deployed as a All in One solution on ubuntu 14.04, i have the exact same thing, can stream but cannot load the stream in any player.

I can give you access if needed.

Hi @razvan_iacob,

Try:
# yum clean all
and then:
# yum info kaltura-nginx

What version[s] are you getting back?

In Ubuntu, try:
# apt-get update
# apt-cache policy kaltura-nginx
to see the same…

You should see:
Name : kaltura-nginx
Arch : x86_64
Version : 1.10.2
Release : 3
on CentOS 6

and:
Candidate: 1.10.2-1
on Ubuntu

Name : kaltura-nginx
Arch : x86_64
Version : 1.10.2
Release : 3
Size : 1.8 M
Repo : installed
From repo : Kaltura
Summary : High performance web server customized for Kaltura VOD
URL : http://nginx.org/
License : 2-clause BSD-like license
Description : nginx [engine x] is an HTTP and reverse proxy server, as well as
: a mail proxy server.
: This is a custom Nginx build for the Kaltura VOD module.
: Please see: https://github.com/kaltura/nginx-vod-module for more info.

OK, that’s good. This version includes support for RTMP.
Are you having any issues when trying to stream?