Android automatically delete everything before last 2 minutes of video stream - android

I want to make an android app, that records a video stream and when the user does not push a button, everything before the last 120 seconds of the video stream gets deleted. This should run for hours so only ~50mb are in use all the time. Has anyone an idea how to record a video like a never-ending flow of data that allows me to access certain points and delete everything before those points?
I know this question is pretty general but I find it very hard to access android camera close to the hardware.

You'll probably run into file size limitations if nothing else.
A better approach would be to just keep recording 30-second videos, and delete any that are more than two minutes old until the user presses the "record" button, at which time you start keeping them.
Then splice them together into one long video afterwards.
By the way, this will kill your battery. I assume you're equipped to deal with that.

Related

Sync Video Capture Between Android Devices?

I'm working on a project to capture and upload video from two Android devices (a Glass and a tablet), which communicate with each other via Bluetooth. My sync, upload, and capture process (using one device to control the other) works well, but I'm having trouble getting the recordings (via MediaRecorder) to stay in sync. Currently the process is:
Send start message from Glass and start 5 second countdown on Glass
On start message, start 5 second countdown on tablet
On countdown end, begin recording on both devices
On stop signal sent from Glass, stop both recordings and upload
Note that this assumes that the countdowns will start at exactly the same time and that MediaRecorder will take exactly as long to prepare and start on both devices. This naive approach does roughly sync (less than 500ms difference between files), but I know there has to be a better way. I know part of the issue is that passing and acting on the Bluetooth messages is introducing latency, but I'm not sure how to resolve this. I've tried adding additional sync and start messages to compensate for the countdown lag, but the overhead those add seem to make the problem worse. What's the best way to closely synchronize timing of media recording (or I guess other intensive activities)? I know some lag is inevitable but getting this down to around 100ms drift would be acceptable.

Building an app that records the last X mintues of you android device

