frameprocessor and javacv grabber
openmotion opened this issue · comments
Hello
i want to use javacv to encode in realtime the result of the frameprocessor
i cannot successfully convert the otalia Frame to the yuv of javacv
basically the demo of javacv is ok with the byte[]data of the onPreviewFrame of the basic example of android
https://github.com/bytedeco/javacv/blob/master/samples/RecordActivity.java
so how can i have the same byte array format with the frameprocessor of the otaliastudios frameprocessor ?
here is my code
final byte[] bitmapbytes = frame.getData();
//Log.v(TAG,"recording_javacv : "+recording_javacv);
YuvImage yuvImage2 = new YuvImage(bitmapbytes, getFormat, frame.getSize().getWidth(), frame.getSize().getHeight(), null);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
compression = 50;
Rect imageSizeRectangle = new Rect(0, 0, imageWidth, imageHeight);
yuvImage2.compressToJpeg(imageSizeRectangle, compression, baos);
byte[] imageData = baos.toByteArray();
and i put the result in
((ByteBuffer)yuvImage_javacv.image[0].position(0)).put(imageData);
and finally i do that :
recorder.record(yuvImage_javacv);
i tried to change the
mCameraView.setFrameProcessingFormat();
but not sure of the parameters
below this is the init of javacv.Frame
yuvImage_javacv = new org.bytedeco.javacv.Frame(imageWidth, imageHeight, org.bytedeco.javacv.Frame.DEPTH_UBYTE, 2);
thanks