Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frameprocessor and javacv grabber #1284

Open
openmotion opened this issue Aug 9, 2024 · 0 comments
Open

frameprocessor and javacv grabber #1284

openmotion opened this issue Aug 9, 2024 · 0 comments

Comments

@openmotion
Copy link

openmotion commented Aug 9, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant