android-mediarecorder

How to read length of video recorded with MediaRecorder into private app storage directory constructed via context.getFilesDir()?

你说的曾经没有我的故事 提交于 2019-12-23 07:55:50
问题 I am having a weird issue reading the length/duration of a video file recorded with a device's camera by using MediaRecorder. The file is recorded into the application's private storage directory, which is set like so: mMediaRecorder.setOutputFile(context.getFilesDir() + "/recordings/webcam.3gpp"); After recording is complete, I attempt to read the length of the video with these methods: Method 1: MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();

CamcorderProfile.videoCodec returning wrong value

走远了吗. 提交于 2019-12-23 07:07:25
问题 According to the docs, you can use CamcorderProfile to get the devices default video codec format, then set it to MediaRecorder , like this: CamcorderProfile mProfile = CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_HIGH); // mMediaRecorder.setVideoEncoder(mProfile.videoCodec); But for some reason it is returning the wrong format. I'm using the CameraView library and in the FullVideoRecorder class the following is defined: switch (mResult.getVideoCodec()) { case H_263: mMediaRecorder

Unable to play sound with different values

為{幸葍}努か 提交于 2019-12-23 05:25:41
问题 I am working on an Android application that record the audio and play it with different frequency and voice properties. my code working: It records,Stop and play the audio but not in desired format and values just like Voice Changer With Effects Basically this app record voice and play it with different properties like Ghost,Radio,Girl etc etc. I am using list view to achieve this. I want to change the properties of sound just like this application. Here is code for main activity public class

Android M - MediaRecorder start failed

故事扮演 提交于 2019-12-22 18:14:08
问题 Samsung galaxy S6 edge 6.0.1 works fine, so maybe Android M is not the factor here. First off, the Android 6.0+ permissions are given, so that's not the case . Here it is : if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){ //нужно проверять пермишны if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.RECORD_AUDIO) != PackageManager

How to use Mediaprojection library in android to capture screen and convert into mp4 file?

拈花ヽ惹草 提交于 2019-12-22 05:26:12
问题 Since android 5.0 they are providing mediaprojection library to capture screen content. but sample demo application provided by them is not clear. U can find sample app here. In that application they are projecting captured screen using virtualdisplay method private void setUpVirtualDisplay() { Log.i(TAG, "Setting up a VirtualDisplay: " + mSurfaceView.getWidth() + "x" + mSurfaceView.getHeight() + " (" + mScreenDensity + ")"); mVirtualDisplay = mMediaProjection.createVirtualDisplay(

java.lang.RuntimeException: start failed at android.media.MediaRecorder.start(Native Method)

一个人想着一个人 提交于 2019-12-22 04:37:12
问题 I am working on records a phone calls. When i start a record a phone call then it's unfortunately stop. & it's gives error MediaRecorder start fail -2147483648. I Please tell me what is the problem in my code? Here is my Code. public class incomingcall extends BroadcastReceiver { Context c; MediaRecorder recorder; public incomingcall() { } @Override public void onReceive(Context context, Intent intent) { c = context; try { PhoneStateChangeListener pscl = new PhoneStateChangeListener();

Video display is garbled when recording on Galaxy S3

半腔热情 提交于 2019-12-21 17:34:37
问题 I'm writing a camera app and am having an issue with the S3. Whenever I start recording, the display goes to garbage (see screenshots below). Then, when I stop recording I get an exception: 10-02 13:36:31.647: E/MediaRecorder(24283): stop failed: -1007 10-02 13:36:31.647: D/AndroidRuntime(24283): Shutting down VM 10-02 13:36:31.647: W/dalvikvm(24283): threadid=1: thread exiting with uncaught exception (group=0x40c49a68) 10-02 13:36:31.647: E/AndroidRuntime(24283): FATAL EXCEPTION: main 10-02

Stream android screen

霸气de小男生 提交于 2019-12-21 07:11:05
问题 I am trying to fallow Truiton ScreenCapture example, in order to record the device screen using MediaProjection When saving the recording localy it works mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.SURFACE); mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); String localFilePath = getLocalFilePath(); mMediaRecorder.setOutputFile(localFilePath); mMediaRecorder.setVideoSize(DISPLAY_WIDTH, DISPLAY_HEIGHT); mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG

Record Video using surface view android

拈花ヽ惹草 提交于 2019-12-20 09:55:15
问题 I have to create an android app in which i am trying to record video and capture image using surface view. Up to now i am able to capture video but facing problem in record video. My code for video recording is - onCreate(){ .. surfaceHolder = surfaceView.getHolder(); surfaceHolder.addCallback(this); surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); startRecording(); . . } protected void startRecording() throws IOException { if(mCamera==null) mCamera = Camera.open(); String

Forcing MediaRecorder to use internal microphone

流过昼夜 提交于 2019-12-19 03:56:55
问题 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