I am working on an app that captures 4K Video only using the camera2 API - No preview surface displayed and no audio recorded.
I am using an LG G5 running Android 7.0.0. The device reports FULL implementation of the camera2 API when queried. The native camera app records in 4K just fine. The reported resolutions by mediarecorder confirm the availability of 4K:
My code to initialize MediaRecorder is below. I do this over using setProfile because I cannot set a profile without making the program throw exceptions because I haven't set any audio recording settings (as I don't want or care to record audio):
vidRecorder = new MediaRecorder();
vidRecorder.setVideoSource(MediaRecorder.VideoSource.SURFACE);
vidRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
vidRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
vidRecorder.setVideoFrameRate(30);
vidRecorder.setCaptureRate(30);
vidRecorder.setVideoEncodingBitRate(35000000);
vidRecorder.setVideoSize(3840, 2160);
vidRecorder.setOutputFile(videoFilename);
vidRecorder.prepare();
There are no issues shown in the log with the above. The output format and encoder match what VLC reports for 4K video files produced by the phone native app.
Everything above runs just fine except the produced video file is always 1920x1080p! I'm out of ideas as to why this is happening. Thanks in advance for any help.