I want to capture video with 4:3 aspect ratio from android fron-facing camera using Camera2 API (added in 5.0 version of android). It works correctly unless camera has 16:9 sensor array (as front-facing camera on Samsung Galaxy S5). In such case picture looks stretched as if 16:9 picture was being captured and squeezed into 4:3 surface provided by MediaRecorder.
According to documentation there shouldn't be any additional configuration needed as long as MediaRecorder's size has been set to one of sizes provided by getOutputSizes(MediaRecorder.class). Camera should automatically crop picture so it fits size of MediaRecorder's surface.
I tested also reversed situation - recording 16:9 video on camera with 4:3 sensor array (front-facing camera of Nexus-5). It works properly - picture is cropped to 16:9 aspect ratio.
I assume this is a bug in android API but would like to see whether there's something I miss here.
The simplest way to reproduce that problem is to use camera2Basic sample app provided by google with the following change that switches to using front-facing camera and 4:3 size for preview. It works correctly on Nexus-5 but provides stretched image on Samsung Galaxy S5. Below screenshot of camera2Basic app on Samsung Galaxy S5 (android 5.0).