开发者

In android how can I save an RTSP stream to file while playing it?

I need to be able to play a video received over RTSP AND save it to disc (well, the SD card) at the same time. This is a live stream, so I cannot download the entire file first and then play it. I must play and record开发者_StackOverflow社区 simultaneously. I can record video from the on board camera using MediaRecorder, and I can receive an RTSP stream using MediaPlayer or VideoView, but I don't know how to combine the two.

MediaRecorder seems to be the only way to record video, but it only supports one video source: the camera. Its setVideoSource() method allows no other sources. Perhaps I need to get an OutputStream somehow, which I can then write to a file?

Thanks for any help.


What you want to do is hard. There is no easy way to do this.

You have to get the video stream inside the RTSP packet by yourself (good luck with that, there is no free library to do it, it took me hours and hours of work) and store the stream in a file, in the same time, your can read this file and play it, like explained here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