S
S
Severovostok2012-08-13 12:17:24
Android
Severovostok, 2012-08-13 12:17:24

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 тоже пробовал

But I tried and played a little with the parameters:
_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); // максимальный размер файла

Perhaps someone knows what parameters need to be specified or there are some ready-made instructions.
And please, if you don't know the answer, it doesn't mean that you should definitely downvote ;)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MicRaiS, 2012-08-14
@MicRaiS

look at android developers developer.android.com/reference/android/hardware/Camera.html
or
stackoverflow.com/questions/649057/how-do-i-save-data-from-camera-to-disk-using-mediastore- android

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question