I am trying to build an app that makes a video of your screen and only keeps the last X mintues of the video, i have found a code for running an adb shell commands from app:
Process process = Runtime.getRuntime().exec("your command");
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(process.getInputStream()));
But i have looked for a lead of how i can keep the last X mintues with no luck, any ideas of how i can do that? or maybe its not possible without rooting?
tnx
I am trying not to build but just to find an android app that when I press "record" the previous (2-3-10 or choose from etc) minutes already saved, in RAM I imagine.
You may know when minidisk created (let's say about millenium or before) a few MD players had that function, where you can turn on & off this feature: If you had it on, when you push the record button it was the last 6 seconds already saved.
The logic of that was really simple: When you record a song from the radio and you may miss the start etc for a few seconds and press "record", the MD had the last 6 seconds already saved!
So, if you had it on and want to record it, you already had a few seconds written and then with just a simple edit you can delete them and set the start time (and delete the previous seconds) and the endting time (with deleting the last seconds).
Simple really.. But the point is that apart it's not something new, is 100% workable & easy to develop and I am amazed that I have not seen EVEN ONE so far...
Is it this hard to develop such a thing for a camera and a mobile?
I am asking about the driving of course, to not make videos everytime I drive (and I drive all day every day..) just with the mobile in it's stand in the car.
So, IF someone makes this application I have two things to say to him to add -> 1st to let the user decide how many minutes before he's like to have already saved and if possible, to work as long as the screen is even locked.
Why don't give it a try? I know I will not use it but nobody knows that for sure, but maybe the one time I'll need it, at last I will know that with the "recorde" or "capture" or whatever, that it's capturing but in the beginnings of it I already have the XX minutes recorded already.
USEFUL very indeed for drivers like me that don't want to put cameras in the car & with my phone holder IF I had that application with that feature it would be perfect.
If I am missing something, if there's somewhere an app like this and didn't check it, I don't know.
But for the developers ....just thing about it.
It's very practical, simple and you can have video proof in a ..let's say crash event without putting 2-3 cameras but only with mobile.
No idea is a bad idead for a smart developer I thing, then whoever wants sits and writes it.
Thanks, take care guys

android audio - calculating the distance between two devices

I'm having a real hard time calculating the distance between two android phones using sound.
-the main idea is having 2 phones sync'ed on same time, making mobile A send a msg to mobile B to let him know he is playing sound soon. note that mobile A save this time.
-then mobile B sends "ok, u can go ahead" to mobile A while it starts recording the next 1 second or so.
-Then mobile A gets the "ok" and start playing a 1000Hz sound.
-Mobile B detect that freq and send its current time to mobileA
now we have all the info to calculate the distance. problem is that at theory this is all good, but when i implement this i have lots of random time added into the equation.
the main problem is that I cant point at the ABSOLUTE time when mobile B got the good freq.
I tried not recording the whole 1000 ms but lots of "mini" chunks of (12~24ms) but the time the mobile spend on the recorder_.startRecording()/recorder_.read()/recorder_.stop() commands is too much, and im missing the freq by lots of ms (each ms is equal to 30cm so i cant effort much errors...)
can any one tell me what im doing wrong or guiding me to better ways of doing that??
The main issue is the recording device cant point on the actual time he recorded the wanted freq.....
thanks in advanced,
Ofer.
Please have a look at new audio features introduced in API 19.

Android: My Own App Takes Ages To "Compute" under "Manage applications" and is Generally Slow

I have a fledgling app under development, which I am installing to my Android phone via Eclipse debugging.
Now, my app is only 200KB in size at the moment, but it runs very slowly. I have a button in my first activity that drops 4 SQLite tables, with a combined total of no more than 25 records, and then recreates the tables and data straight away. To my mind, this should be a pretty damn fast operation, but it takes a good 4 or 5 seconds.
There isn't anything else going on at that moment in time, netiher in the app, or on my phone. I just can't understand how it can be so sluggish. I've even made the operation above an AsyncTask, and it's made no difference.
Also, when I go into my phone's Settings -> Manage applications, the list of all my installed apps shows that they're all "computing...". Every single other app finishes this a good 3 or 4 seconds before my tiny one stops "computing..." and displays the app size info, etc.
Could all this just be symptomatic of an app not having been installed via the Marketplace? Is it something to do with the debuggable setting in my Manifest?
I'm not ready to play around with signing and release yet, not by a long shot, so I can't test to see if that's the reason. Or can I?
I have a button in my first activity that drops 4 SQLite tables, with a combined total of no more than 25 records, and then recreates the tables and data straight away. To my mind, this should be a pretty damn fast operation, but it takes a good 4 or 5 seconds.
Writing to flash is not as consistent, speed-wise, as is writing to magnetic media. Brad Fitzpatrick, in the 2010 Google I|O conference, cited some tests he ran where writing a single byte to flash, while normally fast, could take as long as 200ms.
If you are not using transactions, things will be slower, because there is a flash write and sync on every database operation.
Beyond that, it is difficult to provide you with advice, particularly with no code to examine.
I'm not ready to play around with signing and release yet, not by a long shot, so I can't test to see if that's the reason. Or can I?
Well, you can certainly sign it. For release testing, you can put the app on a Web server somewhere that is set up with the proper MIME type (application/vnd.android.package-archive), or send it to your device via Dropbox, or something.

How can I insert cues into a video I want to play in my Android App?

I noticed that Flash allows you to insert cue's into a video file (flv). Is something like this possible on Android? I have a video that runs locally in my Android app and I would like to insert cues into the video which will give me callbacks when a certain portion of the video has been reached. If this is not possible, are there any other methods to do something similar? I have to be pretty precise with where the cue is located.
Thanks
Note:
I just found this same question on stackoverflow. Can anyone verify that this is still the case? (That it is not possible, only by polling the video continually). I did know of this way, but it's not the most accurate way if you need to be precise and stich dynamic pieces of video together seamlessly.
Android VideoView - Detect point of time in video
I´m working on this as well and a kind of cue/action scripts. For tutorials, instruction video I need to keep track of current position to serve for example questions and navigation menus appropriate for that point in time. Easy when it´s sufficient to act in response to user input but otherwise firing up a thread to poll at some decent interval is the thing. Accuracy might be acceptable and can be calibrated by sensing actual position.

Categories

Resources