简体   繁体   中英

android live streaming - h264 decoding

Since i'm a little familiar with android and video streaming, i know it's complicated to handle live video streams from device to device.

Requirement: play incoming raw h264 stream

Are there any ways beside serving rtp/rtsp to playback the stream? VideoView needs local rtsp or http server to handle the stream and i cannot believe, that there are no other ways to simply play it.

Could be GStreamer / FFMpeg a good solution to decode the stream?

For this purpose, you can use the new MediaCodec API introduced in Jelly Bean.

All you have to do is set a surface when configuring, eg

mDecoder.configure(mFormat, surfaceHolder.getSurface(), null, 0);

Then, when you release the output buffer, just tell the decoder to show the frame on the surface, eg

mDecoder.releaseOutputBuffer(decoderIndex, true);

If you need to get comfortable with the MediaCodec API, this tutorial was a good start for me: http://dpsm.wordpress.com/2012/07/28/android-mediacodec-decoded/

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