RTSP-Camera-for-Android
RTSP-Camera-for-Android copied to clipboard
Could not get RTSP Server work with VLC
UPDATED
Actually, I am kind of a newbie on android. As I am trying to find an rtsp server implementation for android, I figured out that your work is great! Thank you for sharing it. Now I am trying to adopt it for my project.
I compiled the rtspcamera and upload to samsung galaxy ace (Android 2.3.3). I am basically trying to stream live video from the phone camera. So I tried to run RtspNativeCodecsCamera. It starts good. Once I ask VLC player to connect and play (with URL of "rtsp://192.168.1.5/8080/") but I get nothing played. please help me on this as I probably dont know how to setup applications. logcat report is as follow:
08-12 15:38:11.329: D/RTSPNativeCamera(19306): onCreate 08-12 15:38:11.349: W/dalvikvm(19306): No implementation found for native Lcom/orangelabs/rcs/core/ims/protocol/rtp/codec/video/h264/encoder/NativeH264Encoder;.InitEncoder (III)I 08-12 15:38:11.349: V/[RCS]RtspVideoRecorder: Player error: InitEncoder 08-12 15:38:11.349: D/RTSPNativeCamera(19306): onResume 08-12 15:38:11.349: D/RTSPNativeCamera(19306): RtspServer started 08-12 15:38:12.229: D/RTSPNativeCamera(19306): surfaceCreated 08-12 15:38:12.229: D/RTSPNativeCamera(19306): surfaceChanged 08-12 15:38:12.229: D/RTSPNativeCamera(19306): initializePreview 08-12 15:38:12.249: D/RTSPNativeCamera(19306): startPreview 08-12 15:38:12.249: D/RtspVideoRecorder(19306): start 08-12 15:38:14.429: I/RtspServer(19202): requestLine: OPTIONS rtsp://192.168.1.5:8080/ RTSP/1.0 08-12 15:38:14.429: I/RtspServer(19202): CSeq: 2 08-12 15:38:14.429: I/RtspServer(19202): User-Agent: LibVLC/2.0.2 (LIVE555 Streaming Media v2011.12.23) 08-12 15:38:14.429: I/RtspServer(19202): 08-12 15:38:14.449: I/RtspServer(19202): requestLine: DESCRIBE rtsp://192.168.1.5:8080/ RTSP/1.0 08-12 15:38:14.449: I/RtspServer(19202): CSeq: 3 08-12 15:38:14.449: I/RtspServer(19202): User-Agent: LibVLC/2.0.2 (LIVE555 Streaming Media v2011.12.23) 08-12 15:38:14.449: I/RtspServer(19202): Accept: application/sdp 08-12 15:38:14.449: I/RtspServer(19202): 08-12 15:38:14.519: I/RtspServer(19202): requestLine: SETUP rtsp://192.168.1.5:8080/trackID=1 RTSP/1.0 08-12 15:38:14.519: I/RtspServer(19202): CSeq: 4 08-12 15:38:14.519: I/RtspServer(19202): User-Agent: LibVLC/2.0.2 (LIVE555 Streaming Media v2011.12.23) 08-12 15:38:14.519: I/RtspServer(19202): Transport: RTP/AVP;unicast;client_port=4000-4001 08-12 15:38:14.519: I/RtspServer(19202): 08-12 15:38:14.539: I/RtspServer(19202): requestLine: PLAY rtsp://192.168.1.5:8080/ RTSP/1.0 08-12 15:38:14.539: I/RtspServer(19202): CSeq: 5 08-12 15:38:14.539: I/RtspServer(19202): User-Agent: LibVLC/2.0.2 (LIVE555 Streaming Media v2011.12.23) 08-12 15:38:14.539: I/RtspServer(19202): Session: 1140424041 08-12 15:38:14.539: I/RtspServer(19202): Range: npt=0.000- 08-12 15:38:14.539: I/RtspServer(19202): 08-12 15:38:14.539: I/RtspServer(19202): request: PLAY 08-12 15:38:25.269: I/RtspServer(19202): requestLine: TEARDOWN rtsp://192.168.1.5:8080/ RTSP/1.0 08-12 15:38:25.269: I/RtspServer(19202): CSeq: 6 08-12 15:38:25.269: I/RtspServer(19202): User-Agent: LibVLC/2.0.2 (LIVE555 Streaming Media v2011.12.23) 08-12 15:38:25.269: I/RtspServer(19202): Session: 1140424041 08-12 15:38:25.269: I/RtspServer(19202): 08-12 15:38:25.299: I/RtspServer(19202): requestLine: OPTIONS rtsp://192.168.1.5:8080/ RTSP/1.0 08-12 15:38:25.299: I/RtspServer(19202): CSeq: 2 08-12 15:38:25.299: I/RtspServer(19202): User-Agent: LibVLC/2.0.2 (LIVE555 Streaming Media v2011.12.23) 08-12 15:38:25.299: I/RtspServer(19202): 08-12 15:38:25.339: I/RtspServer(19202): request: TEARDOWN 08-12 15:38:25.359: W/System.err(19202): java.net.SocketException: Socket closed 08-12 15:38:25.359: W/System.err(19202): at org.apache.harmony.luni.platform.OSNetworkSystem.read(Native Method) 08-12 15:38:25.359: W/System.err(19202): at dalvik.system.BlockGuard$WrappedNetworkSystem.read(BlockGuard.java:273) 08-12 15:38:25.359: W/System.err(19202): at org.apache.harmony.luni.net.PlainSocketImpl.read(PlainSocketImpl.java:458) 08-12 15:38:25.359: W/System.err(19202): at org.apache.harmony.luni.net.SocketInputStream.read(SocketInputStream.java:85) 08-12 15:38:25.359: W/System.err(19202): at java.io.InputStreamReader.read(InputStreamReader.java:255) 08-12 15:38:25.359: W/System.err(19202): at java.io.BufferedReader.fillBuf(BufferedReader.java:128) 08-12 15:38:25.359: W/System.err(19202): at java.io.BufferedReader.read(BufferedReader.java:236) 08-12 15:38:25.359: W/System.err(19202): at de.kp.net.rtsp.server.response.Parser.readRequest(Parser.java:31) 08-12 15:38:25.359: W/System.err(19202): at de.kp.net.rtsp.server.RtspServer$ServerThread.getRequestType(RtspServer.java:285) 08-12 15:38:25.359: W/System.err(19202): at de.kp.net.rtsp.server.RtspServer$ServerThread.run(RtspServer.java:221) 08-12 15:38:25.359: I/RtspServer(19202): requestLine: 08-12 15:38:25.359: W/System.err(19202): java.net.SocketException: Socket closed 08-12 15:38:25.409: I/RtspServer(19202): requestLine: DESCRIBE rtsp://192.168.1.5:8080/ RTSP/1.0 08-12 15:38:25.409: I/RtspServer(19202): CSeq: 3 08-12 15:38:25.409: I/RtspServer(19202): User-Agent: LibVLC/2.0.2 (LIVE555 Streaming Media v2011.12.23) 08-12 15:38:25.409: I/RtspServer(19202): Accept: application/sdp 08-12 15:38:25.409: I/RtspServer(19202): 08-12 15:38:25.409: W/System.err(19202): at org.apache.harmony.luni.platform.OSNetworkSystem.write(Native Method) 08-12 15:38:25.409: W/System.err(19202): at dalvik.system.BlockGuard$WrappedNetworkSystem.write(BlockGuard.java:284) 08-12 15:38:25.409: W/System.err(19202): at org.apache.harmony.luni.net.PlainSocketImpl.write(PlainSocketImpl.java:472) 08-12 15:38:25.409: W/System.err(19202): at org.apache.harmony.luni.net.SocketOutputStream.write(SocketOutputStream.java:57) 08-12 15:38:25.409: W/System.err(19202): at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:164) 08-12 15:38:25.409: W/System.err(19202): at java.io.BufferedWriter.flush(BufferedWriter.java:128) 08-12 15:38:25.409: W/System.err(19202): at de.kp.net.rtsp.server.RtspServer$ServerThread.run(RtspServer.java:227) 08-12 15:38:25.409: I/System.out(19202): Caught java.net.SocketException: Socket closed - closing thread 08-12 15:38:25.419: I/RtspServer(19202): requestLine: SETUP rtsp://192.168.1.5:8080/trackID=1 RTSP/1.0 08-12 15:38:25.419: I/RtspServer(19202): CSeq: 4 08-12 15:38:25.419: I/RtspServer(19202): User-Agent: LibVLC/2.0.2 (LIVE555 Streaming Media v2011.12.23) 08-12 15:38:25.419: I/RtspServer(19202): Transport: RTP/AVP/TCP;unicast;interleaved=0-1 08-12 15:38:25.419: I/RtspServer(19202): 08-12 15:38:25.429: I/RtspServer(19202): requestLine: PLAY rtsp://192.168.1.5:8080/ RTSP/1.0 08-12 15:38:25.429: I/RtspServer(19202): CSeq: 5 08-12 15:38:25.429: I/RtspServer(19202): User-Agent: LibVLC/2.0.2 (LIVE555 Streaming Media v2011.12.23) 08-12 15:38:25.429: I/RtspServer(19202): Session: 1034375957 08-12 15:38:25.429: I/RtspServer(19202): Range: npt=0.000- 08-12 15:38:25.429: I/RtspServer(19202): 08-12 15:38:25.439: I/RtspServer(19202): request: PLAY 08-12 15:38:36.119: I/RtspServer(19202): requestLine: $???????????????? msmainbox??$???????????????? msmainbox??TEARDOWN rtsp://192.168.1.5:8080/ RTSP/1.0 08-12 15:38:36.119: I/RtspServer(19202): CSeq: 6 08-12 15:38:36.119: I/RtspServer(19202): User-Agent: LibVLC/2.0.2 (LIVE555 Streaming Media v2011.12.23) 08-12 15:38:36.119: I/RtspServer(19202): Session: 1034375957 08-12 15:38:36.119: I/RtspServer(19202): 08-12 15:38:36.149: I/RtspServer(19202): requestLine: $???????????????? 08-12 15:38:36.149: W/System.err(19202): java.lang.NullPointerException 08-12 15:38:36.149: W/System.err(19202): at de.kp.net.rtsp.server.response.Parser.getCseq(Parser.java:120) 08-12 15:38:36.149: W/System.err(19202): at de.kp.net.rtsp.server.RtspServer$ServerThread.getRequestType(RtspServer.java:302) 08-12 15:38:36.149: W/System.err(19202): at de.kp.net.rtsp.server.RtspServer$ServerThread.run(RtspServer.java:221) 08-12 15:38:36.149: I/System.out(19202): Caught java.lang.NullPointerException - closing thread 08-12 15:38:40.539: W/System.err(19202): java.net.SocketException: Socket closed 08-12 15:38:40.539: W/System.err(19202): at org.apache.harmony.luni.platform.OSNetworkSystem.accept(Native Method) 08-12 15:38:40.539: W/System.err(19202): at dalvik.system.BlockGuard$WrappedNetworkSystem.accept(BlockGuard.java:262) 08-12 15:38:40.539: W/System.err(19202): at org.apache.harmony.luni.net.PlainSocketImpl.accept(PlainSocketImpl.java:92) 08-12 15:38:40.539: W/System.err(19202): at java.net.ServerSocket.implAccept(ServerSocket.java:264) 08-12 15:38:40.539: W/System.err(19202): at java.net.ServerSocket.accept(ServerSocket.java:150) 08-12 15:38:40.539: W/System.err(19202): at de.kp.net.rtsp.server.RtspServer.run(RtspServer.java:76) 08-12 15:38:40.539: W/System.err(19202): at java.lang.Thread.run(Thread.java:1019) 08-12 15:38:40.549: D/RTSPNativeCamera(19202): surfaceDestroyed
Hi lazy21tr, I just want to let you know, that I will have a look at your issue, when I'm back from my business trip. Did you made any progress in the meantime?
A quick guess: Please google "No implementation found for native" because it is a clear hint, that something with the native lib is going wrong. Maybe you made a mistake with packing of your project?
Regards Peter On Aug 11, 2012 10:44 PM, "lazy21tr" [email protected] wrote:
Actually, I am kind of a newbie on android. As I am trying to find an rtsp server implementation for android, I figured out that your work is great! Thank you for sharing it. Now I am trying to adopt it for my project.
I compiled the rtspcamera and upload to samsung galaxy ace (Android 2.3.3). I am basically trying to stream live video from the phone camera. So I tried to run RtspNativeCodecsCamera. It starts good. Once I ask VLC player to connect and play (with URL of "rtsp://192.168.1.5/8080") logcat reports an error of index out of bound for a string (filename in SDP class). I understand that I need to pass a filename to get rid of that error, but I dont exactly know what filename to write. Then I tried "kupdroid" as filename appended to the URL. The string error gone, but I get nothing played. please help me on this as I probably dont know how to setup applications. logcat report is as follow:
08-11 23:34:53.749: D/RTSPNativeCamera(16342): onCreate 08-11 23:34:53.849: W/dalvikvm(16342): No implementation found for native Lcom/orangelabs/rcs/core/ims/protocol/rtp/codec/video/h264/encoder/NativeH264Encoder;.InitEncoder (III)I 08-11 23:34:53.849: V/[RCS]RtspVideoRecorder http://16342: Player error: InitEncoder 08-11 23:34:53.849: D/RTSPNativeCamera(16342): onResume 08-11 23:34:53.849: D/RTSPNativeCamera(16342): RtspServer started 08-11 23:34:54.779: D/RTSPNativeCamera(16342): surfaceCreated 08-11 23:34:54.779: D/RTSPNativeCamera(16342): surfaceChanged 08-11 23:34:54.779: D/RTSPNativeCamera(16342): initializePreview 08-11 23:34:54.799: D/RTSPNativeCamera(16342): startPreview 08-11 23:34:54.799: D/RtspVideoRecorder(16342): start 08-11 23:35:14.579: I/RtspServer(16342): requestLine: OPTIONS rtsp:// 192.168.1.5:8080/kupdroid RTSP/1.0
08-11 23:35:14.579: I/RtspServer(16342): CSeq: 2
08-11 23:35:14.579: I/RtspServer(16342): User-Agent: LibVLC/2.0.2 (LIVE555 Streaming Media v2011.12.23)
08-11 23:35:14.579: I/RtspServer(16342):
08-11 23:35:14.589: I/RtspServer(16342): requestLine: DESCRIBE rtsp:// 192.168.1.5:8080/kupdroid RTSP/1.0
08-11 23:35:14.589: I/RtspServer(16342): CSeq: 3
08-11 23:35:14.589: I/RtspServer(16342): User-Agent: LibVLC/2.0.2 (LIVE555 Streaming Media v2011.12.23)
08-11 23:35:14.589: I/RtspServer(16342): Accept: application/sdp
08-11 23:35:14.589: I/RtspServer(16342):
08-11 23:35:14.609: I/RtspServer(16342): requestLine: SETUP rtsp:// 192.168.1.5:8080/kupdroid/trackID=1 RTSP/1.0
08-11 23:35:14.609: I/RtspServer(16342): CSeq: 4
08-11 23:35:14.609: I/RtspServer(16342): User-Agent: LibVLC/2.0.2 (LIVE555 Streaming Media v2011.12.23)
08-11 23:35:14.609: I/RtspServer(16342): Transport: RTP/AVP;unicast;client_port=4000-4001
08-11 23:35:14.609: I/RtspServer(16342):
08-11 23:35:14.619: I/RtspServer(16342): requestLine: PLAY rtsp:// 192.168.1.5:8080/kupdroid RTSP/1.0
08-11 23:35:14.619: I/RtspServer(16342): CSeq: 5
08-11 23:35:14.619: I/RtspServer(16342): User-Agent: LibVLC/2.0.2 (LIVE555 Streaming Media v2011.12.23)
08-11 23:35:14.619: I/RtspServer(16342): Session: 1323831376
08-11 23:35:14.619: I/RtspServer(16342): Range: npt=0.000-
08-11 23:35:14.619: I/RtspServer(16342):
08-11 23:35:14.649: I/RtspServer(16342): request: PLAY 08-11 23:35:14.859: I/RtspServer(16342): requestLine: $??????r~X????r~X msmainbox??$??????r~X????r~X msmainbox??TEARDOWN rtsp:// 192.168.1.5:8080/stream.sdp RTSP/1.0
08-11 23:35:14.859: I/RtspServer(16342): CSeq: 6
08-11 23:35:14.859: I/RtspServer(16342): User-Agent: LibVLC/2.0.2 (LIVE555 Streaming Media v2011.12.23)
08-11 23:35:14.859: I/RtspServer(16342): Session: 590266519
08-11 23:35:14.859: I/RtspServer(16342):
08-11 23:35:25.219: I/RtspServer(16342): requestLine: TEARDOWN rtsp:// 192.168.1.5:8080/kupdroid RTSP/1.0
08-11 23:35:25.219: I/RtspServer(16342): CSeq: 6
08-11 23:35:25.219: I/RtspServer(16342): User-Agent: LibVLC/2.0.2 (LIVE555 Streaming Media v2011.12.23)
08-11 23:35:25.219: I/RtspServer(16342): Session: 1323831376
08-11 23:35:25.219: I/RtspServer(16342):
08-11 23:35:25.229: I/RtspServer(16342): request: TEARDOWN 08-11 23:35:25.259: W/System.err(16342): java.net.SocketException: Socket closed 08-11 23:35:25.259: W/System.err(16342): at org.apache.harmony.luni.platform.OSNetworkSystem.read(Native Method) 08-11 23:35:25.259: W/System.err(16342): at dalvik.system.BlockGuard$WrappedNetworkSystem.read(BlockGuard.java:273) 08-11 23:35:25.259: W/System.err(16342): at org.apache.harmony.luni.net.PlainSocketImpl.read(PlainSocketImpl.java:458) 08-11 23:35:25.259: W/System.err(16342): at org.apache.harmony.luni.net.SocketInputStream.read(SocketInputStream.java:85) 08-11 23:35:25.259: W/System.err(16342): at java.io.InputStreamReader.read(InputStreamReader.java:255) 08-11 23:35:25.259: W/System.err(16342): at java.io.BufferedReader.fillBuf(BufferedReader.java:128) 08-11 23:35:25.259: W/System.err(16342): at java.io.BufferedReader.read(BufferedReader.java:236) 08-11 23:35:25.259: W/System.err(16342): at de.kp.net.rtsp.server.response.Parser.readRequest(Parser.java:31) 08-11 23:35:25.259: W/System.err(16342): at de.kp.net.rtsp.server.RtspServer$ServerThread.getRequestType(RtspServer.java:285) 08-11 23:35:25.259: W/System.err(16342): at de.kp.net.rtsp.server.RtspServer$ServerThread.run(RtspServer.java:221) 08-11 23:35:25.259: I/RtspServer(16342): requestLine: 08-11 23:35:25.279: W/System.err(16342): java.net.SocketException: Socket closed 08-11 23:35:25.279: W/System.err(16342): at org.apache.harmony.luni.platform.OSNetworkSystem.write(Native Method) 08-11 23:35:25.279: W/System.err(16342): at dalvik.system.BlockGuard$WrappedNetworkSystem.write(BlockGuard.java:284) 08-11 23:35:25.279: W/System.err(16342): at org.apache.harmony.luni.net.PlainSocketImpl.write(PlainSocketImpl.java:472) 08-11 23:35:25.279: W/System.err(16342): at org.apache.harmony.luni.net.SocketOutputStream.write(SocketOutputStream.java:57) 08-11 23:35:25.279: W/System.err(16342): at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:164) 08-11 23:35:25.329: W/System.err(16342): at java.io.BufferedWriter.flush(BufferedWriter.java:128) 08-11 23:35:25.329: W/System.err(16342): at de.kp.net.rtsp.server.RtspServer$ServerThread.run(RtspServer.java:227) 08-11 23:35:25.329: I/System.out(16342): Caught java.net.SocketException: Socket closed - closing thread
— Reply to this email directly or view it on GitHubhttps://github.com/spex66/RTSP-Camera-for-Android/issues/2.
Hi Peter;
OK, I got rid of that "No implementation found for native". You were right, that was caused by wrong setup. But still have issues.
First, my phone (Android 10) starts the app, the camera shows preview, but app closes itself after 5-6 sec. Then I tried on a tablet (Momo11 Bird, Android 14). It shows OK. With Native Codec, VLC shows a green screen, some horizontal lines moving around. This "move around" changes according to camera perception. But no clear picture shows on the client screen.
I switch to API Codec application, then VLC shows nothing. Though the application runs on both my phone (Android 10) and the tablet. Log says (with no error), PLAY request is received. But stops there with no response. As a result, no picture on the client screen.
At this point, I want to ask a question: I am building a variant of a chat application. So I dont know exactly which direction I need to go for live streaming the camera. I have seen lots of people complaining about the delay when they use RTSP server/clients. The delay of over 0.5 sec is not acceptable for chat applications. Shall I give up on RTSP and go for some other direction? Is there another protocol for streaming? Or may I tweak the application by reducing buffer sizes etc. and have an acceptable delay ranges? (I am assuming server and clients will be in the same local network)
Thank you for your time; Mehmet