应用场景
EasyPlayer-RTSP在多年与VLC的对标过程当中,积累了普遍的应用场景,EasyPlayer-RTSP底层与上层所有自主开发,自主知识产权,可实战测试。java
EasyPlayer-RTSP播放器
EasyPlayer-RTSP播放器是一套RTSP专用的播放器,包括有:Windows(支持IE插件,npapi插件)、Android、iOS三个平台,是由青犀TSINGSEE开放平台开发和维护的区别于市面上大部分的通用播放器,EasyPlayer-RTSP系列从2014年初发展至今获得了各行各业(尤为是安防行业)的普遍应用,其主要缘由是EasyPlayer-RTSP更加精炼、更加专一,具有很是低的延时,很是高RTSP协议兼容性,编码数据解析等方面,都有很是大的优点。api
EasyPlayer-RTSP-Android解码获取视频帧
提出问题
EasyPlayer-RTSP-Android如何获取解码后的视频帧?测试
分析问题
有的客户须要拿到解码后的视频帧,用来实现人脸识别。ui
解决问题
视频播放的实如今PlayFragment.java中,其中有一个子类YUVExportFragment.java,实现了接口EasyPlayerClient.I420DataCallback,在onI420Data方法中能够拿到解码后的视频帧:编码
深刻阅读代码,会发如今EasyPlayerClient.java中,硬解码和软解码的方式,都将解码后的视频帧传入onI420Data了:spa
ByteBuffer buf = mDecoder.decodeFrameYUV(frameInfo, size); if (i420callback != null && buf != null) i420callback.onI420Data(buf); if (buf != null) mDecoder.releaseBuffer(buf);
ByteBuffer outputBuffer; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { outputBuffer = mCodec.getOutputBuffer(index); } else { outputBuffer = mCodec.getOutputBuffers()[index]; } if (i420callback != null && outputBuffer != null) { if (sliceHeight != realHeight) { ByteBuffer tmp = ByteBuffer.allocateDirect(realWidth*realHeight*3/2); outputBuffer.clear(); outputBuffer.limit(realWidth*realHeight); tmp.put(outputBuffer); outputBuffer.clear(); outputBuffer.position(realWidth * sliceHeight); outputBuffer.limit((realWidth * sliceHeight + realWidth*realHeight /4)); tmp.put(outputBuffer); outputBuffer.clear(); outputBuffer.position(realWidth * sliceHeight + realWidth*realHeight/4); outputBuffer.limit((realWidth * sliceHeight + realWidth*realHeight/4 + realWidth*realHeight /4)); tmp.put(outputBuffer); tmp.clear(); outputBuffer = tmp; } if (mColorFormat == COLOR_FormatYUV420SemiPlanar || mColorFormat == COLOR_FormatYUV420PackedSemiPlanar || mColorFormat == COLOR_TI_FormatYUV420PackedSemiPlanar) { JNIUtil.yuvConvert2(outputBuffer, realWidth, realHeight, 4); } i420callback.onI420Data(outputBuffer); }