Start 2 identical video recordings using CameraX? - android

Does anyone know how I can start 2 identical video recordings using CameraX?
I want to do this so I can get a "sample" of the video recording, by stopping 1 of the 2 recordings after just a couple of seconds, and then let the other video recording keep going as normal. I want to have the "sample" in case of an app crash, which could make the second video recording corrupt.
I've been trying to start 2 video recordings, but I seem to get this error:
java.lang.IllegalStateException: A recording is already in progress. Previous recordings must be stopped before a new recording can be started.
This error doen't look good for what I am hoping to accomplish, but I was hoping that someone knows if there is a way that I can separate the 2 recordings on 2 different threads or something similar to make this work?

Related

Android: How to keep recording while switch between back and front camera?

Video is limited in 1 minute.
What I already try, I restart record after switch camera, so there are several video files, in the end, I append them one by one using mp4parser.
But in the final video, I get a up down video in the front camera part. I have no idea what's go wrong!
I have another thought is to record what I preview like record screen, but I have no idea how to implement it as First time camera player , like remove not needed UI.
If there is any advice would be great help. Thank your guys anyway
You can use jprofiler for performance monitoring and recording. I am using the same. Its amazing.

Android Vine/Instagram style video recording

I am asking for some pointers or guidance on how to implement the video recording feature that vine and Instagram use on Android.
That is, when user tap and hold, the video start recording. When user release, the video recording pause, but when user tap and hold again, the video will continue recording until it reaches a limit of X second.
Thank you
I received same task several days ago. I would like to share my thoughts with you, I think You could record several files (MediaRecorder.start() / MediaRecorder.stop() will produce several video files) and combine them in one. For combine process MP4Parser looks nice.
Hope it helped you ;)

Android MediaRecorder - how to record very short video (stop fails with RuntimeException)

I want to record videos of various lengths and I'm failing to record a very short one.
When I get to videos under one second of length, MediaRecorder.stop starts to fail (stop failed) and throw RuntimeException.
I am aware that this is documented behaviour, but is there any workaround?
I wouldn't like to go into NDK (and also don't know if it would help).
I also thought of recording a long video and later cutting it. But there could be problem with cutting outside I-frames.
The work around I've seen was to record at least two seconds.
If user stops recording before that, the request is delayed and the stop executed mot before the two seconds are recorded.

Recording video in Android in round-robin output style

Working on an Android app.
I need to record video continuously.
But the video files can only be N seconds long.
I have it working so far, and the files are being created properly. However, the time it takes to stop the MediaRecorder and start it back up again with a new file handle, I lose 2 seconds between stop/start.
Is there anything procedure-wise that I can do to mitigate this delay? I'm recording in mp4 format so I'm suspecting I can't just force a "move" on a file on the filesystem since the video needs to be packaged properly using the mp4 encoding.
Anyone know, roughly, how I might go about this?
Thanks!

How to record audio only if it is above certain sound level?

I was trying to do a voice capturing app that only capture when there is noise.
So I used the getMaxAmplitude() method from Media Recorder class.
And here is my idea and work:
I started a service that used a MediaRecorder object to record the sound from emulator' mic, then I have a thread running to check the getMaxAmplitude() value from that object, if it goes above a particular level, I start another recording using a new object from MediaRecorder for a period of time and then save it. If there are for example "3 noises" after starting the service of my app, it should then save 4 audio files, including the main one that use to monitor the amplitude level.
BUT I notice a problem, that is the microphone of android only allows 1 media recorder at a time.
So is there any other way to do this?
You might note the timestamps for the start and end of the noises, and then pull out the needed sections from the audio file at a later time.
Of course, this may not fit exactly with what you're trying to do... tough to say at this point.

Categories

Resources