OpenIPC / majestic

Majestic Community edition integration kit
MIT License
33 stars 5 forks source link

Support for different authorization methods when using RTMP #92

Open ystinia opened 1 year ago

ystinia commented 1 year ago

Good evening

Do you plan to add support for Adobe authorization or correct parsing of URL-based authorization?

We want to install a pair of IP cameras with OpenIPC in our lyceum on the top floor overlooking the sea, but have encountered problems with the transfer of traffic to Nimble.

Thank you.

ystinia commented 1 year ago
outgoing:
  - rtmp://login:password@nimble.server/openipc/lyceum-178
15:33:49  <       majestic> [    rtmp] try_connect@470               Connecting to RTMP URL rtmp://login:password@nimble.server/openipc/lyceum-178...
15:33:49  <       majestic> [    rtmp] log_rtmp@44                   Parsing...
15:33:49  <       majestic> [    rtmp] log_rtmp@44                   Parsed protocol: 0
15:33:49  <       majestic> [    rtmp] log_rtmp@44                   Parsed host    : login
15:33:49  <       majestic> [    rtmp] log_rtmp@44                   Parsed app     : openipc/lyceum-178
15:33:49  <       majestic> [    rtmp] log_rtmp@44                   Could not resolve login: Unknown error (11)
15:33:49  <       majestic> [    rtmp] connect_thread@546            Connection to rtmp://login:password@nimble.server/openipc/lyceum-178 failed: -2
widgetii commented 1 year ago

Never used forementioned Nimble before. Could you write thorough instruction how to reproduce your setup and test streaming Nimble with RTMP authorization? I don't feel adding RTMP authorization would be tricky

ystinia commented 1 year ago
outgoing:
  - rtmp://nimble.server/openipc?rtmpauth=login:password/lyceum-178
15:38:34  <       majestic> [    rtmp] try_connect@470               Connecting to RTMP URL rtmp://nimble.server/openipc?rtmpauth=login:password/lyceum-178...
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   Parsing...
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   Parsed protocol: 0
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   Parsed host    : nimble.server
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   Parsed app     : openipc?rtmpauth=login:password/lyceum-178
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   RTMP_Connect1, ... connected, handshaking
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   HandShake: Type Answer   : 03
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   HandShake: Server Uptime : 0
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   HandShake: FMS Version   : 0.0.0.0
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   HandShake: Handshaking finished....
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   RTMP_Connect1, handshaked
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=4, ts=0
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=273, ts=0
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   Invoking connect
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ReadPacket: fd=42
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   HandleServerBW: server BW = 5000000
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ReadPacket: fd=42
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   HandleClientBW: client BW = 5000000 2
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ReadPacket: fd=42
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   HandleCtrl, received ctrl. type: 0, len: 6
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   HandleCtrl, Stream Begin 0
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ReadPacket: fd=42
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   HandleChangeChunkSize, received: chunk size change to 4128750
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ReadPacket: fd=42
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ClientPacket, received: invoke 160 bytes
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   (object begin)
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           no-name., STRING:   _error>
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           no-name., NUMBER:   1.00>
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   Property: NULL
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           no-name., OBJECT>
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   (object begin)
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:              level, STRING:   error>
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:               code, STRING:   NetConnection.Connect.Rejected>
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:        description, STRING:   [ AccessManager.Reject ] : [ code=403 need auth; authmod=adobe ] : >
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   (object end)
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   (object end)
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   HandleInvoke, server invoking <_error>
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   HandleInvoke, received error for method call <connect>
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   HandleInvoke, error description: [ AccessManager.Reject ] : [ code=403 need auth; authmod=adobe ] : 
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   PublisherAuth, need to set pubUser & pubPasswd for publisher auth
15:38:34  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ReadPacket: fd=42
15:39:18  <       majestic> [    rtmp] log_rtmp@44                   RTMPSockBuf_Fill, remote host closed connection
15:39:18  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ReadPacket, failed to read RTMP packet header
15:39:18  <       majestic> [    rtmp] connect_thread@546            Connection to rtmp://nimble.server/openipc?rtmpauth=login:password/lyceum-178 failed: -3
ystinia commented 1 year ago

A little later I will try another method related to key generation and give information. But in any case it is more complicated and I would not like to use it in the future on a permanent basis.

https://blog.wmspanel.com/2015/10/rtsp-publish-control-framework-overview.html

https://github.com/Softvelum/publish_control/blob/master/python/publish_signature_generator.py

