简体   繁体   English

Android Live Streaming-H264解码

[英]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. 由于我对android和视频流有点熟悉,所以我知道处理设备之间的实时视频流很复杂。

Requirement: play incoming raw h264 stream 要求: 播放传入的原始h264流

Are there any ways beside serving rtp/rtsp to playback the stream? 除了提供rtp / rtsp之外,还有其他方法可以播放流吗? 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. VideoView需要本地rtsp或http服务器来处理流,我无法相信,没有其他方法可以简单地播放它。

Could be GStreamer / FFMpeg a good solution to decode the stream? GStreamer / FFMpeg可以很好地解决流解码吗?

For this purpose, you can use the new MediaCodec API introduced in Jelly Bean. 为此,您可以使用Jelly Bean中引入的新MediaCodec API。

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/ 如果您需要熟悉MediaCodec API,那么本教程对我来说是个不错的开始: http : //dpsm.wordpress.com/2012/07/28/android-mediacodec-decoded/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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