Android examples for android.media:Video
get Best Video Profile
import android.media.CamcorderProfile; public class Main { public static CamcorderProfile getBestVideoProfile(int cameraId, int width, int height, int rotation) { final int[] qualities = { CamcorderProfile.QUALITY_LOW, CamcorderProfile.QUALITY_CIF, CamcorderProfile.QUALITY_480P, CamcorderProfile.QUALITY_720P, CamcorderProfile.QUALITY_1080P, CamcorderProfile.QUALITY_HIGH }; final boolean swap = rotation % 180 != 0; final int requiredWidth = swap ? height : width, requiredHeight = swap ? width : height; for (int quality : qualities) { if (CamcorderProfile.hasProfile(cameraId, quality)) { final CamcorderProfile profile = CamcorderProfile.get(cameraId, quality); if (profile.videoFrameWidth >= requiredWidth && profile.videoFrameHeight >= requiredHeight) { return profile; }/*from w ww. j a va2 s.c o m*/ } } return null; } }