widgetii commented 1 year ago

For now, RTMP support within Majestic considered MVP, because it hasn't tested widely yet. It's not a problem to add new functions (like authorization) but for tests to ensure that task is done we should have actual setup

ystinia commented 1 year ago

Okay, I'll ask my friends at Softvelum to create a couple of test accounts and pass them to you via PM.

Thank you very much for your technical support and quick responses ;)

ystinia commented 1 year ago

Yes, it seems that the problem is due to parsing conditions. I think we have to work with parameters like "host", "port", "app", "app_param", "stream" and others. Unfortunately my experimental work through the key also failed

18:37:46  <       majestic> [    rtmp] try_connect@470               Connecting to RTMP URL rtmp://nimble.server/openipc?publishsign=aWQ9...pcD0=/lyceum-178...
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   Parsing...
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   Parsed protocol: 0
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   Parsed host    : nimble.server
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   Parsed app     : openipc?publishsign=aWQ9...pcD0=/lyceum-178
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   RTMP_Connect1, ... connected, handshaking
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   HandShake: Type Answer   : 03
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   HandShake: Server Uptime : 0
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   HandShake: FMS Version   : 0.0.0.0
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   HandShake: Handshaking finished....
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   RTMP_Connect1, handshaked
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=4, ts=0
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=432, ts=0
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   Invoking connect
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ReadPacket: fd=42
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   HandleServerBW: server BW = 5000000
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ReadPacket: fd=42
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   HandleClientBW: client BW = 5000000 2
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ReadPacket: fd=42
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   HandleCtrl, received ctrl. type: 0, len: 6
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   HandleCtrl, Stream Begin 0
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ReadPacket: fd=42
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   HandleChangeChunkSize, received: chunk size change to 4128750
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ReadPacket: fd=42
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ClientPacket, received: invoke 132 bytes
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   (object begin)
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           no-name., STRING:   _result>
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           no-name., NUMBER:   1.00>
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           no-name., OBJECT>
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   (object begin)
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:             fmsVer, STRING:   Nimble/3.7.12-2>
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   (object end)
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           no-name., OBJECT>
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   (object begin)
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:              level, STRING:   status>
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:               code, STRING:   NetConnection.Connect.Success>
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:     objectEncoding, NUMBER:   0.00>
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   (object end)
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   (object end)
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   HandleInvoke, server invoking <_result>
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   HandleInvoke, received result for method call <connect>
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=39, ts=0
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   Invoking releaseStream
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=35, ts=0
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   Invoking FCPublish
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=25, ts=0
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   Invoking createStream
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ReadPacket: fd=42
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ClientPacket, received: invoke 142 bytes
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   (object begin)
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           no-name., STRING:   onFCPublish>
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           no-name., NUMBER:   0.00>
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   Property: NULL
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           no-name., OBJECT>
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   (object begin)
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:              level, STRING:   status>
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:               code, STRING:   NetStream.Publish.Start>
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:        description, STRING:   FCPublish to stream zftlab-178.>
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           clientid, NUMBER:   3735928559.00>
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   (object end)
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   (object end)
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   HandleInvoke, server invoking <onFCPublish>
18:37:46  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ReadPacket: fd=42
18:37:47  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ClientPacket, received: invoke 29 bytes
18:37:47  <       majestic> [    rtmp] log_rtmp@44                   (object begin)
18:37:47  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           no-name., STRING:   _result>
18:37:47  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           no-name., NUMBER:   4.00>
18:37:47  <       majestic> [    rtmp] log_rtmp@44                   Property: NULL
18:37:47  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           no-name., NUMBER:   1.00>
18:37:47  <       majestic> [    rtmp] log_rtmp@44                   (object end)
18:37:47  <       majestic> [    rtmp] log_rtmp@44                   HandleInvoke, server invoking <_result>
18:37:47  <       majestic> [    rtmp] log_rtmp@44                   HandleInvoke, received result for method call <createStream>
18:37:47  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=40, ts=0
18:37:47  <       majestic> [    rtmp] log_rtmp@44                   Invoking publish
18:37:47  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ReadPacket: fd=42
18:37:47  <       majestic> [    rtmp] log_rtmp@44                   RTMPSockBuf_Fill, remote host closed connection
18:37:47  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=37, ts=0
18:37:47  <       majestic> [    rtmp] log_rtmp@44                   Invoking FCUnpublish
18:37:47  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=34, ts=0
18:37:47  <       majestic> [    rtmp] log_rtmp@44                   Invoking deleteStream
18:37:47  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ReadPacket, failed to read RTMP packet header
18:37:47  <       majestic> [    rtmp] connect_thread@546            Connection to rtmp://nimble.server/openipc?publishsign=aWQ9...pcD0=/lyceum-178 failed: -3
ystinia commented 1 year ago

