Answer the question
In order to leave comments, you need to log in
How to save video from Android camera?
Hey!
I need to implement in the application recording video from the camera to local storage. I have already implemented recording from the camera and saving the file, but there was a problem for which I did not find a solution using the search engine, namely, the file that is saved is played with a complete distortion of the picture (most likely I am confusing something with codecs and / or format). I'm using the default entry options:
_mediarecorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
_mediarecorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
_mediarecorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
_mediarecorder.setOutputFile("/sdcard/test5.mp4"); //test5.3gp тоже пробовал
_mediarecorder.setVideoEncodingBitRate(150000); // битрейт видео
_mediarecorder.setAudioEncodingBitRate(8000); // битрейт аудио
_mediarecorder.setAudioSamplingRate(8000); // частота дискретизации записи аудио
_mediarecorder.setAudioChannels(1); // количество каналов записи аудио
_mediarecorder.setVideoFrameRate(30); // фреймрейт записи видео
_mediarecorder.setVideoSize(640, 480); // размер картинки
_mediarecorder.setMaxDuration(0); // максимальная длительность записи
_mediarecorder.setMaxFileSize(0); // максимальный размер файла
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question