mediarecorder

MediaRecorder video capturing in portrait mode

人走茶凉 提交于 2019-12-04 11:39:05
问题 I'm try to make custom video app. Iwork using settings in manifest 2.2 only (API 8). All goes well but I don't understand why portrait mode video does not differ from lanscape one. To make detection of device changed orientation I use this code within surfaceChanged() if (mCamera != null) { Camera.Parameters p = mCamera.getParameters(); try { mCamera.stopPreview(); } catch (Exception e) { // TODO: handle exception } int previewWidth = 0; int previewHeight = 0; if (mPreviewSize != null) {

How to record raw AAC audio files in Android using MediaRecorder? AAC_ADTS doesn't work

让人想犯罪 __ 提交于 2019-12-04 09:21:33
I'm using the Android MediaRecorder to record AAC encoded audio files. Setting the output format to MPEG-4 worked pretty well. But as my audio player supports neither MPEG-4 nor 3GP I tried to get raw AAC files by using the output format AAC_ADTS , which is supported by Android since API level 16. mRecorder = new MediaRecorder(); mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); mRecorder.setOutputFormat(MediaRecorder.OutputFormat.AAC_ADTS); mRecorder.setOutputFile(mFileName); mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC); Here is where I got stuck. The MediaRecorder created

Audio file captured by MediaRecorder is broken after it is sent to server using Retrofit 2

只愿长相守 提交于 2019-12-04 07:39:24
My app records an audio clip and send the clip to the server using Retrofit2 after the recording is completed.The file is received in server,but the file is broken,what I mean by broken is that it cannot be played. I use the following URL(example url: mydomain.co/audio/myaudio.mp4 ) to play the audio clip,which I tried with another audio file using postman ,the audio file can be played successfully.Besides,even downloading the audio clip captured by android via Filezilla also has the same broken file. This is how I record the audio: private void startRecordingAudio() { Log.d("audiorecording",

Android AudioRecord and MediaRecorder

巧了我就是萌 提交于 2019-12-04 06:14:05
I'm developing an audio processing application where I need to record audio, and then process it to obtain features of that recording. However, I want the audio in a playable format to play it after with MediaPlayer. I've seen that to record audio to process it it's better to use AudioRecord, because I can get the raw audio from there. But then I can't write the data to a file in a playable format (is there any library to do this in android?). I used this method to record raw data and then write it into a file: http://andrewbrobinson.com/2011/11/27/capturing-raw-audio-data-in-android/ But when

Android MediaRecorder Video - Audio and Video track playing subsequently

僤鯓⒐⒋嵵緔 提交于 2019-12-04 04:31:17
问题 I came a across a bug, mostly present on samsung devices. I record a video with media recorder (code shown below). It worked flawlessly, on all devices, but now on some Android Devices the Audio and Video track are separated. Say I'm capturing 5 sec of Video. The Video will be 5 sec long, playing the video will play the first frame of the video and the 5 secs of Audio. After that, the 5 secs of Video are being played. The default video player shows that the video is over after 5 sec, but in

How to use setCamera (MediaRecorder)?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 04:24:28
According to Android SDK MediaRecorder.setCamera can be used to recycle the existing camera instance for video capture and preview without resetting the preview. I was not able to find any sample, and all my attempts were futile: I either get the wrong state exception, or MediaRecorder.prepare fails. Does anyone know if this method usable at all? How can I use it then? Any samples available on the Web? For reference: http://developer.android.com/reference/android/media/MediaRecorder.html#setCamera(android.hardware.Camera) lyron I ran into the same problem and found out how it can work. Some

How to print log messages with in Android framework

空扰寡人 提交于 2019-12-04 03:47:31
问题 I am trying to print log messages within core Android framework files. For example, I tried logging messages within MediaRecorderClient.cpp under frameworks\base\media\libmediaplayerservice\ . I've tried LOGV , LOGE , LOGD , printf , and __android_log_print , without any success. Which command should I use to print log messages? 回答1: Log should be used, but it will print to logcat not system print. Example: Log.d("filter", example text); // filter is any tag you want to use as filter You can

Android getSupportedVideoSizes always returns null

若如初见. 提交于 2019-12-04 01:07:20
问题 I need some help with the MediaRecorder class on Android. I try to use getSupportedVideoSizes to get the list of supported video sizes, but it always returns null. In testing, the following devices return null when getSupportedVideoSizes is queried: Galaxy Nexus (Android 4.2) HTC One Mini (Android 4.4.2) HTCEVOV4G (Android 4.0.3) 回答1: The documentation for Camera.getSupportedVideoSizes() which reads, Returns a list of Size object if camera has separate preview and video output; otherwise,

android手机的Mic对声音的感知

谁都会走 提交于 2019-12-04 00:01:34
android手机的Mic对声音的感知 以下是转载的文章,前段时间我也在做mic录音方面的东东,等整理出来再总结一下。。 这段时间做了个有关android手机利用mic捕获外界环境音量的小东东,多方查询,各种研究,现在把这些东西跟童鞋们分享一下,如有不足或者差错,还望大牛们多给意见。 android提供可以实现录音功能的有AudioRecord和MediaRecorder,其中AudioRecord是读取Mic的音频流,可以边录音边分析流的数据;而MediaRecorder则能够直接把Mic的数据存到文件,并且能够进行编码(如AMR,MP3等)。 首先,要将你的应用加入权限(无论你是使用AudioRecord还是MediaRecorder): <uses-permission android:name="android.permission.RECORD_AUDIO" /> 然后,分开介绍两者的用法。 《!--AudioRecord--》 1、新建录音采样类,实现接口: public class MicSensor implements AudioRecord.OnRecordPositionUpdateListener 2、关于AudioRecord的初始化: public AudioRecord (int audioSource, int sampleRateInHz, int

Accessing the output video while recording

让人想犯罪 __ 提交于 2019-12-03 20:26:12
In short, I'm looking for a way to get the byte stream from the camera while recording video. The aim is to continuously record while saving certain portions of the current recording without stopping the actual recording process to access the output file. Is this even possible, or will I need to actually stop the recording and save it for it be playable? I've seen projects and open source library's that allow live streaming from the camera to a server via a local socket and the ParcelFileDescriptor class, so I assume (maybe incorrectly) that the recorder byte stream must be accessible somehow.