What chunk size do I need for Majestic during negotiation ?
On the Nimble side, can set it with the parameter rtmp_chunk_size = <value>

ystinia commented 1 year ago

Server access details sent to your email

Thank you.

ystinia commented 1 year ago

So, now let's try to stream without authorization

outgoing:
  - rtmp://nimble.server/openipc/lyceum-178
19:40:13  <       majestic> [    rtmp] try_connect@470               Connecting to RTMP URL rtmp://nimble.server/openipc/lyceum-178...
19:40:13  <       majestic> [    rtmp] log_rtmp@44                   Parsing...
19:40:13  <       majestic> [    rtmp] log_rtmp@44                   Parsed protocol: 0
19:40:13  <       majestic> [    rtmp] log_rtmp@44                   Parsed host    : nimble.server
19:40:13  <       majestic> [    rtmp] log_rtmp@44                   Parsed app     : openipc/lyceum-178
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   RTMP_Connect1, ... connected, handshaking
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   HandShake: Type Answer   : 03
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   HandShake: Server Uptime : 0
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   HandShake: FMS Version   : 0.0.0.0
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   HandShake: Handshaking finished....
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   RTMP_Connect1, handshaked
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=4, ts=0
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=225, ts=0
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Invoking connect
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ReadPacket: fd=42
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   HandleServerBW: server BW = 5000000
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ReadPacket: fd=42
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   HandleClientBW: client BW = 5000000 2
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ReadPacket: fd=42
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   HandleCtrl, received ctrl. type: 0, len: 6
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   HandleCtrl, Stream Begin 0
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ReadPacket: fd=42
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   HandleChangeChunkSize, received: chunk size change to 4128750
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ReadPacket: fd=42
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ClientPacket, received: invoke 132 bytes
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   (object begin)
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           no-name., STRING:   _result>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           no-name., NUMBER:   1.00>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           no-name., OBJECT>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   (object begin)
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:             fmsVer, STRING:   Nimble/3.7.12-2>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   (object end)
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           no-name., OBJECT>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   (object begin)
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:              level, STRING:   status>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:               code, STRING:   NetConnection.Connect.Success>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:     objectEncoding, NUMBER:   0.00>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   (object end)
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   (object end)
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   HandleInvoke, server invoking <_result>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   HandleInvoke, received result for method call <connect>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=39, ts=0
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Invoking releaseStream
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=35, ts=0
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Invoking FCPublish
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=25, ts=0
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Invoking createStream
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ReadPacket: fd=42
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ClientPacket, received: invoke 142 bytes
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   (object begin)
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           no-name., STRING:   onFCPublish>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           no-name., NUMBER:   0.00>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: NULL
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           no-name., OBJECT>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   (object begin)
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:              level, STRING:   status>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:               code, STRING:   NetStream.Publish.Start>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:        description, STRING:   FCPublish to stream lyceum-178.>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           clientid, NUMBER:   3735928559.00>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   (object end)
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   (object end)
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   HandleInvoke, server invoking <onFCPublish>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ReadPacket: fd=42
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ClientPacket, received: invoke 29 bytes
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   (object begin)
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           no-name., STRING:   _result>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           no-name., NUMBER:   4.00>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: NULL
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           no-name., NUMBER:   1.00>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   (object end)
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   HandleInvoke, server invoking <_result>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   HandleInvoke, received result for method call <createStream>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=40, ts=0
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Invoking publish
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ReadPacket: fd=42
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   HandleCtrl, received ctrl. type: 0, len: 6
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   HandleCtrl, Stream Begin 1
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ReadPacket: fd=42
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   RTMP_ClientPacket, received: invoke 130 bytes
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   (object begin)
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           no-name., STRING:   onStatus>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           no-name., NUMBER:   0.00>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: NULL
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           no-name., OBJECT>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   (object begin)
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:              level, STRING:   status>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:               code, STRING:   NetStream.Publish.Start>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:        description, STRING:   Publishing lyceum-178.>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   Property: <Name:           clientid, NUMBER:   2006351630.00>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   (object end)
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   (object end)
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   HandleInvoke, server invoking <onStatus>
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   HandleInvoke, onStatus: NetStream.Publish.Start
19:40:14  <       majestic> [    rtmp] try_connect@518               Connection to rtmp://nimble.server/openipc/lyceum-178 successful
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=46, ts=0
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=34678, ts=0
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=105, ts=40
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=43, ts=80
19:40:14  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=35, ts=120
19:40:15  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=38, ts=160
19:40:15  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=91, ts=200
19:40:15  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=132, ts=240
19:40:15  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=201, ts=280
19:40:15  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=227, ts=320
19:40:15  <       majestic> [    rtmp] log_rtmp@44                   WriteN, RTMP send error 32 (239 bytes)
19:40:15  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=42, size=37, ts=0
19:40:15  <       majestic> [    rtmp] log_rtmp@44                   WriteN, RTMP send error 32 (45 bytes)
19:40:15  <       majestic> [    rtmp] log_rtmp@44                   RTMP_SendPacket: fd=-1, size=34, ts=0
19:40:15  <       majestic> [    rtmp] log_rtmp@44                   WriteN, RTMP send error 9 (42 bytes)
19:40:15  <       majestic> [rtmp-str] nal_cb@838                    RTMP stream disconnected

https://wmspanel.com/nimble/param?g=rtmp#rtmp_check_stream_id_for_protocol_control_messages

On the server side we see the following answers in the logs

[2023-01-02 19:33:09 P283124-T283139] [rtmp] E: unknown message stream id for VideoMessage, msg_id=0
[2023-01-02 19:33:10 P283124-T283139] [rtmp] E: unknown message stream id for VideoMessage, msg_id=-1
[2023-01-02 19:33:12 P283124-T283139] [rtmp] E: unknown message stream id for VideoMessage, msg_id=-1
[2023-01-02 19:33:13 P283124-T283139] [rtmp] E: unknown message stream id for VideoMessage, msg_id=-1
[2023-01-02 19:33:14 P283124-T283139] [rtmp] E: unknown message stream id for VideoMessage, msg_id=-1
[2023-01-02 19:33:15 P283124-T283139] [rtmp] E: unknown message stream id for VideoMessage, msg_id=-1
[2023-01-02 19:33:16 P283124-T283139] [rtmp] E: unknown message stream id for VideoMessage, msg_id=-1

In my humble opinion, the problem must be found somewhere here

https://rtmp.veriskope.com/docs/spec/#61-rtmp-message-format

widgetii commented 1 year ago

According to RMTP documentation, right URL scheme is rtmp://<IP>:<PORT>/<publishing_point>?<username>&<password>/<stream_name>

Checked with Nimble, it accepts credentials, but anyway it drops subsequent packets for unknown reason. From my perspective, something wrong with stream configuration

widgetii commented 1 year ago

I also suggest trying OBS Studio with RTMP client to publish stream to Nimble server just to ensure that everything set correct on server side

ystinia commented 1 year ago

Good Afternoon.

The server logs now show a change in the problem data

[2023-01-03 10:07:05 P283124-T283139] [rtmp] E: unknown message stream id for VideoMessage, msg_id=-1
[2023-01-03 10:07:07 P283124-T283139] [rtmp] E: unknown message stream id for VideoMessage, msg_id=-1
[2023-01-03 10:07:08 P283124-T283139] [rtmp] E: unknown message stream id for VideoMessage, msg_id=-1
[2023-01-03 10:07:10 P283124-T283139] [rtmp] E: unknown message stream id for VideoMessage, msg_id=-1
[2023-01-03 10:11:52 P283124-T283143] [rtsp] E: unable to parse request line for [UNKNOWN]: GET / HTTP/1.0
[2023-01-03 10:44:00 P283124-T283139] [rtmp] E: [VM] AVC SEQUENCE header is required first for 'openipc/you-stream-name'
[2023-01-03 10:44:01 P283124-T283139] [rtmp] E: [VM] AVC SEQUENCE header is required first for 'openipc/you-stream-name'
[2023-01-03 10:44:01 P283124-T283139] [rtmp] E: [VM] AVC SEQUENCE header is required first for 'openipc/you-stream-name'
[2023-01-03 10:44:01 P283124-T283139] [rtmp] E: [VM] AVC SEQUENCE header is required first for 'openipc/you-stream-name'
[2023-01-03 10:44:01 P283124-T283139] [rtmp] E: [VM] AVC SEQUENCE header is required first for 'openipc/you-stream-name'
[2023-01-03 10:44:01 P283124-T283139] [rtmp] E: [VM] AVC SEQUENCE header is required first for 'openipc/you-stream-name'
[2023-01-03 10:44:01 P283124-T283139] [rtmp] E: [VM] AVC SEQUENCE header is required first for 'openipc/you-stream-name'
[2023-01-03 10:44:01 P283124-T283139] [rtmp] E: [VM] AVC SEQUENCE header is required first for 'openipc/you-stream-name'
widgetii commented 1 year ago

