RTSP to RTMP throught crtmpserver!

6,187 views
Skip to first unread message

Jorge Pantoja

unread,
Aug 18, 2011, 7:54:15 PM8/18/11
to C++ RTMP Server

Dear all,

I need your help, with a friend, we've tried to configure crtmpserver
to transcode a Live Stream video form RSTP to RTMP, but we have a lot
of problems with this!

First we dont know exactly in which part of the crtmpserver.lua file,
we have to add our rtsp address. Also I dont know whether we have to
do that just in want part, and it automaticaly made the trancode to
rtsp, or we have to add another line for the transcode.

Also, we dont know which is the correct syntax for the url address to
use in our flash player (flowplayer or jwplayer).

for example this: rtmp://host/live/stream or rtmp://192.168.1.100/flvplayback/stream3.


Please, we need help!.

We'd be gratefull whether someone can help us!

Thanks!

Br

Jorge Pantoja

Jorge Pantoja

unread,
Aug 19, 2011, 10:47:36 AM8/19/11
to C++ RTMP Server


The config file that I have is the following (copied on pastebin):

http://pastebin.com/zp0VPujf

I'm trying to connect to this address: rtmp://192.168.1.100/live/cam1

The errors that I've:


[root@CentosVideo cmake]# crtmpserver /usr/local/etc/crtmpserver.lua
/root/crtmpserver/sources/crtmpserver/src/crtmpserver.cpp:196 Plug in
the default protocol factory
/root/crtmpserver/sources/crtmpserver/src/crtmpserver.cpp:203
Initialize I/O handlers manager: epoll
/root/crtmpserver/sources/crtmpserver/src/crtmpserver.cpp:214
Initialize applications
/root/crtmpserver/sources/thelib/src/netio/epoll/iohandlermanager.cpp:
98 Handlers count changed: 0->1 IOHT_ACCEPTOR
/root/crtmpserver/sources/thelib/src/netio/epoll/iohandlermanager.cpp:
98 Handlers count changed: 1->2 IOHT_ACCEPTOR
/root/crtmpserver/sources/thelib/src/netio/epoll/iohandlermanager.cpp:
98 Handlers count changed: 2->3 IOHT_ACCEPTOR
/root/crtmpserver/sources/thelib/src/configuration/configfile.cpp:829
Application "appselector" (vod) is up and running
/root/crtmpserver/sources/thelib/src/netio/epoll/iohandlermanager.cpp:
98 Handlers count changed: 3->4 IOHT_TCP_CONNECTOR
/root/crtmpserver/sources/thelib/src/netio/epoll/iohandlermanager.cpp:
98 Handlers count changed: 4->5 IOHT_ACCEPTOR
/root/crtmpserver/sources/thelib/src/configuration/configfile.cpp:829
Application "flvplayback" (live) is up and running
/root/crtmpserver/sources/crtmpserver/src/crtmpserver.cpp:220 Install
the quit signal
/root/crtmpserver/sources/crtmpserver/src/crtmpserver.cpp:223 Install
the conf re-read signal
/root/crtmpserver/sources/crtmpserver/src/crtmpserver.cpp:234
+-----------------------------------------------------------------------------
+
|
Services|
+---+---------------+-----+-------------------------
+-------------------------+
| c | ip | port| protocol stack name | application
name |
+---+---------------+-----+-------------------------
+-------------------------+
|tcp| 0.0.0.0| 1935| inboundRtmp|
appselector|
+---+---------------+-----+-------------------------
+-------------------------+
|tcp| 0.0.0.0| 8081| inboundRtmps|
appselector|
+---+---------------+-----+-------------------------
+-------------------------+
|tcp| 0.0.0.0| 8080| inboundRtmpt|
appselector|
+---+---------------+-----+-------------------------
+-------------------------+
|tcp| 0.0.0.0| 554| inboundRtsp|
flvplayback|
+---+---------------+-----+-------------------------
+-------------------------+

