简体   繁体   中英

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.

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.

您需要从UDP中解包RTP数据包并将每个帧传递给MediaCodec如果您为MediaCodec设置视频视图,您将获得渲染的内容,这是我将尝试做的将更新您的结果

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM