I am using Camera2 API with help of the two examples that you can find here:
I am using identical source code like in the above links, so I wont copy my Source here (unless you require some parts, I will edit my question and post it).
EDIT:
Ran some tests. When I try to play the video through my phone, it only displays the first frame and I can hear Audio (voices) that were actually in the recording. Once the video goes until end, the video somehow restarts automatically and displays the video as it should.
However, when I try to play the video on my PC (copying it from Phone to Desktop), I only get black screen until the last frame. Last frame is shown, but the video does not play at all. I can hear Audio (voices) tho.
I am thinking of maybe there's issue with some Video encoding / decoding?
ISSUE:
In my case the Video recording won't work. I can see both files in the directory that they should be on my Phone, but when I play the video (5 second video) first 4 seconds are black, then last second is like one Frame of what I recorded and that's it, yet file size seems big (160MB).
SCREENS:
I do not know what is wrong, can someone please help?
this is not a real solutions, but still it did the trick for what I wanted to do.
In order to play the video I had to DISABLE AUDIO ENTIRELY in my MediaRecorder setup:
//mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.SURFACE);
mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mMediaRecorder.setOutputFile(getVideoFile(activity).getAbsolutePath());
mMediaRecorder.setVideoEncodingBitRate(10000000);
mMediaRecorder.setVideoFrameRate(24);
mMediaRecorder.setVideoSize(mVideoSize.getWidth(), mVideoSize.getHeight());
mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
//mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
You can notice where I can commented out commands. Once I did that, the video plays normally.
Hope this bad workaround still will help someone who also does not require audio in the video recording.