I've found a culprit for unknown message stream id, please check latest Majestic build

Also, it turns out that RTMP authentication never worked before, mea culpa. Right URL scheme is rtmp://login:password@nimble.server/openipc/you-stream-name now. I was able to get real-time stream recently but for now the server always returns PublisherAuth, Authentication failed: wrong password

ystinia commented 1 year ago

So, I am writing a report on the experiments. We're definitely making progress on the solution, but there are still a few problems not where we thought we'd be. All problems remained only in parsing... So, I will give examples of lines from majestic.yaml and show what we get in Nimble I will replace the domain name and the login and password, you know which ones to use for tests

TEST № 1 (we disabled authorization for the test)

Majestic config

outgoing:
  - rtmp://nimble.server/openipc/lyceum-178

This is what the server sees in the queries

D: RtmpStreamBuffer::setMetadata for openipc/lyceum-178/lyceum-178

TEST № 2 (authorized)

Majestic config

outgoing:
  - rtmp://login:password@nimble.server/openipc/lyceum-178

In this case, the server side does not get to check the dogin and password, because the structure is not correct. By the way, in the Majestic diagnostic the APP name also looks strange and contains the name of the stream.

15:40:17  <       majestic> [    rtmp] log_rtmp@46                   Parsing...
15:40:17  <       majestic> [    rtmp] log_rtmp@46                   Parsed protocol: 0
15:40:17  <       majestic> [    rtmp] log_rtmp@46                   Parsed host    : nimble.server
15:40:17  <       majestic> [    rtmp] log_rtmp@46                   Parsed app     : openipc/lyceum-178

TEST № 3 (truncated line)

Majestic config

outgoing:
  - rtmp://login:password@nimble.server/openipc

This is what the server sees in the queries

D: RtmpStreamBuffer::setMetadata for openipc/openipc

Authorization is successful, the stream is broadcast and visible in players.

I think the results of my experiments are clear to you and you will be able to make a structure correction, thank you.

ystinia commented 1 year ago

Good evening

So, it's been two days of testing the OpenIPC and Nimble combination. Everything works quite well and stable, thank you very much. We tested it on two OpenIPC cameras obtained via OpenCollective (Hisilicon hi3518ev200 processor) and one camera with Ingenic t31x processor.

Now I want to be able to specify any stream names. Let me remind you that at the moment stream name is copied from the App name and it is somewhere inside Majestic structure because it is not present in config.

Also, my professor in high school asked if this system can stream audio. At the moment I have not been able to set up the streaming. Is it even possible ?

widgetii commented 1 year ago

Let's go step-by-step and don't mix different probs in single issue because it'll become unmanageable.

Please test new version with added AAC support to RTMP. Tested on Telegram with 48000 sample rate (not sure that others will be supported)

ystinia commented 1 year ago

I understand the requirements, excuse me.

Thank you very much, I will do the audio tests and write the result

widgetii commented 1 year ago

di niente

ystinia commented 1 year ago

Unfortunately, the new version of Majestic was again broken authorization option and there is no way to do tests.

Reports from Nimble server:

[2023-01-06 16:19:54 P315552-T315567] [rtmp] E: publish not authorized for openipc/openipc
[2023-01-06 16:20:47 P315552-T315567] [rtmp] E: publish not authorized for openipc/openipc
[2023-01-06 16:21:11 P315552-T315567] [rtmp] E: publish not authorized for openipc/openipc
[2023-01-06 16:27:11 P315552-T315567] [rtmp] E: publish not authorized for openipc/openipc

Majestic logs:

