4

Is there any method to convert byte[] NV21Data to WebRtc VideoFrame ?

I try to do it with TextureBufferImpl and seems its the only way, but it looks really complex.

YuvConverter yuvConverter = new YuvConverter(); 
TextureBufferImpl buffer = new TextureBufferImpl(composedBitmap.getWidth(), 
composedBitmap.getHeight(),VideoFrame.TextureBuffer.Type.RGB, 
textures[0], new Matrix(), surfaceTextureHelper.getHandler(), yuvConverter, null);


VideoFrame.I420Buffer i420Buf = yuvConverter.convert(buffer);
VideoFrame CONVERTED_FRAME = new VideoFrame(i420Buf, 0, System.nanoTime());

This question has info how to convert VideoFrame to byte[] Android org.webrtc.VideoRenderer.I420Frame arrays to PreviewCallback.onPreviewFrame byte[]

This way gives VideoFrame as black, seems not working as intended.

This question is converting to webRtc VideoFrame from surface Converting a Bitmap to a WebRTC VideoFrame

https://gist.github.com/n1xx1/2cd38043838e259969bce983ce21ffaa

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.