mediarecorder

MediaRecorder start fail -2147483648

99封情书 提交于 2019-12-29 09:13:09
问题 I intend to record calls with this application. But when I set the audioSource to MediaRecorder.AudioSource.VOICE_CALL, it gives an error but when the audioSource is set to MediaRecorder.AudioSource.MIC, it works perfectly fine. I am not sure where is the problem. The logcat of the problem is below. Any form of help is greatly appreciated. Thanks. public class IncomingCallReceiver extends BroadcastReceiver { private MediaRecorder mRecorder; @Override public void onReceive(Context context,

Android -- MediaRecord

橙三吉。 提交于 2019-12-29 04:42:52
MediaRecord 集成了录音、编码、压缩等,支持少量的录音音频格式,大概有.aac .amr .3gp 优点:大部分以及集成,直接调用相关接口即可,代码量小 缺点:无法实时处理音频;输出的音频格式不是很多,例如没有输出mp3格式文件 WAV格式:录音质量高,但是压缩率小,文件大 AAC格式:相对于mp3,AAC格式的音质更佳,文件更小;有损压缩;一般苹果或者Android SDK4.1.2(API 16)及以上版本支持播放 AMR格式:压缩比比较大,但相对其他的压缩格式质量比较差,多用于人声,通话录音 至于常用的mp3格式,使用MediaRecorder没有该视频格式输出。一些人的做法是使用AudioRecord录音,然后编码成wav格式,再转换成mp3格式 举个栗子 MediaRecorder recorder = new MediaRecorder(); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); recorder.setOutputFile(PATH

【Android】【录音】Android录音--AudioRecord、MediaRecorder

隐身守侯 提交于 2019-12-29 04:42:14
【Android】【录音】Android录音--AudioRecord、MediaRecorder Android提供了两个API用于实现录音功能:android.media.AudioRecord、android.media.MediaRecorder。 网上有很多谈论这两个类的资料。现在大致总结下: 1、AudioRecord 主要是实现边录边播(AudioRecord+AudioTrack)以及对音频的实时处理(如会说话的汤姆猫、语音) 优点:语音的实时处理,可以用代码实现各种音频的封装 缺点:输出是PCM语音数据,如果保存成音频文件,是不能够被播放器播放的,所以必须先写代码实现数据编码以及压缩 示例: 使用AudioRecord类录音,并实现WAV格式封装。录音20s,输出的音频文件大概为3.5M左右(已写测试代码) 2、MediaRecorder 已经集成了录音、编码、压缩等,支持少量的录音音频格式,大概有.aac(API = 16) .amr .3gp 优点:大部分以及集成,直接调用相关接口即可,代码量小 缺点:无法实时处理音频;输出的音频格式不是很多,例如没有输出mp3格式文件 示例: 使用MediaRecorder类录音,输出amr格式文件。录音20s,输出的音频文件大概为33K(已写测试代码) 3、音频格式比较 WAV格式:录音质量高,但是压缩率小,文件大

Android record video without audio

自闭症网瘾萝莉.ら 提交于 2019-12-28 06:31:17
问题 Is it possible in Android to record video from Camera without audio stream? Goal: to reduce the output file size. 回答1: You can use a MediaRecorder without calling setAudio* on it. This is my first time using MediaRecorder, but this example seems to work: public class CamcorderView extends SurfaceView implements SurfaceHolder.Callback { private SurfaceHolder mHolder; private Camera mCamera; private MediaRecorder mRecorder; public CamcorderView(Context context, AttributeSet attrs) { super

MediaRecorder start failed: -38

微笑、不失礼 提交于 2019-12-27 12:24:00
问题 i searched to check if this question is no dup , i see some has no answer and others did not help. this is my code : private void startRecording() { mRecorder = new MediaRecorder(); mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); mFileName = Environment.getExternalStorageDirectory().getAbsolutePath(); mFileName += "/recordedHeckPost_.3gp"; mRecorder

Sample Rate in Android Audio Record class and MediaRecord class

为君一笑 提交于 2019-12-25 16:46:14
问题 i want to know what is the difference between setting audio sample rate in Android AudioRecord class and Media record class? In audio record class we set sample rate while creating an object of the class like recorder = new AudioRecord(MediaRecorder.AudioSource.MIC, SampleRateInHz, RECORDER_CHANNELS,RECORDER_AUDIO_ENCODING, bufferSize); while in MediaRecorder class we set explicitly through a function call. i.e. mrec.setAudioSamplingRate(samplingRate); I tried both but effect of sample rate

Automatic Gain Control(AGC) for external mic

余生长醉 提交于 2019-12-25 07:09:04
问题 I have an audio recording app on android market which records using PCM-WAV format. My app also offers custom gain control ([-20dB, +20dB]) , so I alter the original audio data with user selected gain value. It works pretty well when using device built-in mic, but I have a user which uses some external mic plugged into his device, and the output is too loud and full of distortions (because of the loudness of his ext mic). Even when he set the gain to -20dB, the output is loud and contains

Android - Recorded audio file differs size when changing device

限于喜欢 提交于 2019-12-25 02:28:20
问题 I am trying to record an audio file in Android, I'm setting the output file bit rate and sampling rate, everything is working right but whenever i record anything in a different device the file size differs a lot. I have made some tests with a Z2 and a Moto G changing bit rate and sampling rate, obtaining very different file sizes on same recording time. I have noticed that the file depends the most on bit rate rather than sampling rate. The problem is that i would expect and actually need

Android MediaRecorder to AudioTrack, Recording and Playback

不羁岁月 提交于 2019-12-25 00:28:11
问题 I'm trying to make it to where I can record the users voice and play it back in the same activity using the MediaRecorder and AudioTrack. I just don't understand how to write the file to AudioTrack. I've read the documents on both and simply can't figure it out. Any help would be appreciated. Here's my code so far, it's not complete. The only buttons you need to read are recordButton and playbackButton. Thanks! private File outputFile = null; private AudioTrack voice = null; private

Android - intent to record video on lowest quality

馋奶兔 提交于 2019-12-24 14:21:12
问题 I have a project where the user can take pictures and videos without limitation of time, so i need to record with the lowest quality. This is my code: Intent takeVideoIntent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE); takeVideoIntent.putExtra(android.provider.MediaStore.EXTRA_VIDEO_QUALITY, 0); if (takeVideoIntent.resolveActivity(getPackageManager()) != null) { startActivityForResult(takeVideoIntent, REQUEST_VIDEO_CAPTURE); } in (MediaStore.EXTRA_VIDEO_QUALITY, 0);) i made