/root/crtmpserver/sources/crtmpserver/src/crtmpserver.cpp:235 GO! GO!
GO! (23663)
/root/crtmpserver/sources/thelib/src/netio/epoll/iohandlermanager.cpp:
98 Handlers count changed: 5->6 IOHT_TCP_CARRIER
/root/crtmpserver/sources/thelib/src/netio/epoll/iohandlermanager.cpp:
107 Handlers count changed: 6->5 IOHT_TCP_CONNECTOR
/root/crtmpserver/sources/thelib/src/protocols/rtp/
basertspappprotocolhandler.cpp:368 Unable to set sessionId
/root/crtmpserver/sources/thelib/src/protocols/rtp/rtspprotocol.cpp:
240 Unable to handle content
/root/crtmpserver/sources/thelib/src/netio/epoll/tcpcarrier.cpp:88
Unable to signal data available
/root/crtmpserver/sources/thelib/src/netio/epoll/iohandlermanager.cpp:
107 Handlers count changed: 5->4 IOHT_TCP_CARRIER
/root/crtmpserver/sources/thelib/src/protocols/protocolmanager.cpp:44
Enqueue for delete for protocol [RTSP(2)]
/root/crtmpserver/sources/thelib/src/application/
baseclientapplication.cpp:170 Protocol [RTSP(2)] unregistered from
application: flvplayback
/root/crtmpserver/sources/thelib/src/netio/epoll/tcpacceptor.cpp:133
Client connected: 192.168.1.3:51936 -> 0.0.0.0:1935
/root/crtmpserver/sources/thelib/src/netio/epoll/iohandlermanager.cpp:
98 Handlers count changed: 4->5 IOHT_TCP_CARRIER
/root/crtmpserver/sources/applications/appselector/src/
rtmpappprotocolhandler.cpp:60 Application live/cam1 not found
/root/crtmpserver/sources/thelib/src/protocols/rtmp/
basertmpprotocol.cpp:749 Unable to send rtmp message to application
/root/crtmpserver/sources/thelib/src/netio/epoll/tcpcarrier.cpp:88
Unable to signal data available
/root/crtmpserver/sources/thelib/src/netio/epoll/iohandlermanager.cpp:
107 Handlers count changed: 5->4 IOHT_TCP_CARRIER
/root/crtmpserver/sources/thelib/src/protocols/protocolmanager.cpp:44
Enqueue for delete for protocol [IR(4)]
/root/crtmpserver/sources/thelib/src/application/
baseclientapplication.cpp:170 Protocol [IR(4)] unregistered from
application: appselector

Jorge Pantoja

unread,
Aug 19, 2011, 10:53:22 AM8/19/11
to C++ RTMP Server

I'm using this script to test the rtmp address:


<html>
<head>
<script type='text/javascript' src='jwplayer.js'></script>

<body>

<center><div id='mediaspace'>This text will be replaced</div><center>

</body>
</html>

<script type='text/javascript'>
jwplayer('mediaspace').setup({
'flashplayer': 'player.swf',
'file': 'bunny.flv',
'streamer': 'rtmp://192.168.1.100/live/cam1',
//'streamer': 'rtmp://192.168.1.100:1935/live/cam1',
//'streamer': 'rtmp://edge01.fms.dutchview.nl/botr',
'controlbar': 'bottom',
'width': '470',
'height': '290'
});
</script>

Manuel Raña

unread,
Aug 19, 2011, 11:03:16 AM8/19/11
to c-rtmp...@googlegroups.com

Jorge Pantoja

unread,
Aug 19, 2011, 11:26:45 AM8/19/11
to C++ RTMP Server

Hi Manuel, thanks for the fast responde. But we are using a tool like
that, between the player and the rtmp server (crtmpserver) we're using
our own RTSP server that is working well. We're are sending those rtsp
files to the crtmp.

Manuel Raña

unread,
Aug 19, 2011, 11:39:30 AM8/19/11
to c-rtmp...@googlegroups.com
Don't know if it can solve your problem but, I suggest you to try this:

'file': 'cam1';



2011/8/19 Jorge Pantoja <jorgep...@gmail.com>

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

Jorge Pantoja

unread,
Aug 19, 2011, 12:32:38 PM8/19/11
to C++ RTMP Server

Thanks Manuel, but i'm still having the same problem. Do you know
what's the meaning for these errors:

Application appselector/cam1 not found

