Forum

Rtsp push from Android

MArco 2019-02-18 11:58:23 UTC in Nimble Streamer

Hi, I'm using libstreaming (an open source lib for Android) for RTSP push into Nimble streamer server.
I can send video only for few seconds, then I see offline status in WMS Panel - incoming stream .

in nimble.log file I read this when it disconnect :
[rtsp] E: parse_rtp returns 1
[rtsp] E: rtp_parse_interleaved returns 1

Denis Slobodskoy 2019-02-19 03:40:59 UTC 

Try to capture stream by FFmpeg with command like this:
ffmpeg -rtsp_flags listen -rtsp_transport tcp -i rtsp://<your_ip>:1554/live/stream1 -c copy -f mpegts test.ts
- would it receive stream, and can you play it?
Notice that you should use another port that your set in Nimble (or shutdown nimble while receiving it by FFmpeg)
Is there source or APK available for application you're streaming from?

MArco 2019-02-19 10:02:26 UTC 

yes, it works and I can play test.ts file using vlc.

ffmpeg show only this warning (yellow log) :
[mpegts @ 00000000030d7cc0] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly

I did other tests with nimble and I understood that it's a authentication problem. If I remove user and password from application and global panel in wmspanel all works fine.

I set user and password using digest and nonce in Announce, and Nimble response is 200 (OK) , so maybe after that something goes wrong.

I would try authentication with ffmpeg, it's possible by changing the command that you send me ?

Denis Slobodskoy 2019-02-21 05:42:25 UTC 

Sorry, didn't find any way to make FFmpeg to require password for receiving RTSP stream.
Nimble should support Digest authentication, could you give headers from 401 response for server and subsequent announce with authorization from application?

MArco 2019-02-21 09:06:36 UTC 

This is the announce and responce sequences:
----------------------------------------------------------------------------------------------
ANNOUNCE rtsp://192.168.0.185:554/test/stream RTSP/1.0
CSeq: 1
Content-Length: 257
Content-Type: application/sdp

v=0
o=- 0 0 IN IP4 null
s=Unnamed
i=N/A
c=IN IP4 192.168.0.185
t=0 0
a=recvonly
m=video 5006 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=42000b;sprop-parameter-sets=Z0IAC6aCxOQ=,aM44gA==;
a=control:trackID=1
--------------------------------------------------------------------------------------
responce status 401

{session= yCqX7zLu5MwL0WqYZ7hhD4cPgipvQi9g,
www-authenticate= Digest realm="Nimble/3.5.4-6",
nonce="yCqX7zLu5MwL0WqYZ7hhD4cPgipvQi9g",
cseq= 1, server= Nimble/3.5.4-6}

-----------------------------------------------------------------------------------------------
ANNOUNCE rtsp://192.168.0.185:554/test/stream RTSP/1.0
CSeq: 2
Content-Length: 257
Authorization: Digest username="nexera",realm="Nimble/3.5.4-6",nonce="c2ov7892hWUv7PavAbO9VCR469NbpSft",uri="rtsp://192.168.0.185:554/test/stream",response="fd2ee4fe6c46baf1cff0fefc42307c58"
Session: 2
Content-Type: application/sdp

v=0
o=- 0 0 IN IP4 null
s=Unnamed
i=N/A
c=IN IP4 192.168.0.185
t=0 0
a=recvonly
m=video 5006 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=42000b;sprop-parameter-sets=Z0IAC6aCxOQ=,aM44gA==;
a=control:trackID=1
--------------------------------------------------------------------------------------------
Responce status 200
{session= c2ov7892hWUv7PavAbO9VCR469NbpSft,
cseq= 2,
server= Nimble/3.5.4-6}

Denis Slobodskoy 2019-02-22 08:38:23 UTC 

That seems correct, so what goes wrong after that - are subsequent SETUP and REQUEST includes same authentication, and what is Nimble's repsonse to it? What moment it start to go wrong?

MArco 2019-02-22 09:09:56 UTC 

rtsp communication seems to be right, I don't know why nimble after few seconds stop the stream. I can see offline in wms panel and outgoing stream doesn't works, but my android app still send tcp packet to socket.

I set nimble log to debug level but only log that I can see is in my first post.

this is all rtsp communication, you can see teardown becouse I stop manually from Android app the stream:

