[Mortscript 'App'] One Touch (ish) Video Recording - HD2 Windows Mobile 6.5 Themes and Apps

Following on from another thread where people were asking about availability of apps to start a looping video recording app, I've started work on this, and have made some promising initial progress.
I'm having to do this with Mortscript since the only language I can code in is not suitable for writing phone/pc apps sadly, but so far it looks to be quite suitable.
If you're interested in this I'm afraid you'll have to be quite patient as I can't promise it will be complete by any date and I might even fail to complete it, but I'm posting up now because I believe that it's still useful at its current state.
Basically what the code does at the moment is as follows:
Tells you how much memory is spare on your SDcard
Asks you what you want the minimum remaining memory (in MB, ie when your remaining memory reaches a certain point the script stops recording)
Opens the camera in video mode
Begins recording
Once recording, the remaining memory is checked every 5 seconds
When the remaining memory dips below the amount you specified the recording stops, the camera turns off, and a message confirming remaining memory is displayed.
If you add the script to the appropriate start menu folder then you can add it as a home screen shortcut like any other app, so that just one touch will fire it up.
At present I have not started working on the actual looping functionality of the video, so it records until it reaches the memory limit you specify, or until you stop it manually, but I think this is still useful.
Now for the 'funny' important stuff:
Please understand this code comes with absolutely no promises/guarantees etc - if you choose to use it, you do so entirely at your own risk and I am not responsible for any outcome of doing so. I've run it several times and it has worked well for me, but there's no guarantee that it will behave the same for others.
I'm not going to be answering questions about the most basic stuff in relation to Mortscript. Please read up on the basics of what it is and what it does, and how you implement it before using this script. It's nothing personal, just that my free time is extremely limited so I can't afford to spend it answering potentially lazy questions.
Do as you wish with the script if you want to modify it and improve it, or just tailor it to your own needs. For instance, you may wish to do away with the question about minimum remaining memory and set a fixed amount so the recording begins from just one shortcut press. I've set it like that really for ease of testing but it may be handy for people who want to keep a certain amount of their card empty.
You may have to change minor bits of this script to make it work for you. Main example I can think of is depending on where the default location is for video recording files on YOUR phone (ie storage or card - it should be card for this script to work), and also the name of your card. On mine the card is called "Storage Card" - yours may be different and would therefore affect the script.
Other stuff I've not thought of yet but that people might whinge about.
In a nutshell though, I hope some of you find this useful, and at some point hopefully in the not too distant future this might be a bit more automated and do exactly as some of us wanted on the other threads about looping video.
If others want to use this as a base and finish the job I'm not going to be upset shall we say.
Script in post #2

Either download the zip file, unzip and place the script in an appropriate folder on your memory card, or copy this script code into a notepad file & save it, then change the files extension from .txt to .mscr & place it where it needs to live.
Script contents/zip download:
Code:
Free1 = FreeDiskSpace( "\Storage Card")
Freemb1 = Free1 / 1048576
Message((Freemb1& "MB left") , "Memory remaining:" )
Min = Input( "Remaining Memory Cutoff Limit(MB)?")
MinMem = Min * 1048576
set Mem, MinMem
Run( "\windows\camera.exe", "-v" )
WaitForActive "Camera",5000
mouseclick(240, 700)
set Delay, 5000
while wndActive "Camera"
sleep Delay
Free2 = FreeDiskSpace( "\Storage Card")
Freemb2 = Free2 / 1048576
if (Free2 le Mem)
# end recording & close camera
mouseclick(240, 700)
close "Camera"
Message((Freemb2& "MB left free") , "Memory Info:" )
#to do - delete the file just created
#to do - start recording again:
#mouseclick(240, 700)
endif
EndWhile

Reserved in case I need it for anything else....

