I want to make my custom media player and requires orientation info of video (for detecting it is recorded from front or back camera). for jpeg images i can use ExifInterface.TAG_ORIENTATION
but for video how i can find this information.
I tried to grab frame from video file and convert it into jpeg but again it always provides orientation 0
in all cases.
Please help me. Thanks in advance.
Api level 17 later, we can extract the orientation of video: MediaMetadataRetriever
MediaMetadataRetriever m = new MediaMetadataRetriever();
m.setDataSource(path);
Bitmap thumbnail = m.getFrameAtTime();
//
if (Build.VERSION.SDK_INT >= 17) {
String s = m.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION);
Log.e("Rotation", s);
}