16:29:37  <       majestic> [    rtmp] try_connect@246               Connecting to RTMP URL rtmp://nimble.server/openipc...
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Parsing...
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Parsed protocol: 0
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Parsed host    : nimble.server
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Parsed app     : openipc
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   RTMP_Connect1, ... connected, handshaking
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   HandShake: Type Answer   : 03
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   HandShake: Server Uptime : 0
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   HandShake: FMS Version   : 0.0.0.0
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   HandShake: Handshaking finished....
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   RTMP_Connect1, handshaked
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   RTMP_SendPacket: fd=44, size=4, ts=0
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   RTMP_SendPacket: fd=44, size=148, ts=0
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Invoking connect
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   RTMP_ReadPacket: fd=44
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   HandleServerBW: server BW = 5000000
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   RTMP_ReadPacket: fd=44
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   HandleClientBW: client BW = 5000000 2
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   RTMP_ReadPacket: fd=44
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   HandleCtrl, received ctrl. type: 0, len: 6
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   HandleCtrl, Stream Begin 0
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   RTMP_ReadPacket: fd=44
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   HandleChangeChunkSize, received: chunk size change to 4128750
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   RTMP_ReadPacket: fd=44
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   RTMP_ClientPacket, received: invoke 132 bytes
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   (object begin)
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Property: <Name:           no-name., STRING:   _result>
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Property: <Name:           no-name., NUMBER:   1.00>
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Property: <Name:           no-name., OBJECT>
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   (object begin)
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Property: <Name:             fmsVer, STRING:   Nimble/3.7.12-2>
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   (object end)
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Property: <Name:           no-name., OBJECT>
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   (object begin)
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Property: <Name:              level, STRING:   status>
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Property: <Name:               code, STRING:   NetConnection.Connect.Success>
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Property: <Name:     objectEncoding, NUMBER:   0.00>
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   (object end)
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   (object end)
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   HandleInvoke, server invoking <_result>
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   HandleInvoke, received result for method call <connect>
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   RTMP_SendPacket: fd=44, size=36, ts=0
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Invoking releaseStream
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   RTMP_SendPacket: fd=44, size=32, ts=0
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Invoking FCPublish
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   RTMP_SendPacket: fd=44, size=25, ts=0
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Invoking createStream
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   RTMP_ReadPacket: fd=44
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   RTMP_ClientPacket, received: invoke 139 bytes
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   (object begin)
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Property: <Name:           no-name., STRING:   onFCPublish>
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Property: <Name:           no-name., NUMBER:   0.00>
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Property: NULL
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Property: <Name:           no-name., OBJECT>
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   (object begin)
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Property: <Name:              level, STRING:   status>
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Property: <Name:               code, STRING:   NetStream.Publish.Start>
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Property: <Name:        description, STRING:   FCPublish to stream openipc.>
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Property: <Name:           clientid, NUMBER:   3735928559.00>
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   (object end)
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   (object end)
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   HandleInvoke, server invoking <onFCPublish>
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   RTMP_ReadPacket: fd=44
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   RTMP_ClientPacket, received: invoke 29 bytes
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   (object begin)
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Property: <Name:           no-name., STRING:   _result>
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Property: <Name:           no-name., NUMBER:   4.00>
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Property: NULL
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Property: <Name:           no-name., NUMBER:   1.00>
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   (object end)
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   HandleInvoke, server invoking <_result>
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   HandleInvoke, received result for method call <createStream>
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   RTMP_SendPacket: fd=44, size=37, ts=0
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Invoking publish
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   RTMP_ReadPacket: fd=44
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   RTMPSockBuf_Fill, remote host closed connection
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   RTMP_SendPacket: fd=44, size=34, ts=0
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Invoking FCUnpublish
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   RTMP_SendPacket: fd=44, size=34, ts=0
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   Invoking deleteStream
16:29:37  <       majestic> [    rtmp] log_rtmp@59                   RTMP_ReadPacket, failed to read RTMP packet header
16:29:37  <       majestic> [    rtmp] connect_thread@320            Connection to rtmp://nimble.server/openipc failed: -3

Separately, I want to note that the reconnect connection is not carried out. I think this is not very good in the future to stabilize the work.

ystinia commented 1 year ago

Please test new version with added AAC support to RTMP. Tested on Telegram with 48000 sample rate (not sure that others will be supported)

Thanks A new Issue on this test has been opened - https://github.com/OpenIPC/majestic/issues/93

widgetii commented 1 year ago

RTMP authorization code wasn't touched at all, it is the same as was before

ystinia commented 1 year ago

Unfortunately, there is no authorization and you can see it above. The broadcast has stopped working even with the audio turned off. Apart from updating the firmware nothing has been done.

ystinia commented 1 year ago

I created a test project in my sandbox with Nimble based on Docker container and maybe it will help in our experiments.

Also found a second way to test RTMP streams, an example here