/root/crtmpserver/sources/applications/appselector/src/
rtmpappprotocolhandler.cpp:60 Application appselector/cam1 not found
/root/crtmpserver/sources/thelib/src/protocols/rtmp/
basertmpprotocol.cpp:749 Unable to send rtmp message to application
/root/crtmpserver/sources/thelib/src/netio/epoll/tcpcarrier.cpp:88
Unable to signal data available
/root/crtmpserver/sources/thelib/src/netio/epoll/iohandlermanager.cpp:
107 Handlers count changed: 12->11 IOHT_TCP_CARRIER
/root/crtmpserver/sources/thelib/src/protocols/protocolmanager.cpp:44
Enqueue for delete for protocol [IR(2)]
/root/crtmpserver/sources/thelib/src/application/
baseclientapplication.cpp:170 Protocol [IR(2)] unregistered from
application: appselector

Rani

unread,
Aug 19, 2011, 12:46:20 PM8/19/11
to C++ RTMP Server
Yes, it says that could not find CAM1 APPLICATION. And obviously it is
right because you have not made and have not defined it into
crtpmserver.lua config file (application name like
name="flvplayback" .. etc). Your correct address would be rtmp://192.168.1.100/live/
where cam1 is the name of the stream not name of application.

correct JW code into your webpage would be:

<script type='text/javascript'>
var so = new SWFObject('player.swf','mpl','470','290','9');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess','always');
so.addParam('wmode','opaque');
so.addVariable('file','cam1');
so.addVariable('plugins','livestream');
so.addVariable('streamer','rtmp://192.168.1.100/live');
so.addVariable('autostart','true');
so.write('mediaspace');
</script>

See the difference? Use livestream plugin from JW Player.

Try code above... assuming that crtmpserver has already registered
your stream as cam1 (see log file to be sure before fire up the
webpage).

best regards

Jorge Pantoja

unread,
Aug 19, 2011, 1:23:39 PM8/19/11
to C++ RTMP Server

Thanks Rani for the Help.

So you mean that I've to create a new part on the config lua file,
like flvplayback part?

It's just creating a part on the code? Or it means also to create a
folder and an adittional file on the rootdirectory/applications

becase, the flvplayback folder exists on the application folder, and
has some files like: libflvplayback.so .

Thanks again Rani.

Jorge Pantoja

unread,
Aug 19, 2011, 1:26:02 PM8/19/11
to C++ RTMP Server

Now I've this error:

No file streams found: cam1 ---> That means that I need a folder named
cam1?

/root/crtmpserver/sources/thelib/src/protocols/rtmp/
basertmpappprotocolhandler.cpp:1855 No file streams found: cam1
/root/crtmpserver/sources/thelib/src/protocols/rtmp/
basertmpappprotocolhandler.cpp:881 We are going to wait for the live
stream `cam1`
/root/crtmpserver/sources/thelib/src/application/
baseclientapplication.cpp:192 Stream NR(1) with name `` unregistered
from application `flvplayback` from protocol IR(6)
/root/crtmpserver/sources/thelib/src/application/
baseclientapplication.cpp:181 Stream ONR4R(2) with name `cam1`
registered to application `flvplayback` from protocol IR(6)
/root/crtmpserver/sources/thelib/src/protocols/rtmp/
basertmpappprotocolhandler.cpp:482 User control message type:
RM_USRCTRL_TYPE_STREAM_SET_BUFFER_LENGTH
Message has been deleted

Jorge Pantoja

unread,
Aug 19, 2011, 1:32:56 PM8/19/11
to C++ RTMP Server

