Skip to content Skip to sidebar Skip to footer

Issue In Recording Video

I am trying to record video in 480*480 resolution like in vine using javacv. As a starting point I used the sample provided in https://github.com/bytedeco/javacv/blob/master/sample

Solution 1:

To begin with, it's pre-processing, not post-processing the video.

I don't know what changes you need to tune the solution for new version of javacv, I hope they keep the library backwards compatible.

Your buffer is 640 pixels wide, and 480 pixels high. You want to crop out 480x480.

enter image description here

This means that you need a loop that will copy every line to the IplImage, something like this:

privateintimageWidth=640;
privateintimageHeight=480;
privateintdestWidth=480;

@OverridepublicvoidonPreviewFrame(byte[] data, Camera camera) {

if (data.length != imageWidth*imageHeight) {
    Camera.Sizesz= camera.getPreviewSize();
    imageWidth = sz.width;
    imageHeight = sz.height;
    destWidth = imageHeight;
}

ByteBufferbb= (ByteBuffer)yuvImage.image[0].position(0); // resets the bufferintstart=2*((imageWidth-destWidth)/4); // this must be evenfor (int row=0; row<imageHeight*3/2; row++) {
    bb.put(data, start, destWidth);
    start += imageWidth;
}
recorder.record(yuvImage);

Post a Comment for "Issue In Recording Video"