This is interesting, will try after I read up on mortscript. One thing cought my eye, it seems with mortscript you are able to do software clicks on the screen (#to do - start
recording again:
#mouseclick(240, 700)
Would this mean we could have a way to asign a hardware key to take pictures in camera mode? I know this has nothing to do with your app, it just came to my mind after seeing your code. It would be nice to have a hardware key to take pictures with our HD2's.
Anyway I will be following your thread for updates on loop recording. Thanks for your work here.

Thanks for your comments mate.
I'm not sure about the hardware button in camera mode. It might be possible but I'm only a novice at Mortscript myself so I don't actually know. I would guess that if MS is capable of registering the activation of hardware buttons and distinguishing between them, then it should be possible but don't quote me!
A script to do that would I think have to effectively listen for the camera being activated, then once it is launched, listen for hardware key presses from a specified key which would in turn trigger the on screen mouseclick command.
Something for another thread I think but an interesting idea anyway. If you search through the mortscript examples thread (approx 70 pages!) you might find something that helps.

After a quick look at the manual this morning I think it's going to take me a little while to figure out how to delete the last created file in the DCIM folder, but once I have it sorted I will post up the amendments.

Run into a problem tonight with timestamps.
The time a file was recorded is showing up exactly 1 hour wrong from when it actually was made, so I have to try and figure this out. It's not the phone clock since the timestamp for the current time is spot on.
Go figure!

Thanks for posting updates for us. Hope you will find a solution, could it have something to do with summer/winter time? Or with local time? Don't know for sure of course, just trying to help.

I think there's a very good chance that's what it's linked to yes, but no idea how to get around it.
The dates where the clocks move forwards/back are not the same each year, so I can't hardcode it in. If there's a way I can get the script to check whether the phone's clock is using GMT or BST then that would likely solve it but I've no idea if that's possible.
Have raised a thread elsewhere to ask for help but no luck so far.

Well - I'm going to be struggling with this a bit guys.
I've not had any replies to the thread (http://forum.xda-developers.com/showthread.php?t=690134) asking about this time difference (I'm wondering if I have posted in the wrong subforum perhaps?) so I'm not really going to be able to get past the issue anytime soon. Kind of scuppers the project until I can work around that.
There is another way potentially of finding the correct file to delete, which would be to go through the mp4 files in the video folder, and create a list of them, sort it by time created, then delete the latest one.
But I don't know how to do that and there isn't any useful info that I can see in the Mortscript manual about sorting data, or even creating simple lists of data objects (unless this is the 'array' functionality?).
So I'm a little bit stuck sorry.

Related

program to complete multiple apps/actions?

does anyone know of a program to perform multiple actions or launch multiple apps?
i want something which would allow me to create a exe file (which i can put in start menu or assign to a button) which will complete several actions after being selected.
such as: wifi on, launch ie or bluetooth on, launch wmp or close all, power off... etc,
you get the idea i hope
mortscript
Midget_1990 said:
mortscript
Click to expand...
Click to collapse
i should have expected that but thanks
however, i was hoping for something with a ui, and without a 60 page manual which looks to complicated for me on the first contents page
i guess i'll have to start reading the accumulation thread and manual a lot
Hi and thanks guys,
I finally started using mortscript, it's actually very simple to use (at least for what i want) it just looks very difficult to use when you read the site and the manual. Though it did take me all of today to work out why i could not get vjvolubilis to work (i missed a "," out ) and a while to create .mscr instead of .txt.
But it's a shame it only supports system, and not ring volume changing.
I love this site - every time i think my ppc is as good as i can get it, something else pops up to make it better

looping video recording. is it possible?

It occurred to me the other day that when on a windscreen mount the camera in the hd2 could be useful for in car video footage.
Seems to work fairly well but what would REALLY be great would be if you could set it to record a continuous loop so it only uses a fixed amount of card space unless you tell it save the file and start a new file.
Any idea if there are any apps that could do that?
Anyone?
Would be super useful to have. I nearly witnessed a nasty crash today and wished I had video to report the moron that nearly caused it, but can't just leave it recording at about 500-600mb per 15 minutes or so!!
+1 - Good idea, soon we're all going to have in car recording
Well I want to be able to show that if I'm ever involved in an accident exactly what happened and so on.
But kinda mainly because I just want to be able to do it to see if we can.
I suppose it needs to record to a set file size, then once that is done, to use an extra buffer amount of storage briefly while it deletes the file it just finished and begins recording again over the same space. Or something.
If you want it to keep anything you stop it and save it, then it starts from scratch.
Might be better if it actually keeps the current and previous file before deleting anything, then that way it's less likely to immediately/accidentally delete anything useful before you tell it to save. For instance you could maybe have a video screen overlay with a couple of large basic controls for save current recording and a couple of other bits.
Basically the important bit is the automated control over only using a specified file space then re-using it once it's used it up.
search forum... already discussed topic
http://forum.xda-developers.com/showthread.php?t=597003
Yep. Shame those options don't seem to work that well....
No other options for this then?

