RTSP streaming with jwplayer

945 views
Skip to first unread message

PeMa

unread,
Nov 4, 2015, 2:01:02 PM11/4/15
to C++ RTMP Server
Hi all.

I have been following some tutorials to get my Logitech C920 web camera to stream video via RTSP and then display it in a browser using jwplayer.

I have everything "working" but I still cannot get the player to load. I'm pretty sure the player itself is fine (tested it with a recorded video file). Maybe there is something I'm missing in crtmpserver's configuration.

I just compiled the crtmpserver from https://github.com/shiretu/crtmpserver. I'm running it from the compiled directory (not installed just yet). I did not modify the configuration at all. The server starts up fine, and when the streaming application is active, here's the console output:

http://pastebin.com/EaCxHD9p

Then I have a html page that should load the RTSP stream using jwplayer:

http://pastebin.com/ixw159Jy

When I load the page the player does not load (all I get is the text Loading player...) and I get nothing more at the crtmpserver command line. So does it even connect? Is the rtsp:// syntax correct? I have also tried to substitute the 127.0.0.1 with the public IP address of the network interface.

The program that is streaming into crtmpserver is avconv (like ffmpeg). Avconv just pipes the stream directly without doing any encoding (the camera encodes to H264 itself). The command for that is:

capture -F -o -c0 | avconv -re -i - -vcodec copy -f rtsp -metadata title=teststream rtsp://127.0.0.1:5544/live

Ignore the capture program, it just gets the stream from the camera. Then avconv just copies the stream into crtmpserver using RTSP. Output indicates it streams just fine into crtmpserver:

http://pastebin.com/5HvB5aTa

I haven't been able to test it with another player, as it seems that the version of vlc I have does not support RTSP streams.

If you have any tips/advice about crtmpserver and if the configuration is correct please let me know. Also if you know a way I can test the rtsp streaming some other way, I'm happy to try it. BTW, I did try to stream with RTP and with that I can connect with remote vlc player. But I need the embedded web player to work.

The tutorials I used:

http://nerdlogger.com/2013/11/09/streaming-1080p-video-using-raspberry-pi-or-beaglebone-black/
http://derekmolloy.ie/streaming-video-using-rtp-on-the-beaglebone-black/

BC

unread,
Nov 5, 2015, 4:40:57 PM11/5/15
to C++ RTMP Server
Hello !

I use  this code in my php file, I use Xsplit for streaming and it's working fine. I'm also using a counter that tells me how many viewers are watching the stream.
Use crtmpserver as a daemon

        </style>

</head>
<body>

         <div class="counter_simple" >
        <span>number of viewers:</span> <strong id="idOnlineVisitors1">0</strong>
        <script type="text/javascript">
                (function()
                {
                var settings = {
                handler: 'counter/server/php/handler.php',
                container: 'idOnlineVisitors1'
                 };
                var ouc = new WtOnlineUsersCounter(settings);
                 ouc.Init();
                })();
        </script>
</div>


  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <th><div id="cam1" >
 <p >you need FLASH PLAYER!</p>
<img src="http://xxx.xxx.xxx.ip/flash.gif" alt="you need Flash player" />
</a>
<script type="text/javascript">

var file = 'test';
var streamer = 'rtmp://xxx.xxx.xxx.ip/flvplayback';
var s1 = new SWFObject('player.swf', 'player', '640', '480', '9', "#FFFFFF");

      s1.addParam('allowfullscreen',      'true');
      s1.addParam('allowscriptaccess',   'always');
      s1.addParam('quality',               'high');
      s1.addParam('bgcolor',            '#FFFFFF');
      s1.addParam('fgcolor',            '#000000');
      s1.addVariable('streamer',         streamer);
    // s1.addVariable('thumbsinplaylist',   'true');
     //s1.addVariable('playlist',         'over');
      s1.addVariable('skin',        'nemesis.zip');
      s1.addVariable('file',                 file);
      s1.addVariable('scroll',             'true');
      s1.addVariable('enablejs',           'true');
      s1.addVariable('autostart',          'true');
      s1.addVariable('bufferlength',         '10');
      s1.useExpressInstall('expressInstall.swf');
s1.write('cam1');
</script>
                                                                                                                                                                  
my flvplayback.lua file

application=
{
        description="FLV Playback Sample",
        name="flvplayback",
        protocol="dynamiclinklibrary",
        mediaFolder="/var/www/media",
        aliases=
        {
                "simpleLive",
                "vod",
                "live",
                "WeeklyQuest",
                "SOSample",
                "oflaDemo",
        },
        validateHandshake=false,
        keyframeSeek=false,
        seekGranularity=1.5, --in seconds, between 0.1 and 600
        clientSideBuffer=12, --in seconds, between 5 and 30
        --generateMetaFiles=true, --this will generate seek/meta files on application startup
        --renameBadFiles=false,
        --[[authentication=
        {
                rtmp=
                {
                        type="adobe",
                        encoderAgents=
                        {
                                "FMLE/3.0 (compatible; FMSc/1.0)",
                        },
                        usersFile="/etc/crtmpserver/conf.d/users.lua"
                },
                rtsp=
                {
                        usersFile="/etc/crtmpserver/conf.d/users.lua"
                }
        },--]]
        acceptors =
        {
                {
                        ip="0.0.0.0",
                        port=6666,
                        protocol="inboundLiveFlv",
                        waitForMetadata=true,
                },
                {
                        ip="0.0.0.0",
                        port=9999,
                        protocol="inboundTcpTs"
                },
                --[[{

PeMa

unread,
Nov 19, 2015, 4:16:11 AM11/19/15
to C++ RTMP Server
Hi BC and thanks for the tips. I have solved the issue for now. I will report here to let others know if they have similar problems.

Basically the reason the player wouldn't load is that the html definitions were somehow wrong. I followed a tutorial which was reported to work but it didn't. After I copied the html code from jwplayer website the player loaded. But still the player said "no content available to stream". The reason for that was that jwplayer does NOT support rtsp protocol. It only support rtmp and a few other streaming protocols. So I got it to stream just fine!

Bernard Čokorilo

unread,
Nov 19, 2015, 3:18:57 PM11/19/15
to c-rtmp...@googlegroups.com
I'm glad that you solved the problem. I really only tried rtmp protocol so I didn't have any issues and I didn't know that jwplayer doesn't support rtsp, thanks for the tip, maybe I'll need it in the near future ! 

2015-11-18 6:41 GMT+01:00 PeMa <pma...@gmail.com>:
Hi BC and thanks for the tips. I have solved the issue for now. I will report here to let others know if they have similar problems.

Basically the reason the player wouldn't load is that the html definitions were somehow wrong. I followed a tutorial which was reported to work but it didn't. After I copied the html code from jwplayer website the player loaded. But still the player said "no content available to stream". The reason for that was that jwplayer does NOT support rtsp protocol. It only support rtmp and a few other streaming protocols. So I got it to stream just fine!

--
You received this message because you are subscribed to "C++ RTMP Server" mailing list.
To post to this group, send email to c-rtmp...@googlegroups.com
To unsubscribe from this group, send email to
c-rtmp-serve...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/c-rtmp-server?hl=en

---
You received this message because you are subscribed to a topic in the Google Groups "C++ RTMP Server" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/c-rtmp-server/-Bhj29aRiuI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to c-rtmp-serve...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages