Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to decode H264 over RTP using MediaCodec Api in Android

Am doing a project on live video broadcasting.

On sender side, am capturing the video using an android phone, getting the H264 frames and packetising them into RTP packets following the respective RFCs ->RFC 3984. The sending side has no issues. the stream is received and played by VLC.

On the receiver side, again an android mobile. i got the RTP packets successfulyy. its a RTP stream that contains H264 Dynamic Payload. i want to unpack this stream and decode it and render it on the receiver side using android mediacodec API. Somebody please guide me on how to realise this.

thank you.

like image 738
Ravi Avatar asked Nov 11 '22 16:11

Ravi


1 Answers

You will need to depacketize by putting in the parameter sets and the correct nalu header. This is relatively simple bar little documentation and i cannot share my code for this but i can share my hardware android decoder stuff which is in a previous post:

MediaCodec crash on high quality stream

This is all you need to do to decode h.264 in realtime android does the rest.

like image 85
redbrain Avatar answered Nov 14 '22 22:11

redbrain