應用場景
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); }