Coder Social home page Coder Social logo

rtsp-server's People

Contributors

cleancoderob avatar constambeys avatar gushangzao007 avatar pedrosg94 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rtsp-server's Issues

How to crop video while streaming....?

Hi Pedro,
I'm using surfaceview to streaming video,
I need to crop perticullar region
ex.Only half of the screen needs to crop while streaming....
what changes should I need to do please help.....!
I Used RtspServerCamera class....
I dont wanted to use setZoom function from Camera2ApiManager...

How to zoom video while streaming....?

Hi Pedro,
Currently I'm able to zoom live video using following class Camera1ApiManager and method named as
start (){
camera.startSmoothZoom(10);
}

But I wanted to zoom video automatically using rtsp url when I receive input request in RtspServer.kt class then video should start zooming automatically.....
Please help me.....

How to show video preview on two separate SurfaceView...?

Hi Pedro,
Thank you for huge response...
I'm trying to get two video preview using surfaceview
I have used

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal">

    <SurfaceView
        android:layout_weight="1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/surfaceVw"/>

    <SurfaceView
        android:layout_weight="1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/surfaceView2"/>

</LinearLayout>

when I start application only left side surfaceview shows the camera preview and right side shows only black screen....

Please help and guide me how to achieve it....

Is this a 'media server'?

I'm using rtmp-rtsp-stream-client-java and it needs a media server. Is that the purpose of this library?

If not, my intention is to make an android device work as an IP camera (everything built-in locally), would you please give me some suggestions on how to do it with your library? Many thanks.

I wanted to crop the region of the stream using camera1... Please Please help....

Hi Pedro,
I wanted to crop the only left region of the stream using camera1...
please tell me how to use YUVCrop function...

I used below function on VideoEncoder... width 640 and height 480
but I don't know how to pass destination values in crop yuv....

@OverRide
protected Frame getInputFrame() throws InterruptedException {
Frame frame = queue.take();
// if (fpsLimiter.limitFPS()) return getInputFrame();
byte[] buffer = frame.getBuffer();
boolean isYV12 = frame.getFormat() == ImageFormat.YV12;
buffer = isYV12 ? YUVUtil.YV12toYUV420byColor(buffer, width, height,
formatVideoEncoder)
: YUVUtil.NV21toYUV420byColor(buffer, width, height, formatVideoEncoder);

      buffer = YUVUtil.CropYuv
     (MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420SemiPlanar,
       buffer,width,height,width/2,height/2);

frame.setBuffer(buffer);
return frame;

}

It gives arrayoutofbound exception error when I pass destination width and height...
Please Please help....

Slow Camera Feed

Hey,

Firstly thanks so much for sharing this project - really appreciate the effort!

Is it possible to modify the camera settings? When I run the server app on a Galaxy S9 for example it runs super well (very little buffering needed) on the client side (using VLC for example). However when I try run this on our dev kit the camera feed is "sticky" i.e. capturing a few frames per second possibly? This hence ripples through to the client playing the stream and only shows the 1st frame and that's it. The audio works perfectly whilst the stream is "frozen". I dont see this as a GPU/CPU issue as the SC66 runs really well.
Even running this ad hoc (wifi hotspot) it does the same so imo definitely a camera issue. I will try an external USB camera shortly.

WhatsApp Image 2020-06-05 at 11 52 41

What should I do if I want to edit image before encoding?

If I want to do as follows, what should I do?

  1. Open FRONT and BACK cameras at the same time
    2.get preview Images of 2 cameras from ImageReader
    3.mix images from 2 cameras
    4.encoding and sending

If you have any suggestion, tell me please, thank you

SocketException: Connection reset

Hi, I have an special player where I put the rtsp path to play the streaming created by de this app but after a few minutes the connection is broken with no sense, the error is this:

E/Client: Client disconnected
java.net.SocketException: Connection reset
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:121)
at java.net.SocketOutputStream.write(SocketOutputStream.java:161)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295)
at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
at java.io.BufferedWriter.flush(BufferedWriter.java:254)
at com.pedro.rtspserver.ServerClient.run(ServerClient.kt:57)
E/RtspSender: send error:
java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:117)
at java.net.SocketOutputStream.write(SocketOutputStream.java:149)
at com.pedro.rtsp.rtp.sockets.RtpSocketTcp.sendFrameTCP(RtpSocketTcp.kt:35)
at com.pedro.rtsp.rtp.sockets.RtpSocketTcp.sendFrame(RtpSocketTcp.kt:23)
at com.pedro.rtsp.rtsp.RtspSender$start$$inlined$let$lambda$1.run(RtspSender.kt:118)
at android.os.Handler.handleCallback(Handler.java:900)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:219)
at android.os.HandlerThread.run(HandlerThread.java:67)
I/RtspSender: Skipping iteration, frame null
E/RtspServer: Error
java.net.SocketException: Socket closed
at java.net.PlainSocketImpl.socketAccept(PlainSocketImpl.java:213)
at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:451)
at java.net.ServerSocket.implAccept(ServerSocket.java:547)
at java.net.ServerSocket.accept(ServerSocket.java:515)
at com.pedro.rtspserver.RtspServer$startServer$1.run(RtspServer.kt:45)
at java.lang.Thread.run(Thread.java:929)
I/RtspServer: Server finished
I/HwAudioRecordImpl: sendStateChangedIntent, state=1
I/HwAudioRecordImpl: sendStateChangedIntent, state=1
I/MicrophoneManager: Microphone stopped
I/VideoEncoder: stopped
W/ACodec: forcing OMX state to Idle when received shutdown in ExecutingState

could you help me to figure it out?, please

E/ServerCommandManager: cSeq not found

I am trying to play rstp, but I got this error: I know the issue is with this "rstpserver" since I am using other sources from ipcameras and it works. So the issue is with this rstp server.

E/ServerCommandManager: cSeq not found

2020-05-06 16:01:46.739 22855-23519/com.pedro.sample W/Client: New client 192.168.1.14
2020-05-06 16:01:46.756 22855-23519/com.pedro.sample E/ServerCommandManager: cSeq not found
2020-05-06 16:01:46.759 22855-23519/com.pedro.sample E/ServerCommandManager: cSeq not found
2020-05-06 16:01:46.763 22855-23519/com.pedro.sample E/Client: Client disconnected
java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:117)
at java.net.SocketOutputStream.write(SocketOutputStream.java:161)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295)
at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
at java.io.BufferedWriter.flush(BufferedWriter.java:254)
at com.pedro.rtspserver.RtspServer$Client.run(RtspServer.kt:138)

request:
DESCRIBE rtsp://192.168.1.6:1935 RTSP/1.0
User-Agent: WMPlayer/12.00.18362.0778 guid/3300AD50-2C39-46C0-AE0A-DB5E646C29AD
Accept: application/sdp
Accept-Charset: UTF-8, *;q=0.1
X-Accept-Authentication: Negotiate, NTLM, Digest
Accept-Language: en-us, *;q=0.1
X-Accept-Proxy-Authentication: Negotiate, NTLM, Digest
CSeq: 1
Supported: com.microsoft.wm.srvppair, com.microsoft.wm.sswitch, com.microsoft.wm.eosmsg, com.microsoft.wm.fastcache, com.microsoft.wm.locid, com.microsoft.wm.rtp.asf, dlna.announce, dlna.rtx, dlna.rtx-dup, com.microsoft.wm.startupprofile

Second: empty request
third has value
...

First has the content shown above, then the second request is empty then it has value and so on.

Do you know what could be causing this?

How to use auth?

I notice this isn't implemented

override fun setAuthorization(user: String, password: String) { //not developed
}

How would you recommend do this? thanks

Error while using Camera2Base

the codes are:
camera2Base.prepareVideo();
and then
camera2Base.startStream(url);
but I come up with NPE, the reason is audioEncoder.codec is null for I don't prepare audio,
Must I prepare both video and audio?

After I prepared audio, there's another problem:
java.lang.IllegalStateException: startRecording() called on an uninitialized AudioRecord.

How to solve it?

It is possible to access through Ethernet

Hi
I have a Samsung galaxy s9 that connects to the internet through an ethernet adapter when I start the rstp server it doesnt work and it shows ip 0.0.0.0 although the phone has an IP and I can browse the internet, if I turn on the wifi it works.

RTSP will not start when client required video stream only (without audio).

RTSP server 1.0.0, rtplibrary 1.9.5.

   CSeq: 2
    User-Agent: LIVE555 Streaming Media v2016.02.09
    Accept: application/sdp
