Livestreaming from OBS To Kaltura

Hello,

I managed to create a livestream from kaltura got the primary url and the stream name from kaltura and used that as a custom rtmp service in OBS.

When i press start streaming, it works well from OBS and i see traffic going to port 1935 on kaltura.

For some reason i cant see the stream on kaltura side, i get broadcast did not start.

What am i missing?

Thank you

Please see my reply here: VOD Packager and PRIMARY_MEDIA_SERVER_HOST

Hello Jess,

If i understand correctly, i read in nginx.conf

RTMP configuration

rtmp {
server {
listen 1935; # Listen on standard RTMP port
chunk_size 4000;

    # This application is to accept incoming stream
    application kLive {
            live on; # Allows live input from above
            dash on;
            dash_path /var/tmp/dashme;

            hls on; # Enable HTTP Live Streaming
            hls_cleanup on;
            hls_sync 100ms;
            hls_fragment 2s;

            hls_path /var/tmp/hlsme/;


    }
}

}

This means we have a kLive application to accept the incoming data from obs. In obs i can configure the stream to point to that application and the token provided by the generated livestream from KMC. What am i still missing?

I followed this document but when i try to playback i get nothing but a timeout https://archive.fosdem.org/2017/schedule/event/om_kaltura/attachments/slides/1404/export/events/attachments/om_kaltura/slides/1404/fosdem2017_presentation.pdf

Hi @OCX,

For the Nginx-RTMP-Kaltura integrations, the best doc to follow is https://blog.kaltura.com/free-and-open-live-video-streaming.
If something does not work, check the HTTP requests going out when you hit play, in particular, the playManifest request the player makes. Then make the same request with curl and look at the response.
Feel free to share your findings here for additional guidance.

Thanks Jess!
I got it working finally :))

Some errors though when playing back:
[http @ 0x7fb07c0c6720] No trailing CRLF found in HTTP header.0/0
[http @ 0x7fb07c012280] No trailing CRLF found in HTTP header.0/0
[http @ 0x7fb07c012240] No trailing CRLF found in HTTP header.0/0
[http @ 0x7fb07c012240] HTTP error 404 Not FoundB sq= 0B f=0/0
[hls,applehttp @ 0x7fb07c009280] Failed to open segment of playlist
[http @ 0x7fb07c071880] No trailing CRLF found in HTTP header.

The way i understand it is that the nginx-rtmp-module accepts broadcasts from encoders on port 1935 using rtmp on the kLive app.
Then it transcodes that automatically using ffmpeg into hls segments and serves that over hlsme application on port 88 “not 1935” for hls and dash delivery correct?

If the above is correct, i still have a question, how can i serve rtmp for the viewers that do not support hls? In the above scenario we are not serving rtmp for delivery but only for publishing

The idea is that i want to control my users on kaltura and serve them rtmp as well as hls to cover all devices and old flash stuff

Thank you!!

Hi @OCX,

For RTMP playback, you can use the same URI as you do for streaming.
To wit: say this is the command you use to stream the content:

$ ffmpeg -re -i /path/to/mp4 -c copy -f flv rtmp://$NGINX_HOST:$NGINX_RTMP_PORT/kLive/my-stream

For testing RTMP playback, you can use ffplay:

$ ffplay rtmp://$NGINX_HOST:$NGINX_RTMP_PORT/kLive/my-stream

For HLS playback, you’d use:

$ ffplay http://$NGINX_HOST:$NGINX_HTTP_PORT/hlsme/my-stream.m3u8

Which, I believe you already figured out since you say HLS playback worked for you.

By default, when installing the kaltura-nginx package, $NGINX_HTTP_PORT is 88 [because with Kaltura CE 80 is already used for Apache] and $NGINX_RTMP_PORT is 1935 [default RTMP port].

Jess, this is exactly what i am trying to do.
I am not able to play the RTMP streams but i am able to play http://host…:88/hlsme/myStream.m3u8.

i get this kind of output from the avplay;

avplay rtmp://host…:1935/kLive/myStream
ffplay version 2.8.11-0ubuntu0.16.04.1 Copyright © 2003-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0 nan : 0.000 fd= 0 aq= 0KB vq= 0KB
RTMP_ReadPacket, failed to read RTMP packet headersq= 0B f=0/0
Invalid data found when processing input

Update: Sometimes if i try the avplay command several times in a row it works but i get a black screen only playing no video/audio

Hi Jess

We are also experiencing issues when trying to stream from OBS to a kaltura live stream entry on ubuntu 16.04. We created a Manual Live Stream URLs (HLS), as you suggested.

With this entry, configured as follows:
HLS stream URL: https://daupara.com.co:8443/hlsme/streamhls.m3u8 (where 8443 is our Nginx port and daupara.com.co is the Nginx Host)

Through that entry, we were able to stream with the ffmpeg command
ffmpeg -re -i /home/gintama.mp4 -c copy -f flv “rtmp://daupara.com.co/kLive/streamhls”

What puzzles us is the fact that we are not using any port after the $NGINX_HOST in the ffmpeg command, and it works properly.

In OBS, when we try to use the same rtmp://daupara.com.co:8443/kLive/streamhls, or the same address with https:// or http:// or adding the .m3u8 extensión, or removing the port… OBS tries to connect and then connects repeatedly, and finally it crashes.

We are not able to use ffplay to test the ffmpeg command lines, as you suggested, because the command ffplay is not recognized by ubuntu, despite the fact that ffmpeg is installed and worked properly to stream from the command line. We didn’t install the whole ffpmeg package again, fearing that it will corrupt the kaltura ffmpeg installation.

We also created a Kaltura Live Streaming (HDS/HLS/DASH) entry, and copied the primary host and the entry:id to the OBS rtmp parameter and its key. Although OBS seems to stream correctly, nothing appears on the entry preview neither on the Share & Embed page, and the player shows a “Currently not broadcasting” message.

We don’t know where to find an error log file to find a clue…

Having tried every option, we are now out of ideas. Any help will be appreciated.

Best,

Oscar

@jaguardigital,

I think you are making a mistake.

One thing is the rtmp push stream that yo send into Kaltura and another one is the hls stream that is published.

  • You push your rtmp stream pointing OBS or whatever encoder into:
    rtmp://yourserver.com:1935/kLive/
    stream: yourstream

  • You create a manual live stream (Not a Kaltura Live /Wowza) entry and you give the hls URL that will be accessible for both your clients and kaltura.
    By default you will get something like this:
    http://yourserver.com:88/hlsme/yourstream.m3u8

  • You must notice that in order to be really useful the stream should be served on https, port 443.

  • We do that creating a live HLS delivery profile that points to a CDN or nginx frontend. This CDN pulls the hls manifests and segments from Kaltura and delivers a better URL like this:
    https://yourcdn.com/hlsme/yourstream.m3u8

You must make sure that your frontend passes the correct http headers (ie, X-Forwarded-Proto, X-Forwarded-Host) to Kaltura so the manifests give an https URL for the segments.

Using a frontend lets you cache the HLS manifests and segments and helps reducing the load on the Kaltura server.

I hope this helps,

David

Hi David

Thanks, that solved our issue. We were using the wrong sever address in OBS stream parameters

Best regards,

Oscar