I am trying to record the video in 1:1 ratio (square) and i cant get it to work, if i set custom resolution in media recorder instance i get an error on media recorder start.
mediaRecorder.setVideoSize(480, 480);
but it works if i set the resolution supported by camera.
Camera.Parameters p = c.getParameters();
List<Camera.Size> list = p.getSupportedPreviewSizes();
//They are ordered from largest to smallest, so the largest will be...
for (Camera.Size i : list) {
if (i.width <= 640 && i.width >= 480) {
size = i;
}
Log.d(TAG, "i.height: " + i.height + " i.width" + i.width);
}
if (size != null) {
p.setPreviewSize(size.width, size.height);
c.setParameters(p);
}
then set
mediaRecorder.setVideoSize(size.width, size.height);
I usually get 480 by 640. Is there a way to crop the video on android? I have seen ffmpeg library but i need to use this in project and i am not sure how LGPL works. Is there a simpler solution to this?