Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I am trying to the change the encoding bit rate of the video recording on Android using
MediaRecorder.setVideoEncodingBitRate(int)
.
I looked in the android documentation and it states this method to set/change the bit rate but when I try to use this method I am getting
setVideoEncodingBitrRate(int)
is not defined in package
MediaRecorder
.
Why it is so?
I suggest you should check that which API version you are using
setVideoEncodingBitRate()
just come on API v8 or Android 2.1
If you use version less than that it would not be available :D
Also you could use it like this
webCamRecorder = new MediaRecorder();
if (target_holder == null)
return;
webCamRecorder.setPreviewDisplay(target_holder.getSurface());
webCamRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
webCamRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
webCamRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
webCamRecorder.setAudioEncodingBitRate(196608);
webCamRecorder.setVideoSize(640, 480);
webCamRecorder.setVideoFrameRate(30);
webCamRecorder.setVideoEncodingBitRate(15000000);
webCamRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
webCamRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
webCamRecorder.setOutputFile("your location to save");
setVideoEncodingBitRate is an instance method, seems that you are trying to call it as a static method (MediaRecorder.setVideoEncodingBitRate(int)), instead, call it from the MediaRecorder object.
MediaRecorder mr = new MediaRecorder();
mr.setVideoEncodingBitRate(someint);
Also, did you import android.media.MediaRecorder ?
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.