Now I've this configuration:
{
description="FLV Playback Sample",
name="flvplayback",
protocol="dynamiclinklibrary",
mediaFolder="/root/crtmpserver/media",
aliases=
{
"simpleLive",
"vod",
"live",
"WeeklyQuest",
"SOSample",
"oflaDemo",
},
acceptors =
{
{
ip="0.0.0.0",
port=554,
protocol="inboundRtsp"
},
},
externalStreams =
{
{
uri="rtsp://192.168.1.1:554/
service?PuId-
ChannelNo=010203010501010500000179&PlayMethod=0&PuProperty=0&StreamingType=
2",
localStreamName="cam1",
},
{
uri="rtsp://192.168.1.1:554/
service?PuId-
ChannelNo=010203010501010500000179&PlayMethod=0&PuProperty=0&StreamingType=
2",
localStreamName="cam2",
forceTcp=true
}

Madhawa Jayanath

unread,
Aug 19, 2011, 6:13:57 AM8/19/11
to c-rtmp...@googlegroups.com
Hello Jorge,

1st enable RTSP support for application "flvplayback" in crtmpserver.lua

go to externalStreams section of application "flvplayback" and add entry for your RTSP stream.

something like ....

externalStreams = 
{
{
uri="rtsp://ip_rtsp_server/rtsp_streamname",
localStreamName="new_rtmp_streamname",
forceTcp=true
},
}

**** rtsp_streamname is name of your RTSP stream
**** new_rtmp_streamname is new name for "rtsp_streamname"



restart CRTMPServer

Now you can access stream name "new_rtmp_streamname" over RTMP protocol.

example
rtmp://ip_of_crtmpserver:1935/live/new_rtmp_streamname

or 

rtmp://ip_of_crtmpserver:1935/flvplayback/new_rtmp_streamname

Hope this helps :)


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



--
Best regards,
Madhawa Jayanath

Software Engineering Manager
101 Global Co.,Ltd.
999/9 # 2409 Rama 1, Pathumwan
Bangkok, 10330. Thailand
INUM +883-510-07-403-6540
Tel. +66.840839412
FAX. +66.26480995


Sent from my NoteBook® by Hand

Jorge Pantoja

unread,
Aug 19, 2011, 4:38:21 PM8/19/11
to C++ RTMP Server

Hi Madhawa, thank you for the guide on how to configure this. But, I
don't know Why I still have the same error: please I'd be gratefull
whether you can help me cheking the configurations I have.

Errors: http://pastebin.com/1qCfLvCr
Html page: http://pastebin.com/HVLNRG7Y

I've also use this guide: http://wiki.rtmpd.com/tutorial_full_centos_build

The .lua file I've in: /usr/local/etc

C++ RTMP Server

unread,
Aug 19, 2011, 7:34:49 PM8/19/11
to c-rtmp...@googlegroups.com
Hi,

Please use wireshark to sniff the traffic between crtmpserver and the camera, save it and send it directly to me (support __at__ rtmpd __dot__ com)
Apparently, there is an error while setting the session id on the RTSP connection and the cam1 stream doesn't come in at all. The RTSP connection is simply dropped:

basertspappprotocolhandler.cpp:368 Unable to set sessionId

rtspprotocol.cpp:240 Unable to handle content

Cheers,
Andrei

> 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

------
Eugen-Andrei Gavriloaie
Web: http://www.rtmpd.com

Jorge Pantoja

unread,
Aug 20, 2011, 3:01:07 PM8/20/11
to C++ RTMP Server

Thanks for the response and the kindly help Andrei.

I've tried to send you an email to to the one you gave me, but the
mail returned as failed.

Do you have another email address to send you the files?


Thanks Andrei.

Manuel Raña

unread,
Aug 20, 2011, 4:03:39 PM8/20/11
to C++ RTMP Server
This is off topic but there's a typo in this file:

http://trac.rtmpd.com/browser/trunk/sources/thelib/src/protocols/rtp/basertspappprotocolhandler.cpp

Line 545:

&& (!transport.HasKey("rtp/avp/usp"))
Message has been deleted

Jorge Pantoja

unread,
Aug 20, 2011, 6:55:56 PM8/20/11
to C++ RTMP Server

//2. Check and see if it has RTP/AVP/TCP,RTP/AVP/UDP or RTP/AVP
if ((!transport.HasKey("rtp/avp/tcp"))
&& (!transport.HasKey("rtp/avp/usp"))
&& (!transport.HasKey("rtp/avp"))) {
FATAL("Invalid transport line: %s",
STR(transportLine));
return false;
}

usp to udp


Manuel Raña

unread,
Aug 20, 2011, 7:19:20 PM8/20/11
to c-rtmp...@googlegroups.com
I know, just reporting that :)

2011/8/21 Jorge Pantoja <jorgep...@gmail.com>
Message has been deleted

Jorge Pantoja

unread,
Aug 20, 2011, 7:26:38 PM8/20/11
to C++ RTMP Server

that is really good, you have a lot of interest on crtmpserver :)

Jorge Pantoja

unread,
Aug 20, 2011, 7:27:30 PM8/20/11
to C++ RTMP Server
Well, back to the topic.

Dear Andrei, I've sent you the info to your email. Please help me
checking it.

