Is there a good way to stream video FROM Android to an RTSP server?

别等时光非礼了梦想. 提交于 2019-12-04 14:07:02

问题


I have searched around and haven't really found anything. I would like to send the video from the built in camera to my RTSP server via a stream. When looking for examples, I saw that it might be possible for MediaPlayer to have its setDataSource() method to just include the location of the stream on the server. I tried to emulate that with:

mediaRecorder = new MediaRecorder();
mediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
mediaRecorder.setOutputFile("rtsp://x.x.x.x/mystream2.mpg");
mediaRecorder.prepare();
mediaRecorder.start();

I am attempting to use LIVE555 to simulate a server in case that might be any reason for the hold up. However, the problem is probably a lock of understanding of how things work on my part. Any insight as to things I could try would be highly appreciated. Thanks ahead of time!

(Also, the x's are replaced with numbers, I just don't know why adding the IPs I'm using would be terribly helpful)

If there's anything I can add to help, let me know. Thanks again!


回答1:


You should look into this --> https://github.com/spex66/RTSP-Camera-for-Android

I took their code and added ANNOUNCE and RECORD methods to the rtsp client.

And i successfully got streaming to work from android phone to darwin server.




回答2:


We ended up just using a standard protocol smashing JPEG after JPEG and loading those and it more-or-less simulates real time. We could still use a better solution, but this worked for now. If anybody wants to see some code, leave a comment. If anybody has a better solution, post it and I will switch the answer over.



来源:https://stackoverflow.com/questions/6218971/is-there-a-good-way-to-stream-video-from-android-to-an-rtsp-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!