2021-02-16 13:08:34.951 7712-8013/application I/Client: RTSP/1.0 200 OK
    Server: pedroSG94 Server
    Cseq: 2
    Content-Length: 463
    Content-Base: 192.168.66.120:2086/
    Content-Type: application/sdp
    
    v=0
    o=- 0 0 IN IP4 192.168.66.120
    s=Unnamed
    i=N/A
    c=IN IP4 192.168.3.175
    t=0 0
    a=recvonly
    m=audio 0 RTP/AVP 96
    a=rtpmap:96 MPEG4-GENERIC/44100/2
    a=fmtp:96 streamtype=5; profile-level-id=15; mode=AAC-hbr; config=1210; SizeLength=13; IndexLength=3; IndexDeltaLength=3;
    a=control:trackID=0
    m=video 0 RTP/AVP 96
    a=rtpmap:96 H264/90000
    a=fmtp:96 packetization-mode=1;sprop-parameter-sets=J0IAH41oC0ChoQAAAwABAAADAB4PEHqA,KM4ySA==;
    a=control:trackID=1
2021-02-16 13:08:34.960 7712-8013/application  I/Client: SETUP 192.168.66.120:2086/trackID=1 RTSP/1.0
    CSeq: 3
    User-Agent: LIVE555 Streaming Media v2016.02.09
    Transport: RTP/AVP;unicast;client_port=45244-45245
2021-02-16 13:08:34.963 7712-8013/application  I/ServerCommandManager: Video ports: [45244, 45245]
2021-02-16 13:08:34.963 7712-8013/application  I/ServerCommandManager: Audio ports: []
2021-02-16 13:08:34.964 7712-8013/application l I/ServerCommandManager: Video ports: [45244, 45245]
2021-02-16 13:08:34.964 7712-8013/application  I/ServerCommandManager: Audio ports: []
2021-02-16 13:08:34.965 7712-8013/application  I/Client: RTSP/1.0 200 OK
    Server: pedroSG94 Server
    Cseq: 3
    Content-Length: 0
    Transport: RTP/AVP/UDP;unicast;destination=192.168.3.175;client_port=8000-8001;server_port=39000-35968;mode=play
    Session: 1185d20035702ca
    Cache-Control: no-cache
2021-02-16 13:08:34.977 7712-8013/application  I/Client: PLAY 192.168.66.120:2086/ RTSP/1.0
    CSeq: 4
    User-Agent: LIVE555 Streaming Media v2016.02.09
    Session: 1185d20035702ca
    Range: npt=0.000-
2021-02-16 13:08:34.977 7712-8013/application  I/Client: RTSP/1.0 200 OK
    Server: pedroSG94 Server
    Cseq: 4
    Content-Length: 0
    RTP-Info: url=rtsp://192.168.66.120:2086/
    Session: 1185d20035702ca

Solution:
In RtspServer.kt two lines was added:


          if (action.contains("play", true)) {
            Log.i(TAG, "Protocol ${commandsManager.protocol}")
            rtspSender.setSocketsInfo(commandsManager.protocol, commandsManager.videoClientPorts,
              commandsManager.audioClientPorts)
            rtspSender.setVideoInfo(commandsManager.sps, commandsManager.pps, commandsManager.vps)
+            if(commandsManager.audioPorts.size > 0)
              rtspSender.setAudioInfo(sampleRate)
            rtspSender.setDataStream(socket.getOutputStream(), commandsManager.clientIp)
            if (commandsManager.protocol == Protocol.UDP) {
              rtspSender.setVideoPorts(commandsManager.videoPorts[0], commandsManager.videoPorts[1])
+              if(commandsManager.audioPorts.size > 0)
                rtspSender.setAudioPorts(commandsManager.audioPorts[0], commandsManager.audioPorts[1])
            }
            rtspSender.start()
            canSend = true
          }

After about a minute, the audio stream will stop

I found this library very useful and solved a lot of my problems.
I am experiencing problems with audio playback stopping.

I am using ‘RtspServerDisplay.prepareAudio()’ and ‘RtspServerDisplay.prepareVideo()’ to play with ‘ffplay’ on another device, is my parameter setting incorrect?

thank you very much.

Not able to Crop video frame using CropYuv....? Please help...!

Hi Pedro,
As you told on your last reply frame cropping can be done on Video Encoder

https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/blob/master/encoder/src/main/java/com/pedro/encoder/input/video/Camera1ApiManager.java#L264.