[Q] Android Developers, why are you treating my SD card like a garbage can?

This has been bothering me for quite a while, so I conjured a little story to help sooth my frustration.
Lets say my Android device is the new tenant of a nicely formated loft, this loft being 16gb of square space. To commemorate this new exciting space my device throws a house party. Most of the Apps he invites are pretty well behaved, but some start spilling drinks, then puking on the carpet, then having an orgy, then bukkake-ing the root directory. After discovering such acts, the device politely requests the disruptive guests force quit and leave. "I need more space on my phone." the device replied as each questioned on their way out. To his disbelief, NONE of the Apps cleaned up their mess! Even worse it seems some of the classier Apps, though more organized seem to have been influenced too. Unfortunately the device is forced to live with it, as the police force stopped responding to calls in his neighborhood. One man tries, but it always returns to a mess.
I hope that entertained someone.
i know exactly how you feel... there is at least 7 unused folders just wasting space on my phone. not to mention random mp3's hidden deep within my phone...
PhxkinMassacre said:
i know exactly how you feel... there is at least 7 unused folders just wasting space on my phone. not to mention random mp3's hidden deep within my phone...
Click to expand...
Click to collapse
I hope you understand about the unused folders and NOT the bukkake-ing!!
hello, nice story!
I won't say that I am even close to being a developer but I do develop some apps and the thing that I wan't to point out is that apps do not run when they are installed or uninstalled. It's not each application job to clear up the mess it may have created but package manager's which apparently leaves some files be just in case you would like to reinstall the app later(?)...
I would propose to look for a more efficient package manager or doorman/janitor for your loft
That's why I don't invite the guy whos only existence is to make farting noises!
Very good point. However, one thing I don't know is if uninstalling through the market cleans up the SD card better than using a third party mass uninstall app. Something you may want to experiment with.
Back at it again...
Here I am again, and I still don't flippin get it!
After reading some of your comments I realized my main point kind of got glazed over(no pun intended @Scudderb)
My big issue is that there's no hierarchy in place for this crap. In windows, program files are stored in the 'Program Files' directory. In Android (and I credit google and the developers for this sloppy BS) Apps are just throwing all their **** in with my stuff on the ROOT.
How is this acceptable. Seriously, HOW? And if its all cache files and/or temporary documents than WHY THE **** ISN'T ALL THIS CRAP BEING PUT INTO A TEMP/CACHE FOLDER.
I'm PISSED! Why does every app I install get to put their own folder on the ROOT WITH the FOLDERS and FILES that actually matter to me ex: like my music, pictures, movies, documents (OH and by the way, a lot of apps developers do a REALLY ****ty job with their NAMING CONVENTIONS so the folders being created may or may not even look related to the app that put it there!)
::end rant::
My apologies for the colorful language, folder structure and hierarchy are something I design as a web designer so when I see this crap going on in my phone like the inmates are running the asylum... I get angry.
Today I was cleaning up my SD card for the umteen'th time, and found that Foursquare was dumping its temp files directly onto the root of my directory. I blew my top and had to get it out of my system... so..
A MESSAGE TO ALL THE APPS PULLING THESE SHENANIGANS: GROW UP!
The problem here is that it's hard to do it right
For custom data, files are supposed to be saved into "/data/data/com.appname/blah" (that's from the top of my head, could differ slightly). That's the directory to use for data files, but there's one big issue with it: it's on the internal memory storage. We all know that internal memory on Android (without custom ROMs) is.. limited. That's probably why most devs are using SD for larger files.
There's also the "Android/data/com.package_name.blah/blah" directory on the SD card. This directory should be used by apps to store files into and is automatically deleted when the user removes the associated app (but only when you're running Froyo or greater).
The issue with this approach is that users (and developers too, when testing the app) will lose all their data when removing an old version of a specific app. Let's say there's a bug with the Market again and the app suddenly gets uninstalled. User will have to reinstall, result: data will be all gone. That's only one of the many doom scenarios.
I can't speak for other developers, but that's more or less the reason why I started to use a common directory outside of the preferred ones when I was doing apps. It's not a great situation, I fully agree. But would you rather have your data accidentally deleted?
If anyone knows a good way to get around this issue, I'd love to know more about it...
orly
Thanks for the reply @Stripeymilk
I can think of multiple solutions:
#1 Development community adopts a universal directory for files deemed 'User' or 'Save' data that should be stored for future use. (or Google creates this for developers)
#2 Development community adopts the practice of allowing users to pick the directory users want to store an apps data in. (prompt at app's first start)
#3 Store files/data in the cloud.
#4 Users dump trash in the lobbys/living-rooms of developer's and see how quickly they find a solution.
#5 USE THE "Android/data/com.package_name.blah/" FOLDER WHEN ALL YOU'RE REALLY DOING IS STORING CACHE/TEMP FILES!!!
BOTTOM LINE: Its not hard to do it right, Its just hard to get people to do it.
You make it sound so easy
1) I'm all for it, but Google needs to put its weight behind an approach like that because otherwise people will say "I like /Data better than /data or /Mydata or /MyData". It's a bit like coding conventions: everyone wants to be different.
2) Good for techy people, not so good for "normal" users. Could make it easier with a small "file manager", but that's too much work for indie devs. Could be a nice idea for a new open source project though.
3) Great idea, could actually work if the associated account would be created automatically (like in Cut the Rope for Android with Scoreloop), but:
- The backup functionality in Android for storing data in the cloud is available for API level 8 and greater, making it of not so much use when you're targeting API level 5 or 6 and greater. Could be fixed by using something like Google Storage combined with Jets3t instead, but that would be useless for apps written in C++, like many games are.
- Cloud storage isn't free. Developers can't pay for that as it would be too expensive. If every Android user would've gotten free cloud storage from Google it could be a nice alternative, but (yeah, there's always a but) most current users don't have that.
4) If you're prepared to send your trash by plane to another country, go for it!
5) Agreed. Useful for temp data.
I'm not trying to make it sound easy, believe me I know how it isn't. I'm trying to make it sound simple, because really.. it is...
In response:
1) I agree and this is exactly what I mean by the real hard part is getting people to do it. This requires widespread endorsement by developers big and small - that this is a 'best practice' that should be adhered to. I think the gate swings both ways though.
example: Twitter didn't invent hash tags, their users did, and with its widespread adoption, Twitter adopted/implemented it too.
2) Another good point, though this process can be curated to drive the user in the right direction (holding their hand). The XBOX 360 does this for every game you play, the first thing it does is ask you which storage device you want to use for game saves.
example: in combination with solution # 1, the default folder the app saves to could be '/data/theAppsName' and the prompt could say "This app saves files to your SD CARD in '/data/theAppName'. Would you like to choose a new location?" [Yes] [No] [?]. The [Yes] option brings up a simple file manager, the [No] option uses that location, the [?] option brings up an easy to understand write up on what its asking and why its asking it.
3) We'll get there eventually, my point really was if you've got the resources, why not. Its a solution better than #1 and #2
4) I plan on sending human clones to create trash individually and exponentially
5) AMIRITE~!
In all seriousness though, thank you @Stripeymilk for taking the time to go in depth and have a conversation about this. I seriously think it doesn't take an act of Godogle to solve this (to what I beleive) is a big issue!
I can't agree more with you.
As developer (Windows, iSeries) I try to make my programs as structured and readable as possible. The same goes for the files and folders used used by the programs, but sadly, even with all the available resources, some people (colleagues) make a complete mess of it, cause "that's not/less important", as long as the program does what it's intended to do ...
It's all about the resources and people using them the right way!
Cool, didn't know about the hash tags on Twitter
Well, we're on a great site here with developers on it. If everyone here would adhere to the same standard, it could at least be a nice push to make the Android SD card world a better place.
What's the directory we're going to settle on? Any pros and cons?

