android-mediarecorder

Taking picture while recording video on Android

拥有回忆 提交于 2019-12-10 03:50:24
问题 I have written the Android service shown below for recording the front cam in the background. This works very well. But now I would like to also take a picture every 5 seconds while recording. Is this somehow possible? When I try to open a second camera (in another service) I'm getting an error. public class RecorderService extends Service implements SurfaceHolder.Callback { private WindowManager windowManager; private SurfaceView surfaceView; private Camera camera = null; private

Android capturing slow motion video using CamcorderProfile

淺唱寂寞╮ 提交于 2019-12-09 15:27:23
问题 I am trying to capture slow motion video on my Nexus 5x. This is how I am configuring the media recorder: CamcorderProfile profile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH_SPEED_HIGH); mMediaRecorder = new MediaRecorder(); // Step 1: Unlock and set camera to MediaRecorder mCamera.unlock(); mMediaRecorder.setCamera(mCamera); // Step 2: Set sources mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT); mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA); //

Delay in preparing media recorder on android

最后都变了- 提交于 2019-12-09 07:11:45
问题 I am recording multiple small videos within 10 sec. I need to prepare and start media recorder again and again before creating any video. Due to which, there is a time lag of one or two seconds in every video. Is there any way to avoid this time delay in preparing the media recorder like Instagram? public boolean startRecording() { startCamera(); camera.unlock(); int rotation = 0; cameraInfo = new CameraInfo(); Camera.getCameraInfo(cameraId, cameraInfo); if (cameraInfo.facing == Camera

java.io.IOException: Cannot append Mp4TrackImpl{handler='vide'} to Mp4TrackImpl{handler='vide'} since their Sample Description Boxes differ:

只愿长相守 提交于 2019-12-08 12:35:40
问题 While Merging the multiple videos using ffmpeg I have got this Exception. java.io.IOException: Cannot append Mp4TrackImpl{handler='vide'} to Mp4TrackImpl{handler='vide'} since their Sample Description Boxes differ: 回答1: It might be you are using, convert your video in MPEG4. Use H264 format for set the video codec Change this recorder.setVideoCodec(avcodec.AV_CODEC_ID_MPEG4); to this recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264); 来源: https://stackoverflow.com/questions/21595508/java-io

Android Video Recording using Media Recorder is Not working

拟墨画扇 提交于 2019-12-08 11:21:10
问题 I am trying to Record a Video, But It's getting crash at Media Record starts and Media Record Prepare .please Help Me... Here Is My Code... private boolean startRecording() { camera.unlock(); try { mediaRecorder = new MediaRecorder(); mediaRecorder.setOnErrorListener(new MediaRecorder.OnErrorListener() { @Override public void onError(MediaRecorder mr, int what, int extra) { Log.i(TAG, "Error"); } }); second=0; minute=0; recordCountTimer = new CountDownTimer(Long.MAX_VALUE,1000) { @Override

How to Record voice with Audio MimeType in Android

泄露秘密 提交于 2019-12-08 11:09:04
问题 I want to record voice in pure audio format. currently I am using this code public static void startRecording(String fileName) { mRecorder = new MediaRecorder(); mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); mRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); String mFileName = Environment.getExternalStorageDirectory() .getAbsolutePath(); mFileName += "/abc.mp3"; mRecorder.setOutputFile(mFileName); mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); try {

File that I recorded with MediaRecorder can't be played

☆樱花仙子☆ 提交于 2019-12-07 19:07:49
问题 I'm using MediaRecoder to record sound, but after I'm done recording it can't be played. I tried with Google Play Music, ES Media Player, even uploaded it to pc and tried opening it with Winamp. Nothing plays it! //AUDIO RECORDER recorder = new MediaRecorder(); recorder.reset(); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); if (Environment

how to play .opus audio file in android?

﹥>﹥吖頭↗ 提交于 2019-12-07 13:43:31
问题 I'm developing an app for Recognize speech using google cloud speech APi and recording audio simultaneously. git link I tried to play recorded .opus audio file getting IOException W/System.err: java.io.IOException: setDataSource failed. Any idea?? Thanks!! 回答1: A user on the android stack exchange mentioned being able to play opus files when they have a .ogg extension in newer versions of Android. Rename your .opus files to .ogg. 回答2: I don't know about that specific error, but the Supported

File that I recorded with MediaRecorder can't be played

╄→尐↘猪︶ㄣ 提交于 2019-12-06 12:34:30
I'm using MediaRecoder to record sound, but after I'm done recording it can't be played. I tried with Google Play Music, ES Media Player, even uploaded it to pc and tried opening it with Winamp. Nothing plays it! //AUDIO RECORDER recorder = new MediaRecorder(); recorder.reset(); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { externalStoragePath = Environment

Android M - MediaRecorder start failed

随声附和 提交于 2019-12-06 11:26:24
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.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.READ