I do make following changes in VideoEncoder
on

getInputFrame
{
buffer = isYV12 ? YUVUtil.YV12toYUV420byColor(buffer, width, height, formatVideoEncoder)
: YUVUtil.NV21toYUV420byColor(buffer, width, height, formatVideoEncoder);

  buffer = **YUVUtil.CropYuv(MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420SemiPlanar,buffer,width,height,600,400);**

}

My camera resolution is 640*480
but still no frame cropping effect has been found....

Please Please help...

Need help regarding h265 video encode....!

Hi,
I'm new in RTSP server application I'm able to connect,stream and record video into h264 video encode format but I need to record video into h265 video encode format.
I'm new in kotlin and I don't understand when this method should I use so I can set video codec to H265 after recording the video....

fun setVideoCodec(videoCodec: VideoCodec) {
videoEncoder.type =
if (videoCodec == VideoCodec.H265) CodecUtil.H265_MIME else CodecUtil.H264_MIME
}

Please help.......!

The demo not working....!

Hi Pedro...

After running above updated demo

==================================================================

Error 1 :- When clicked on Start Server it shows
Log :-
2020-03-20 11:05:31.686 13582-14237/com.pedro.sample E/ServerCommandManager: cSeq not found
2020-03-20 11:05:31.687 13582-14237/com.pedro.sample E/Client: Client disconnected
java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:117)
at java.net.SocketOutputStream.write(SocketOutputStream.java:161)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295)
at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
at java.io.BufferedWriter.flush(BufferedWriter.java:254)
at com.pedro.rtspserver.RtspServer$Client.run(RtspServer.kt:137)

Error 2 :- When I Clicked on Start Record then it shows

EACCSS permission denied even when I Already checked all permissions as granted...

Please help.....

ERROR: Failed to resolve:

why is the prompt ERROR: Failed to resolve: com.github.pedroSG94.RTSP-Server:1.0.6:
Affected Modules: app???

Playing over mobile hotspot

Hi there, firstly thanks so much for contribution, it works well.

What we require is having the RTSP server running on the same device that creates the wifi network. Kind of like a GoPro for example, where the users mobile phone will join the wifi network created by the device.
When we create the mobile hotspot and run the RTSP Server from that device, the client (VLC for now, on windows) connects to this network however the playback doesn't work unless we both connect through an actual router. Is this possible?

How to reduce the time delay

There's a time delay of about 1-2 seconds, is there any way to reduce it?
I tried a web camera with almost no video delay at all, perhaps less than 200ms, it's also by RTSP.

How to properly set the video size?

The demo app resolution is 640x480. How is the default being set?
I was reading and old issue on setting the video size and you recommended this

rtspServerCamera1?.prepareVideo(1920, 1080, 24, 5000 * 1024, 0, 320)

I set this in the onCreate() right after

rtspServerCamera1 = RtspServerCamera2(surfaceView, this, 1234)

No matter what resolution i set it in the prepareVideo() it always default back to 640x480.

I then changed the rtspServerCamera1 to rtspServerCamera2 and with the same call

rtspServerCamera2?.prepareVideo(1920, 1080, 24, 5000 * 1024, 0, 320)

The resolution appears to work for up to 1280 x 720 but i can never get 1080p.

Can you please tell me how to properly set the video size? I'm using vlc on the desktop to test the server.

thank you.

Change the resolution width and height

Hi @pedroSG94 ,
In my case, i start the server in mobile with
if (rtspServerDisplay.prepareVideo() && rtspServerDisplay.prepareAudio()){ rtspServerDisplay.startStream() }
so how can i adjust the video solution, due to my client request?

Please help

Video Frames getting disturbances or not clear while opening the rtsp link through VLC

I am using the RTSP server inside my application and after starting the server i can see that there is a lot of distortion/disturbances in the frames from the rtsp link when i am opening it from the VLC Player.

### Frames are breaking and hence there is a disturbances in the video that is appearing.

Please help me with the probable solution for this issue and why is this happening???

Thank you in advance.

loss latest frame

I implemented the rtsp display server to stream my screen. I disable the sound also. But i lose some frame. Tested with VLC the latest frame does not update until i doing something in my android screen.

Set the protocol to UDP