[APP] Motion detector with recording abilities

Hello everyone,
I am new to this forum. I decided to register here after I completed my android project.
I created a program that can detect movements and save pictures of the moving objects. Phone has to remain static in order to work properly. The program also features separate address book. Address book keeps phone numbers for SMS notification. In order to activate that you have to create a new contact then long press the item in the list. The program creates folder on memory card where it saves the pictures. The speed is very high on Galaxy S. You can throw something fast and phone still snaps the flying object if it passes by the camera.
The program has many settings that can dramatically alter the performance. Settings have to be adjusted in accordance with the lighting conditions.
I tested app only on 2.2 Vibrant. I am really curious to see how it works on other 2.2 devices.
ARMv7 processor is a must!!
Please give me some feedback!
App is called Motion Recorder
this sounds like a great app. gonna try it now on my incredible.
My app MobileWebCam also does this (simpler detection algorithm I suppose) and can automatically save, upload the pictures or send email:
Development Thread is here:
http://forum.xda-developers.com/showthread.php?t=950933
Are you interested in sharing your motion detection code? Possibly we could combine functionality of both apps?
dirtsky, If you have any questions or if you find any bugs please write in this thread.
The program is little hard to use so feel free to ask.
_miha_, Mine detects motion by analyzing color. What about yours?
How do you send e-mail without the annoying pop up?
theandre said:
_miha_, Mine detects motion by analyzing color. What about yours?
How do you send e-mail without the annoying pop up?
Click to expand...
Click to collapse
My motion detection is three steps: Image is converted to grey, then I max every pixel with the ones around to remove the flickering pixels (especially needed for night/low contrast situations) and calc the difference between the last and this new pixels. Some magic value (which should better be configurable later decides about the motion. Problem is this is very slow (should use the ndk but only began working with it recently) so I have to scale down the image before which is bad for small/distant moving objects.
Email: Is not sent with Android/Intent. I use JavaMail. I had some difficulties with the libs but got it working somehow (and even more difficulties with proguard which I needed because file size is getting too large without using it).
_miha_, did you test my app? How does it stack up against yours in terms of performance?
I cant seem to find where the images are being saved on my SDcard. Epic 4G Froyo ec05 midNight Rom
I looked for the folder "Motion Recorder" and i dont see it. and theres nothing in the Gallery
zman519, since your device is basically Galaxy S type it will save in internal memory(aka 14 GB "SD card").
Please let me know if you find the folder there.
I have total 105 installs out which 35 are active. Is it considered as bad result?
UPDATE: 59 active installs out of 109 which makes it >50%. Is it good?
theandre said:
zman519, since your device is basically Galaxy S type it will save in internal memory(aka 14 GB "SD card").
Please let me know if you find the folder there.
Click to expand...
Click to collapse
The Epic does not have an internal sdcard. That must be the problem. I looked around with root explorer and did not see the folder.
Sent from the Drivers Seat of my Suby txting and Driving doing 100MPH+ in a school zone! Ha.
zman519, thank you for feedback, I will fix that and let you know once the update is ready. It should not take more than half an hour.
Question to developers:
My program saves pictures to the following path:
String path = "/sdcard/Motion Recorder/TakenOn" +...
Why does it not automatically save to external sd card in the case when there is no internal sd?
UPDATE. I figured out myself. Working on update that allows user to choose between internal and external memory.
Hello dev,
I tried it on my DHD - it crashes and don't save settings.
I just updated to v0.42 which adds support for the external storage. Just go to settings and tap the checkbox. Unfortunately I have not tested the new feature on the actual hardware because I do not have one at the moment. So please, those of you who can test it please let me know if it does not work.
drast-x, Thank you for the feedback. Please give me some more details. When does it crash? After you hit the start? When you hit the start do you get the preview from the camera? Unfortunately settings do not save after the exit except contacts...
Did it happen on:Jun 11, 2011 9:32:07 PM ? I ask you this because Developer console shows me one crash that occurred at that time:
java.lang.RuntimeException: Fail to connect to camera service
at android.hardware.Camera.native_setup(Native Method)
at android.hardware.Camera.<init>(Camera.java:294)
at android.hardware.Camera.open(Camera.java:271)
Does saving pictures work on any of the phones except Epic 4g?
Thank you
I updated to v0.45
Now settings will save. Motion Recorder 0.45
Many thanks to the user of my app who sent this feedback:
"force close when start button clicked in nexus".
It turns out Nexus One (or S?) does not support either VGA or QVGA preview frames. So I had to fix this issue by requesting the supported resolutions. Very surprised by this issue. I expected that Android OS would figure this out on its own...
Thus new version 0.45.5 is supposed to fix the issue. I do not have Nexus One so I am not 100% about the fix. Those of you who are reading this and have Nexus One, please try new version!
Thank you!
Have you tried first reducing your image resolution to something ridiculously small like 32x32 and apply a DCT to keep only the low frequencies?
This might offer much better performance.
You can perform very good
_miha_ said:
My motion detection is three steps: Image is converted to grey, then I max every pixel with the ones around to remove the flickering pixels (especially needed for night/low contrast situations) and calc the difference between the last and this new pixels. Some magic value (which should better be configurable later decides about the motion. Problem is this is very slow (should use the ndk but only began working with it recently) so I have to scale down the image before which is bad for small/distant moving objects.
Email: Is not sent with Android/Intent. I use JavaMail. I had some difficulties with the libs but got it working somehow (and even more difficulties with proguard which I needed because file size is getting too large without using it).
Click to expand...
Click to collapse

[Q] Here's a quesiton on WP7.5 dev using SQL CE....

Alright so here's the deal:
I'm working on this app (let my raise my "nerd" level to a new maximum, by stressing that it is a Magic: The Gathering app for the WP7. Nerd level raised.)
So - at any rate - I start out with a wonderously fluid Silverlight front-end. Works like a charm. Keeping it simple at first, I get the ball rolling with a simple life counter function, using local variables only. Flawless. Then I figure I'll raise the bar of challenge a little, and import a simple dbusing SQL CE loaded from Wizards of the Coast official online card database. My app has a "fairly" quick search engine that goes through the entire set of cards and displays a list of the cards with text. Again, pretty damn flawless. Now here's the pickle. Because my SQL CE DB of the cards is pre-built into the app, it is, by default and no way to change it: read-only. I want to load and create a new DB on the fly, by reading a simple .txt file, and parsing out prices. Ideally, this DB would be created once, and everytime afterwards, simply updated. Now I can read and modify the Database easily, however, when i try to read the .txt file from the online source, it fails with epic certainty. Even more bothersome, I can't get the bloody thing to run efficiently in the background.
So to the question at hand: Does anyone know of a quality way to read a .txt file from an online source, parse successfully into a database, and do so as a background task?
Thanks
Could you elaborate on how exactly does it fail? Also, by "on background", do you mean that you are trying to update the database on a background agent (which I would not suggest in your case) ?
edit: Looks like it's a bit old thread. Are you still having this issue?
Well, by fail - I mean it either doesn't update the database at all - or it crashes and the program terminates.
And why would a background agent not be recommended? I like the idea of BG agent simply because i'm assuming the average user is going to be impatient and close out the app before the db actually updates the prices...at which point, it would be ideal if this were running as a background agent because otherwise i've discovered that just stopping DB search/edit halfway through sometimes hangs or crashes when you try to get back into the db.
Ideally, i'd like this thing to be pretty glitch free. I suppose i could do like every other app out there and only grab a price when a single card is selected, but ideally i would like the entire price database to be accessible in an "offline" mode. Its only a single text file updated weekly.
I see you're point on using a BG agent, but are you familiar with the limitations? You probably don't want to limit the sync to the moments when the phone is plugged into a power source, so periodic task would be your only choise. However, those are memory, cpu and clock time (25 seconds) constrained, run approximately every half an hour (can not be changed) and you can't start them instantly. Also, they need to be rescheduled every two weeks and there's a limit of how many BG agents can be scheduled for a device on total (can be as low as 6). So, you can only schedule the BG agent in your app, you can't start it immediately, if the completely sync process takes more than 25 seconds the agent would get killed and if the text file is somewhat huge you could run into the memory constraints of the agent.
I don't think there's anything you can do to make the sync succeed if user choses to close or suspend the app while it's syncing. I thought of an another option though: maybe you could just load the data for a card when it's drawn and store it to the database together with the last update time. Then in future you could first check if the database has up to date info on the card and use that instead of loading it from the web. Or maybe you could load the data for all the cards in the decks when the game starts.
Yeah. my solution for the time being is to see if there is an updated pricing text file online, and updating the silverlight accordingly (ie a "New prices available" button that appears if there are new prices) and a big ass warning box that warns users to not exit the app during an update.
however, i'm still having issues with parsing the bloody the txt file in-code. its a pipe-dil txt file so, it shouldn't be this complex to parse into a new table. i'll post up what some of the code looks like tonight for my parsing engine.
Sure, post ahead and I'll see if I can help you with that.

Categories

Resources