ANNOUNCE rtsp://192.168.0.185:554/test/stream RTSP/1.0
CSeq: 1
Content-Length: 257
Content-Type: application/sdp

v=0
o=- 0 0 IN IP4 null
s=Unnamed
i=N/A
c=IN IP4 192.168.0.185
t=0 0
a=recvonly
m=video 5006 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=42000b;sprop-parameter-sets=Z0IAC6aCxOQ=,aM44gA==;
a=control:trackID=1

RTSP/1.0 401 Unauthorized
CSeq: 1
Server: Nimble/3.5.4-6
WWW-Authenticate: Digest realm="Nimble/3.5.4-6", nonce="xyD1gS2hEnMs48tDFuPfriNTqQMwzl2Y"
Session: xyD1gS2hEnMs48tDFuPfriNTqQMwzl2Y

ANNOUNCE rtsp://192.168.0.185:554/test/stream RTSP/1.0
CSeq: 2
Content-Length: 257
Authorization: Digest username="nexera",realm="Nimble/3.5.4-6",nonce="xyD1gS2hEnMs48tDFuPfriNTqQMwzl2Y",uri="rtsp://192.168.0.185:554/test/stream",response="06914110e9146539a0bb994da199b04e"
Session: 1
Content-Type: application/sdp

v=0
o=- 0 0 IN IP4 null
s=Unnamed
i=N/A
c=IN IP4 192.168.0.185
t=0 0
a=recvonly
m=video 5006 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=42000b;sprop-parameter-sets=Z0IAC6aCxOQ=,aM44gA==;
a=control:trackID=1

RTSP/1.0 200 OK
CSeq: 2
Server: Nimble/3.5.4-6
Session: xyD1gS2hEnMs48tDFuPfriNTqQMwzl2Y

SETUP rtsp://192.168.0.185:554/test/stream/trackID=1 RTSP/1.0
Transport: RTP/AVP/TCP;unicast;mode=record;interleaved=2-3
CSeq: 3
Content-Length: 0
Session: 1
Authorization: Digest username="nexera",realm="Nimble/3.5.4-6",nonce="xyD1gS2hEnMs48tDFuPfriNTqQMwzl2Y",uri="rtsp://192.168.0.185:554/test/stream",response="06914110e9146539a0bb994da199b04e"

RTSP/1.0 200 OK
CSeq: 3
Server: Nimble/3.5.4-6
Transport: RTP/AVP/TCP;unicast;interleaved=2-3;mode=record
Session: xyD1gS2hEnMs48tDFuPfriNTqQMwzl2Y

RECORD rtsp://192.168.0.185:554/test/stream RTSP/1.0
Range: npt=0.000-
CSeq: 4
Content-Length: 0
Session: 1
Authorization: Digest username="nexera",realm="Nimble/3.5.4-6",nonce="xyD1gS2hEnMs48tDFuPfriNTqQMwzl2Y",uri="rtsp://192.168.0.185:554/test/stream",response="06914110e9146539a0bb994da199b04e"

RTSP/1.0 200 OK
CSeq: 4
Server: Nimble/3.5.4-6
Session: xyD1gS2hEnMs48tDFuPfriNTqQMwzl2Y

TCP packet here........

TEARDOWN rtsp://192.168.0.185:554/test/stream RTSP/1.0
CSeq: 5
Content-Length: 0
Session: 1
Authorization: Digest username="nexera",realm="Nimble/3.5.4-6",nonce="xyD1gS2hEnMs48tDFuPfriNTqQMwzl2Y",uri="rtsp://192.168.0.185:554/test/stream",response="06914110e9146539a0bb994da199b04e"

Denis Slobodskoy 2019-02-22 10:20:13 UTC 

It's weird why it work without authentication - I can believe your application sends something that Nimble doesn't understand, but how it many depend on authorization?
Anyway, I suppose we should try to reproduce it on our side - please submit support ticket on https://wmspanel.com/help and describe your case; if possible, provide link to APK or Android Studio project.

tommyshelby 2019-03-14 10:55:35 UTC 

I want to ask that is this possible to have the success of the module from the ios device as well. From Android, it is working but it should work on ios also. I have also asked https://itunessupport.org/blog/fix-itunes-error-9/

Post a reply


Post a new question

Categories:

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the Privacy Policy. If you want to know more or withdraw your consent to all or some of the cookies, please refer to the Privacy Policy.
By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to the use of cookies.