How can the protocol be set to UDP (I think it is TCP by default if I am right)? I set the commandsManager's protocol to UDP as shown below (in ServerClient.kt) but I am not sure if it works because Android Studio is not stopping at this line when I put a breakpoint:

  init {
    commandsManager.videoDisabled = videoDisabled
    commandsManager.audioDisabled = audioDisabled
    commandsManager.isStereo = isStereo
    commandsManager.sampleRate = sampleRate
    commandsManager.setVideoInfo(sps, pps, vps)
    commandsManager.setAuth(user, password)
    commandsManager.protocol = Protocol.UDP
  }

How to rotate the display window on PC?

Hi, I can receive the streaming video on a PC using VLC or GStreamer but the display window is always vertical. How can I make the display window horizontal? Thanks.

rtsp stream working in VLC Mobile, but not working in VLC Mac and Windows

Trying to broadcast video from my device. It works perfectly on VLC Mobile, but not work in VLC Win or Mac.
It says:

[00007fdc40e45e10] live555 demux error: Failed to connect with rtsp://192.168.1.68:8081
[00007fdc40e1bb60] satip stream error: Failed to connect to RTSP server 192.168.1.68:8081
[00007fdc40e1bb60] access_realrtsp stream error: cannot connect to 192.168.1.68:8081

Any ideas what could be wrong? Maybe need to send some specific headers? Or change any parameters. Already broke my brain :(

Multiple client reconnections cause the library to crash

Multiple client reconnections cause the library to crash after about 5-20 minutes of running the program. Reconnections occur approximately every 5 seconds. I can guess that under normal conditions (rare connections/reconnections) this error will not occur.

in short:

E/AndroidRuntime: FATAL EXCEPTION: BaseEncoder
    Process: ru.dukess.accesscontrolterminal, PID: 13490
    java.util.ConcurrentModificationException
        at java.util.ArrayList$Itr.next(ArrayList.java:831)
        at com.pedro.rtspserver.RtspServer.sendAudio(RtspServer.kt:229)
        at com.pedro.rtspserver.RtspServerCamera1.getAacDataRtp(RtspServerCamera1.kt:79)

bigger log:

I/RtspServer: Server started 172.16.190.251:2086
I/Client: New client 192.168.3.175
I/Client: OPTIONS rtsp://172.16.190.251:2086/ RTSP/1.0
    CSeq: 1
    User-Agent: RtspClientSharp
    RTSP/1.0 200 OK
    Server: pedroSG94 Server
    Cseq: 1
    Public: DESCRIBE,SETUP,TEARDOWN,PLAY,PAUSE
I/Client: DESCRIBE rtsp://172.16.190.251:2086/ RTSP/1.0
    CSeq: 2
    User-Agent: RtspClientSharp
    Accept: application/sdp
    RTSP/1.0 200 OK
    Server: pedroSG94 Server
    Cseq: 2
    Content-Length: 463
    Content-Base: 172.16.190.251:2086/
    Content-Type: application/sdp
    
    v=0
    o=- 0 0 IN IP4 172.16.190.251
    s=Unnamed
    i=N/A
    c=IN IP4 192.168.3.175
    t=0 0
    a=recvonly
    m=audio 0 RTP/AVP 97
    a=rtpmap:97 MPEG4-GENERIC/44100/2
    a=fmtp:97 streamtype=5; profile-level-id=15; mode=AAC-hbr; config=1210; SizeLength=13; IndexLength=3; IndexDeltaLength=3;
    a=control:trackID=1
    m=video 0 RTP/AVP 96
    a=rtpmap:96 H264/90000
    a=fmtp:96 packetization-mode=1; sprop-parameter-sets=J0IAH41oC0ChoQAAAwABAAADAB4PEHqA,KM4ySA==;
    a=control:trackID=0
E/ServerCommandManager: cSeq not found
E/ServerCommandManager: cSeq not found
    cSeq not found
E/Client: Client disconnected
    java.net.SocketException: Broken pipe
        at java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:112)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:157)
        at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
        at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
        at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295)
        at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
        at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
        at java.io.BufferedWriter.flush(BufferedWriter.java:254)
        at com.pedro.rtspserver.RtspServer$Client.run(RtspServer.kt:172)
....

