android-mediarecorder

Android MediaRecorder start failed in invalid state 4

谁说我不能喝 提交于 2019-11-30 09:35:32
问题 I try to record the audio, only the audio, and I get this error on android 4.1.2 but not on 4.3: Here is the code: private void startRecord(){ on_record = true; final boolean exists = (new File(Environment.getExternalStorageDirectory() + File.separator + NOTAY)).exists(); if (!exists) {new File(Environment.getExternalStorageDirectory() + File.separator + "Test").mkdirs();} final boolean existAud = (new File(android.os.Environment.getExternalStorageDirectory() + File.separator + NOTAY + File

setOrientationHint rotates video counterclockwise on some phones' front facing cameras (HTC)

瘦欲@ 提交于 2019-11-30 09:06:48
The Problem: Certain Android devices (listed at the bottom of the question) exhibit unexpected behavior when utilizing the setOrientationHint(int degrees) function for videos taken with the front facing camera. The expected behavior is for the video to be rotated clockwise, but these devices rotate the video counterclockwise. My Goal: To identify a variable within either the camera settings or hardware orientations that allows me to predictably know when this will occur. Specifically, I would like to avoid special casing these phones in my code! Further Explanation: I am recording video using

How to record video of particular width and height on samsung device android?

橙三吉。 提交于 2019-11-30 08:44:09
Hello I am making an android application in which I am using custom camera for recording camera.I am having problem on samsung device.I can not set the profile of Media recorder to CamcorderProfile.get(cameraid, CamcorderProfile.QUALITY_HIGH) also when try to use profile = CamcorderProfile.get(cameraid, CamcorderProfile.QUALITY_LOW); profile.videoFrameHeight=360; profile.videoFrameWidth=640; then my app is working on some devices but crashes on many devices.Any type of help will be appreciable.Thanks in advance please check the code Camera.Parameters param = mCamera.getParameters(); param.set(

Android mediarecording error start failed -19 runTimeException

夙愿已清 提交于 2019-11-30 03:50:13
问题 I'm experiencing a problem with my mediarecording. I'm trying to use the front camera to recored. This gives me an error(but the preview is working). Whenever I use the back camera everything works just fine, I think this is very weird. What could be the problem and what could be the solution? My code and errors are shown below. Edit. Recording with a vga front camera seems not to work. How is this possible? Although recording with HTC camera app IS possible. Thanking you in advance.

Android: Listener to record sound if any sound occurs

こ雲淡風輕ζ 提交于 2019-11-30 02:27:52
In my application I want to implement methods which record the sound if any sound occurs. Something similar like this app: Talking Tom Cat So what should I have to do? Is there any demo that listens for sound and records it if any sound occurs? Kumar Vivek Mitra Try this code in your application... private int RECORDER_CHANNELS = AudioFormat.CHANNEL_CONFIGURATION_MONO; private int RECORDER_AUDIO_ENCODING = AudioFormat.ENCODING_PCM_16BIT; private int RECORDER_SAMPLERATE = 44100; private byte RECORDER_BPP = (byte) 16; private AudioRecord audioRecorder; public void arm() { // Get the minimum

Fix 3GP file after streaming from Android Media Recorder

大憨熊 提交于 2019-11-30 02:08:40
I am trying to stream video from android camera through local unix socket and write file from stream to sdcard. Everything works fine, except file is not playable with any player. It's because Android not filling some gaps in the file because socket is not seekable. As I understand I need to make some modifications after video stream is over. I read several articles here , here and here , but none of them helped me. I am playing with hex editor to learn how to do it manually, so afterwards it will be trivial to do the same in the Android code. Here is sample file that saved from stream: https:

how to record audio file with better quality in android?

核能气质少年 提交于 2019-11-29 17:34:43
问题 I am creating one application which play recorded file on Android to iphone and vice-versa. now I am using , audioRecorder = new MediaRecorder(); audioRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); audioRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); audioRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC); file recorded using this code having size 85 kb /15 sec and a very poor quality. if I use , audioRecorder = new MediaRecorder(); audioRecorder.setAudioSource

Android Video Orientation changes on mediarecorder.Start()

主宰稳场 提交于 2019-11-29 15:19:31
问题 This question is similar to posts here, here, here, here and here, but I'm stuck and have spent hours trying to figure it out. I have a video camera preview (which now always shows in the correct orientation), but when I hit record (mediaRecorder.start();), the video orientation changes. I have tried using setOrientationHint, but it doesn't seem to make a difference (as marked in a comment in the code below). It affects both my test devices (Galaxy and Xperia on Jelly Bean). What should I do

How to record video of particular width and height on samsung device android?

微笑、不失礼 提交于 2019-11-29 12:31:12
问题 Hello I am making an android application in which I am using custom camera for recording camera.I am having problem on samsung device.I can not set the profile of Media recorder to CamcorderProfile.get(cameraid, CamcorderProfile.QUALITY_HIGH) also when try to use profile = CamcorderProfile.get(cameraid, CamcorderProfile.QUALITY_LOW); profile.videoFrameHeight=360; profile.videoFrameWidth=640; then my app is working on some devices but crashes on many devices.Any type of help will be

Video recording and onPreviewFrame callback at the same time

自古美人都是妖i 提交于 2019-11-29 12:00:06
I'm trying to record video using MediaRecorder and get raw frames (byte arrays) from onPreviewFrame callback method Seems it's not that easy, mb it's not even possible, I don't know... But I found some answers (for similar questions) and people say that you should reconnect camera instance ( Camera.reconnect() ) after calling MediaRecorder.start() and set preview callback again I tried something like this but it doesn't work (recording works but onPreviewFrame is never called) I also tried to call Camera's stopPreview and startPreview methods after MediaRecorder.start() but seems we should not