android-mediarecorder

MediaRecorder stop failed Android

巧了我就是萌 提交于 2019-12-01 06:15:09
问题 I use this code to prepare my MediaRecorder for recording video. After this I call the start() method, which doesn't crash, however when I call the stop() method a crash occurs and the RuntimeException stop failed is raised. I also notice that the video file which is saved in the device is broken and is only 32B. I'm assuming I have an error somewhere when setting up the device in the below method. Notice that I am trying to record from the surfaceView live preview which is displayed on

MediaRecorder start error codes

邮差的信 提交于 2019-12-01 04:18:26
I want to record raw h.264 video without sound and possibly HW accelerated (and stream it later). So I decided to use MediaRecorder (and the socket hack for streaming). I have the following code: final MediaRecorder recorder = new MediaRecorder(); final Camera camera = Camera.open(); camera.unlock(); recorder.setCamera(camera); recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA); recorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT); recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264); final CamcorderProfile profile = CamcorderProfile.get(CamcorderProfile.QUALITY_LOW);

MediaRecorder start error codes

谁说我不能喝 提交于 2019-12-01 01:47:15
问题 I want to record raw h.264 video without sound and possibly HW accelerated (and stream it later). So I decided to use MediaRecorder (and the socket hack for streaming). I have the following code: final MediaRecorder recorder = new MediaRecorder(); final Camera camera = Camera.open(); camera.unlock(); recorder.setCamera(camera); recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA); recorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT); recorder.setVideoEncoder(MediaRecorder

Forcing MediaRecorder to use internal microphone

南笙酒味 提交于 2019-11-30 23:26:37
I'm using something like this to initiate audio recording: MediaRecorder recorder = new MediaRecorder(); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); recorder.setOutputFile("/dev/null"); recorder.prepare(); recorder.start(); I want to always record from the internal microphone. Using the code above, the audio source switches to the external microphone as soon as one is plugged in. I've looked over the docs and can't find a way to set a preferred mic.

setOneShotPreviewCallback not hitting onPreviewFrame() in callback

ε祈祈猫儿з 提交于 2019-11-30 20:49:16
问题 I'm creating a video capture activity for an app I'm making, and I want to capture a preview frame as well to use as a playback button. I've set the SurfaceView up in onCreate(...) and hooked up the camera's preview display in the SurfaceHolder.Callback : private Callback mSurfaceViewCallback = new Callback() { @Override public void surfaceDestroyed(SurfaceHolder holder) { mSurfaceCreated = false; } @Override public void surfaceCreated(SurfaceHolder holder) { try { mSurfaceCreated = true;

Microphone input

喜夏-厌秋 提交于 2019-11-30 16:09:52
问题 I'm trying to build a gadget that detects pistol shots using Android. It's a part of a training aid for pistol shooters that tells how the shots are distributed in time and I use a HTC Tattoo for testing. I use the MediaRecorder and its getMaxAmplitude method to get the highest amplitude during the last 1/100 s but it does not work as expected; speech gives me values from getMaxAmplitude in the range from 0 to about 25000 while the pistol shots (or shouting!) only reaches about 15000. With a

Microphone input

久未见 提交于 2019-11-30 16:06:33
I'm trying to build a gadget that detects pistol shots using Android. It's a part of a training aid for pistol shooters that tells how the shots are distributed in time and I use a HTC Tattoo for testing. I use the MediaRecorder and its getMaxAmplitude method to get the highest amplitude during the last 1/100 s but it does not work as expected; speech gives me values from getMaxAmplitude in the range from 0 to about 25000 while the pistol shots (or shouting!) only reaches about 15000. With a sampling frequency of 8kHz there should be some samples with considerably high level. Anyone who knows

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

Deadly 提交于 2019-11-30 14:03:18
问题 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

Android: Listener to record sound if any sound occurs

这一生的挚爱 提交于 2019-11-30 12:20:08
问题 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? 回答1: 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 =

Android Video Orientation changes on mediarecorder.Start()

和自甴很熟 提交于 2019-11-30 10:10:10
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 to fix this please? Here's my code: XML <RelativeLayout android:id="@+id/surface_camera" xmlns