I/RtspServer: Server started 172.16.190.251:2086
E/AndroidRuntime: FATAL EXCEPTION: BaseEncoder
    Process: ru.dukess.accesscontrolterminal, PID: 32560
    java.util.ConcurrentModificationException
        at java.util.ArrayList$Itr.next(ArrayList.java:831)
        at com.pedro.rtspserver.RtspServer.sendAudio(RtspServer.kt:229)
        at com.pedro.rtspserver.RtspServerCamera1.getAacDataRtp(RtspServerCamera1.kt:79)
        at com.pedro.rtplibrary.base.Camera1Base.getAacData(Camera1Base.java:818)
        at com.pedro.encoder.audio.AudioEncoder.sendBuffer(AudioEncoder.java:117)
        at com.pedro.encoder.BaseEncoder.processOutput(BaseEncoder.java:175)
        at com.pedro.encoder.BaseEncoder.outputAvailable(BaseEncoder.java:208)
        at com.pedro.encoder.BaseEncoder$2.onOutputBufferAvailable(BaseEncoder.java:227)
        at android.media.MediaCodec$EventHandler.handleCallback(MediaCodec.java:1664)
        at android.media.MediaCodec$EventHandler.handleMessage(MediaCodec.java:1611)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.os.HandlerThread.run(HandlerThread.java:61)
I/Client: New client 192.168.3.175
I/Client: OPTIONS rtsp://172.16.190.251:2086/ RTSP/1.0
    CSeq: 1
    User-Agent: RtspClientSharp
    RTSP/1.0 200 OK
    Server: pedroSG94 Server
    Cseq: 1
    Public: DESCRIBE,SETUP,TEARDOWN,PLAY,PAUSE
I/Client: DESCRIBE rtsp://172.16.190.251:2086/ RTSP/1.0
    CSeq: 2
    User-Agent: RtspClientSharp
    Accept: application/sdp
I/Client: RTSP/1.0 200 OK
    Server: pedroSG94 Server
    Cseq: 2
    Content-Length: 463
    Content-Base: 172.16.190.251:2086/
    Content-Type: application/sdp
    
    v=0
    o=- 0 0 IN IP4 172.16.190.251
    s=Unnamed
    i=N/A
    c=IN IP4 192.168.3.175
    t=0 0
    a=recvonly
    m=audio 0 RTP/AVP 97
    a=rtpmap:97 MPEG4-GENERIC/44100/2
    a=fmtp:97 streamtype=5; profile-level-id=15; mode=AAC-hbr; config=1210; SizeLength=13; IndexLength=3; IndexDeltaLength=3;
    a=control:trackID=1
    m=video 0 RTP/AVP 96
    a=rtpmap:96 H264/90000
    a=fmtp:96 packetization-mode=1; sprop-parameter-sets=J0IAH41oC0ChoQAAAwABAAADAB4PEHqA,KM4ySA==;
    a=control:trackID=0
E/ServerCommandManager: cSeq not found
E/ServerCommandManager: cSeq not found
E/Client: Client disconnected
    java.net.SocketException: Broken pipe
        at java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:112)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:157)
        at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
        at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
        at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295)
        at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
        at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
        at java.io.BufferedWriter.flush(BufferedWriter.java:254)
        at com.pedro.rtspserver.RtspServer$Client.run(RtspServer.kt:172)
D/accessControlTerminal: surfaceDestroyed
    RTSP server: stopStream
E/RtspServer: Error
    java.net.SocketException: Socket closed
        at java.net.PlainSocketImpl.socketAccept(Native Method)
        at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:389)
        at java.net.ServerSocket.implAccept(ServerSocket.java:531)
        at java.net.ServerSocket.accept(ServerSocket.java:499)
        at com.pedro.rtspserver.RtspServer$startServer$1.run(RtspServer.kt:45)
        at java.lang.Thread.run(Thread.java:761)
I/RtspServer: Server finished
I/MicrophoneManager: Microphone stopped
I/VideoEncoder: stopped
I/AudioEncoder: stopped
I/Choreographer: Skipped 57 frames!  The application may be doing too much work on its main thread.


Could not find com.github.pedroSG94.RTSP-Server:1.0.8

Not sure what is going on. I got this error in my demo project

Execution failed for task ':app:checkDebugAarMetadata'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.github.pedroSG94.RTSP-Server:1.0.8:.
Required by:
project :app

