Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use MediaCodec to decode data from RTSP server?

I tried setDataSource() in MediaExtractor class but it doesn't work with RTSP path. I can use the same path with MediaPlayer class and it works but it is very important for me to use MediaCodec class instead. I think Android doesn't have any RTSP API I could use nor I can find any RTSP libraries for Android.

Is there a relatively easy way of feeding video stream from RTSP server into MediaCodec class?

like image 203
Rafal Roszak Avatar asked Oct 03 '22 09:10

Rafal Roszak


1 Answers

No easy way. I ended up using this project:

https://code.google.com/p/android-rtsp-client/

for RTSP protocol (worked after some fixes and modifications).

I needed to implement RTP and RTCP protocols myself (some simplified versions were enough in my case).

I also needed to create a code for extracting NAL units from RTP packets. I had to read this first:

http://www.ietf.org/rfc/rfc3984.txt

to figure out how to do that.

like image 102
Rafal Roszak Avatar answered Oct 07 '22 18:10

Rafal Roszak