Rtsp stream and video
@microkatz is already working on this.
Since Oct 26, 2023.
- Dominant language
- Java
- Stars
- 3k
- Forks
- 955
- Avg merge
- 12d 14h
- Merged PRs (30d)
- 2
Description
I am working on media3 exoplayer to play video streaming and play record video. Both feature play from rtsp url and I am having 2 issues:
- When play video stream it only play for 2-3 seconds then it will freeze.
- Can't play video record, it had black screen.
I'm using this code
when (item) {
is CamerasAdapter.CameraItem -> {
mediaItem = MediaItem.fromUri(item.cameraUrl)
val rtspMediaSource = RtspMediaSource.Factory().setForceUseRtpTcp(true).createMediaSource(mediaItem)
exoPlayer?.addMediaSource(rtspMediaSource)
}
is EventsAdapter.Event -> {
mediaItem = MediaItem.fromUri(item.eventStreamUrl)
val rtspMediaSource = RtspMediaSource.Factory().createMediaSource(mediaItem)
exoPlayer?.addMediaSource(rtspMediaSource)
}
}
Log from RtspClient
2023-10-22 07:14:26.099 21213-21213 WILD:: com.example.exoplayercodelab D onCreate
2023-10-22 07:14:26.814 21213-21213 WILD:: com.example.exoplayercodelab D onStart
2023-10-22 07:14:27.186 21213-21213 WILD:: com.example.exoplayercodelab D onResume
2023-10-22 07:14:27.191 21213-21213 WILD:: com.example.exoplayercodelab D onResume, init player
2023-10-22 07:14:27.401 21213-21290 WILD:: com.example.exoplayercodelab D handleRtspMessage [RTSP/1.0 200 OK, CSeq: 0, Public: OPTIONS,DESCRIBE,SETUP,PLAY,PAUSE,TEARDOWN,ANNOUNCE,SET_PARAMETER,GET_PARAMETER, ]
2023-10-22 07:14:27.503 21213-21290 WILD:: com.example.exoplayercodelab D handleRtspMessage [RTSP/1.0 401 ClientUnAuthorized, CSeq: 1, WWW-Authenticate: Digest realm="e4f14c5afab9",nonce="aef38450f1a0d2f850cc03f1c8c5d10b", stale="FALSE", ]
2023-10-22 07:14:27.507 21213-21287 WILD:: com.example.exoplayercodelab D handleRtspMessage [RTSP/1.0 200 OK, CSeq: 0, Public: OPTIONS,DESCRIBE,SETUP,PLAY,PAUSE,TEARDOWN,ANNOUNCE,SET_PARAMETER,GET_PARAMETER, ]
2023-10-22 07:14:27.628 21213-21287 WILD:: com.example.exoplayercodelab D handleRtspMessage [RTSP/1.0 401 ClientUnAuthorized, CSeq: 1, WWW-Authenticate: Digest realm="e4f14c5afab9",nonce="9f2ca0a804cf092a68786fe92c0b5695", stale="FALSE", ]
2023-10-22 07:14:27.705 21213-21290 WILD:: com.example.exoplayercodelab D handleRtspMessage [RTSP/1.0 200 OK, CSeq: 2, Content-Base: rtsp://192.168.8.33/media/video1, Content-Length: 508, Content-Type: application/sdp, , v=0
o=- 1001 1 IN IP4 192.168.8.33
s=VCP IPC Realtime stream
m=video 0 RTP/AVP 105
c=IN IP4 192.168.8.33
a=control:rtsp://192.168.8.33/media/video1/video
a=rtpmap:105 H264/90000
a=fmtp:105 profile-level-id=64001f; packetization-mode=1; sprop-parameter-sets=Z2QAH6w7UCgC3QgAAB9AAAOphCA=,aOqPLA==
a=recvonly
m=application 0 RTP/AVP 107
c=IN IP4 192.168.8.33
a=control:rtsp://192.168.8.33/media/video1/metadata
a=rtpmap:107 vnd.onvif.metadata/90000
a=fmtp:107 DecoderTag=h3c-v3 RTCP=0
a=recvonly]
2023-10-22 07:14:28.099 21213-21287 WILD:: com.example.exoplayercodelab D handleRtspMessage [RTSP/1.0 200 OK, CSeq: 2, Content-Base: rtsp://192.168.8.33/media/video1, Content-Length: 508, Content-Type: application/sdp, , v=0
o=- 1001 1 IN IP4 192.168.8.33
s=VCP IPC Realtime stream
m=video 0 RTP/AVP 105
c=IN IP4 192.168.8.33
a=control:rtsp://192.168.8.33/media/video1/video
a=rtpmap:105 H264/90000
a=fmtp:105 profile-level-id=64001f; packetization-mode=1; sprop-parameter-sets=Z2QAH6w7UCgC3QgAAB9AAAOphCA=,aOqPLA==
a=recvonly
m=application 0 RTP/AVP 107
c=IN IP4 192.168.8.33
a=control:rtsp://192.168.8.33/media/video1/metadata
a=rtpmap:107 vnd.onvif.metadata/90000
a=fmtp:107 DecoderTag=h3c-v3 RTCP=0
a=recvonly]
2023-10-22 07:14:28.128 21213-21290 WILD:: com.example.exoplayercodelab D handleRtspMessage [RTSP/1.0 200 OK, CSeq: 3, Transport: RTP/AVP/TCP;unicast;interleaved=0-1;ssrc=dd43b9;mode="PLAY", Session: 495859a4495859a4436859a4495859a;timeout=60, ]
2023-10-22 07:14:28.292 21213-21290 WILD:: com.example.exoplayercodelab D handleRtspMessage [RTSP/1.0 200 OK, CSeq: 4, Range: npt=0Z-, Session: 495859a4495859a4436859a4495859a, ]
2023-10-22 07:14:28.616 21213-21287 WILD:: com.example.exoplayercodelab D handleRtspMessage [RTSP/1.0 200 OK, CSeq: 3, Transport: RTP/AVP/TCP;unicast;interleaved=0-1;ssrc=dd43b9;mode="PLAY", Session: eb3a9336eb3a9336e10a9336eb3a933;timeout=60, ]
2023-10-22 07:14:28.720 21213-21287 WILD:: com.example.exoplayercodelab D handleRtspMessage [RTSP/1.0 200 OK, CSeq: 4, Range: npt=0Z-, Session: eb3a9336eb3a9336e10a9336eb3a933, ]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.