allprojects {
repositories {
jcenter()
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}

dependencies {
implementation 'com.github.pedroSG94.RTSP-Server:1.0.8'
implementation 'com.github.pedroSG94.rtmp-rtsp-stream-client-java:rtplibrary:2.0.2'
}

Video Encoder issue....Please help...!

Hi Pedro...
When I wanted to use RtspServerCamera2 class but after changing all the details with RtspServerCamera1 into RtspServerCamera2 then I got following error
Please Please Please help.....

This is my log...

Process: com.pedro.rtpstreamer, PID: 8827
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.media.MediaCodec.setCallback(android.media.MediaCodec$Callback, android.os.Handler)' on a null object reference
    at com.pedro.encoder.video.VideoEncoder.start(VideoEncoder.java:158)
    at com.pedro.encoder.BaseEncoder.start(BaseEncoder.java:25)
    at com.pedro.rtplibrary.base.Camera2Base.startEncoders(Camera2Base.java:428)
    at com.pedro.rtplibrary.base.Camera2Base.startStream(Camera2Base.java:419)
    at com.pedro.rtspserver.RtspServerCamera2.startStream(RtspServerCamera2.kt:52)
    at com.pedro.rtpstreamer.Camera2DemoActivity.onClick(Camera2DemoActivity.kt:133)
    at android.view.View.performClick(View.java:7259)
    at android.view.View.performClickInternal(View.java:7236)
    at android.view.View.access$3600(View.java:801)
    at android.view.View$PerformClick.run(View.java:27892)
    at android.os.Handler.handleCallback(Handler.java:883)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7356)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:491)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

Request to mark "open" classes and methods

Hello.
sorry if I repeat the request already made in the past.
The final modifier mark classes and methods as not allowed to be overridden and In Kotlin this is the default.
I cannot override your classes.
you may want to consider marking your classes with "open"

Licence question

Hi there
What Licence is your software released under - MIT, Apache or BSD ?

Thanks
Roger
(co-author of the NodeJS RTSP Client library called Yellowstone)
(co-author of the Raspberry Pi ONVIF Library (called RPOS)
(co-author of Sharp RTSP C# library)

How to send commands from VLC player to mobile device...

Hi Pedro,
I want to zoom camera from vlc player while streaming.
I'm new in kotlin developement
I'm not able to understand how ServerCommandManager.kt file or commands will work while streaming live video....
And I wants to know what should I need to do to control mobile app camera using commands from vlc player.....

Please help.....!

Error send packet, Connection reset

When the server is running for sometime I get this error message.

"Error send packet, Connection reset"

Do you know what is the cause and how to automatically restart the server?

I'm running the server on a mobile network and not wifi.

Thanks

Stream frames mixing issues while streaming two rtsp servers....

Hi,
My device supports two camera preview at same time (front and back)
I made following changes with different names

  1. Created another RtspServerCamera class
  2. Created another Camera1Base class to open front camera
  3. Created another RtspServer with different port number

When I click on start stream It does show two camera preview
when I entered rtsp with different port url into vlc media player / browser it starts streaming but mixes the the video data and shows output like front and back camera data stream into one url...
Don't know how to fix issues
Please help......

Recording keeps stops..... Please Help.....!

Hi Pedro,
The above application is working smoothly but I'm facing issues when I click on start streaming video streams well on VLC player but while streaming when I Click on the Start Record then I got the following error....Please help...

Log.....

2020-03-21 12:29:04.140 13398-13609/com.pedro.rtpstreamer E/AndroidRuntime: FATAL EXCEPTION: Thread-5
Process: com.pedro.rtpstreamer, PID: 13398
java.net.BindException: bind failed: EADDRINUSE (Address already in use)
at libcore.io.IoBridge.bind(IoBridge.java:109)
at java.net.PlainSocketImpl.socketBind(PlainSocketImpl.java:162)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:427)
at java.net.ServerSocket.bind(ServerSocket.java:377)
at java.net.ServerSocket.(ServerSocket.java:237)
at java.net.ServerSocket.(ServerSocket.java:128)
at com.pedro.rtspserver.RtspServer$startServer$1.run(RtspServer.kt:46)
at java.lang.Thread.run(Thread.java:919)
Caused by: android.system.ErrnoException: bind failed: EADDRINUSE (Address already in use)
at libcore.io.Linux.bind(Native Method)
at libcore.io.ForwardingOs.bind(ForwardingOs.java:75)
at libcore.io.ForwardingOs.bind(ForwardingOs.java:75)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.