Just to add some info:

The RTSP address that i'm sending has this:

StreamType
codec/size/framerate/bitrate
h264/320x240/10/192 r :)

Jorge Pantoja

unread,
Aug 20, 2011, 8:15:25 PM8/20/11
to C++ RTMP Server

What considerations do the crtmpserver take in consideration to
establish the session ID?

Maybe there is something wrong with my rtsp :(

I've tested with this address that is in the .lua config file, and it
works :(

uri="rtsp://82.177.67.61/axis-media/media.amp",
localStreamName="stream4",
forceTcp=true

C++ RTMP Server

unread,
Aug 21, 2011, 4:27:18 AM8/21/11
to c-rtmp...@googlegroups.com
Hi,

I took a look at the traffic you sent me. Unfortunately, is not usable at all. I just see no more the 200 bytes of RTSP traffic. You actually sent me all th traffic on your network card, including SSH session, RTSP, ARP, UDP, everything. You might want to put a filter before doing the sniff: "tcp port 554"


On Aug 21, 2011, at 3:15 AM, Jorge Pantoja wrote:

>
> What considerations do the crtmpserver take in consideration to
> establish the session ID?

Standard handling. When acting as a client, whenever the server gives a session id, that session id is preserved. From that time onward, all future responses from the server MUST have the same session id for that particula connection, If not, the connection is discarded instantly.

But, as I said, no usable traffic found in your capture so I can pinpoint the error: This is the only RTSP traffic I get:

OPTIONS rtsp://186.46.31.59:RTSP/1.0 200 OK
CSeq: 1
SeDESCRIBE rtsp://186.46.31.59RTSP/1.0 404 Not Found
CSeq

As you can see, it is also badly formatted (and I also think the URI is wrong as well)

Best regards,
Andrei


>
> Maybe there is something wrong with my rtsp :(
>
> I've tested with this address that is in the .lua config file, and it
> works :(
>
> uri="rtsp://82.177.67.61/axis-media/media.amp",
> localStreamName="stream4",
> forceTcp=true
>

> 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

------

Jorge Pantoja

unread,
Aug 22, 2011, 2:02:36 PM8/22/11
to C++ RTMP Server

Dear Andrei,

Thanks for the response. I'm so sorry about the wireshark file with
lot of traffic I sent to you. My Friend Francisco Segura sent you a
new wireshark capture to your email. In this capture, we've tested the
rtsp streamming before and it was ok. In this new capture, we can see
the following:


[Packet size limited during capture: RTSP truncated]

what could this mean?

Best regards,

Jorge Pantoja

Jorge Pantoja

unread,
Aug 22, 2011, 2:06:08 PM8/22/11
to C++ RTMP Server

Just to add some info, making a follow to the TCP Stream, I can get
this:


OPTIONS rtsp://186.46.31.59:55RTSP/1.0 200 OK
CSeq: 1
SessDESCRIBE rtsp://186.46.31.59:5RTSP/1.0 200 OK
CSeq: 2
Serv

But, I'm still having this error:

[Packet size limited during capture: RTSP truncated]


Any Idea?


Thanks!

Best Regards,

Jorge Pantoja

Jorge Pantoja

unread,
Aug 22, 2011, 2:11:40 PM8/22/11
to C++ RTMP Server

Do you think it could be something regarding the length of the
address, it's this:

rtsp://10.100.100.209:554/methodservice?PuId-AdresssNameNo=Ppollkjj0CCC010REertTGDdVV000RR&ReadMethod=0&PuProperty=0&StreamingForm=30


Thanks for the help!

Best Regards,

Jorge Pantoja

Jorge Pantoja

unread,
Aug 22, 2011, 3:31:12 PM8/22/11
to C++ RTMP Server
I've found this on the wireshark forums:

C.1.2. [Packet size limited during capture]

The packet size was limited during capture, see "Limit each packet to
n bytes" at the Section 4.5, “The "Capture Options" dialog box”. While
dissecting, the current protocol dissector was simply running out of
packet bytes and had to give up. There's nothing else you can do now,
except to repeat the whole capture process again with a higher (or no)
packet size limitation.

http://www.wireshark.org/docs/wsug_html_chunked/AppMessages.html#id632393

Reply all
Reply to author
Forward
0 new messages