Split Video with NDK for Android... - Android Software Development

Hello,
I have to do a task, that is more specific than a pure android development. I have to create an android application with a core module written in C or C++ language, doesn't matter, to do some video processing stuff. For example, the scenario is as follows:
1. The Android application captures 10sec video clip from the camera of an Android device;
2. Pass the captured file to the core of the android application;
The core should do the following:
3. Waits for the file, gets the file and opens it;
4. Splits the file into frames - for example, if the camera captures 30fps for 10 seconds video - 300 pictures in png or jpg format;
5. Do some calculations - for example it makes a histogram of a single image and stores it somewhere (db or file, doesn't matter);
6. Returns the result to the Android Code/Java/ which will render it on the default output - e.g. Screen, Console, etc...
How can I do this? I have searched how to split the video file into frames on linux, and I found that it could be done with ffmpeg, but I never dealt with ffmpeg and video/image processing... Could you help me somehow? I don't know what to do and where to start from...
Thanks in advance!
Best Regards,
v4o4ev

Possibly OpenCV / JavaCV
i dont know the exact code but i am sure you can get histograms and stuff with it.
try looking here
http://code.google.com/p/javacv/
Pvy.

pvyParts said:
Possibly OpenCV / JavaCV
i dont know the exact code but i am sure you can get histograms and stuff with it.
try looking here
http://code.google.com/p/javacv/
Pvy.
Click to expand...
Click to collapse
Thank you! The problem now is how to split the video into frames... I am searching about ffmpeg compatibilities, but for now I'm just researching... And one thing - I don't need the code, just the help to find some information about how to do it better and so on thank you so much for the reply - I will take a look now
Thanks!
Best Regards

v4o4ev said:
Thank you! The problem now is how to split the video into frames... I am searching about ffmpeg compatibilities, but for now I'm just researching... And one thing - I don't need the code, just the help to find some information about how to do it better and so on thank you so much for the reply - I will take a look now
Thanks!
Best Regards
Click to expand...
Click to collapse
In java I use the highgui classes, createframegrabber or something like that. I grab each frame and process it for item/motion detection. Then save a movie from it. Works well enough.
Sent from my Galaxy Nexus using xda premium

Related

[03/29/08] Perptual v0.3 with image viewer

Perpetual is a simple image zooming demo.
You can zoom on any of the 200 images, and the pixels will turn into other images to zoom, perpetually.
What is it for ?
Nothing ! It's just a proof of concept and a demo I made...
If you have any images to submit to add into the demo, feel free to post in the forum and we'll update as soon as possible ! I'm looking for images that have nice colors and an overall dominant one (that'll be used for the color detection) Thanks for helping support this useless project !
Download Perpetual​
Also available :
Perpetual Image Maker
Sexy Image Pack
Kaiser47's DeviantART selection (really awesome pack !)
SaintSeya pack
Zen nature pack
v0.3 (03/29/08)
- New prp format (old ones should still work though) with additionnal data : author, icon, etc...
- New menu using the new prp format data, looks much better !
- Now saves viewed purcentage !
- Now works with Smartphones !
- Fixed menu bug if you had too many packs
- Much higher image quality while zooming
v0.2
- Fixed image bug when you have more than 256 images (that was stupid)
- Fixed potential crash when moving around too much
- Fixed surface bug when you moved around
- PerpetualMaker updated, smaller exe
- Improved performance
- New image viewer to select start image
- Now over 300 images !
- New Image Pack maker : just put in any directory, and it'll take all the images from images/ (still requires 240x240 jpeg images) and do a pack (.prp file)
- New splash screen, with possibility to select pack to display !
- Fixed random crash when changing speed while in auto mode
- Speed button : x0.5, 1, or 2
- Auto button for lazy people
- Surface button to come back to the unzoomed image
A video is available on that page if you want to see what it looks like without downloading/installing
Thanks for the feedback, suggestions, and images !
Fascinating software - it works perfectly in portrait, its a bit slow and landscape, and it doesn't handle the change from portrait to landscape well.
Thanks for making my Kaiser much cooler however.
Any way the process could be automated, to make it into a semi-interactive screensaver?
Surur
Well, technically, it's automated on my PC (there's no way to add all the needed data for the colors of the 200 images alone ^^) : I just have a folder with the images, launch my .Net app, and it scans through all the images, sorts by color, and outputs both miniature views (to avoid overloading the memory) and a huge array with the number of the image to use for every 16bit color ^^
It takes a while to run on my PC, so it's unlikely to work on in realtime, would have way too much loading time. I have just thought of an alternative method to build the color array, it could work much faster, but would only be available for real-time if you have only a few images... and if you don't have many images, well... It won't work to well ^^ You need to have at least 50 or 100 photos, ranging in pretty much all the possible colors (my PC app outputs which colors are overpopulated and which aren't populated enough, to know which images to remove and what colors to search for) ^^
While it would be cool to use my own pictures, it would be nice to see it zoom through the stock images without me having to touch the screen with the stylus too, independently.
Surur
Well, this is a first release, I just wanted to have a quick proof of concept and that's it ^^
The future stuff that could be added :
- "Surface" button (to move back up)
- Auto button (could be nice to for lazy people ^^)
Anything else ?
A zooming back feature would be cool
sercio said:
A zooming back feature would be cool
Click to expand...
Click to collapse
Would that be for the skin-tone pictures ?
Surur
yeah
Btw there should be alot more pictures kind of ^^
This looks really cool I will have to try this on my Hermes. Does it work for VGA and Qvga?
*Edit* Only Qvga any plans for VGA? *Edit*
Alkhal said:
*Edit* Only Qvga any plans for VGA? *Edit*
Click to expand...
Click to collapse
Well, it should work on VGA, just that it's upscaled. I tested on emulator and the performance was good.
In theory, a 100% VGA version could be done. But the program is already 5MB, uses a lot of ram for all the images, and a full VGA version would just use 4 times more ram :s
Btw there should be alot more pictures kind of ^^
Click to expand...
Click to collapse
Feel free to post some images (or send them by mail/PM) and I'll add them ^^
*Edit*
Ok here are some random Pictures i found and had on ma system! I extra made them 240x240 so you dont have any work rescaling them
Btw i would like if the "zooming" effect could be more smoother and slower if its possible...
Hope you like ma pics!
Regards
Thanks, let me check that out.
As for zooming, the speed can be changed, not a problem I didn't actually test on hardware, just on emulator, so it might not be optimal yet...
TODO list (note to myself) :
- Auto-zoom
- Back button
- Speed button
edit : hey, nice set of pics I'll definately include most of them in the next release (either as additional pictures or as a remplacement. like flickr-color-picker.jpg which will be perfect to replace a sort of crappy image I had in the same style ^^) Thanks !
edit2 :
Better not or are you willing to made a "special" adult version ?
Click to expand...
Click to collapse
Could be fun if you know where to find nice pics (IE, with nice and different colors, won't be as simple)
edit3 (last one, I promise !) :
Still looking for a good theme for the icon and the viewer, if anyone has an idea, please share !
I found few random pics... hope you can use them
Yay, those are awesome !
I'm currently finishing a set of 50 sexy photos, then I'll see if it works good enough with those
Cool and amazing app! Works perfectly on WM2003! Keep working
I think that you should make other app like that: http://www.mazaika.com/mazdownload.html for ppc (WM 2003 support for sure! ).
Nice work!
Thanks for the link. That one seems nice too, but the images are in 64x64, whereas I use nice and big 240x240 images ^^ I'm thinking of modifying my PC .Net exe and redistributing it... It could produce a file like myimages.prp which would contain all the data needed, and could be copied on the PPC to open it...
As for SexyPerpetual, tested, it works pretty well ! The images aren't the best as I used the first image pack I could download on bittorrent. Not sure what the forum policy is for the kind of stuff, so I will not post a link to download it. Just send over a quick PM requesting the link and I'll answer back
As for the video, if you want to take a look, here the link for the normal version's video : http://www.palib.info/blog/flvplayer.swf?file=http://www.xflib.net/Games/Perpetual/Perpetual.flv
Just keep replace the name by the sexy version's name and you should be able to view it (if the admins don't want this posted, please just tell me and I'll remove it !)
yes it woudl be cool if you can provide a tool that we can use to compile "our" versions with our pictures. it would be simpler than having to make special requests to you and sending many pics ?
but also if you really want pics, perhaps we can all send some to you ? public ftp or classic sharing sites like rapidshare ?
SexyPerpetual is very nice But insert "more naked photos" xD
BTW: I like kaiser47s idea
Kaiser47, feel free to use any method to send of photos
Yeah, I know, the sexy version misses a few naked photos ^^ But I just took a pack found on bittorrent, and used the ones with the most colors (because if I use only naked women on a white background, the transitions will be crappy, so I needed to have blue, red, etc....). If you have a pack with nice naked photos, I'll add them to the pack
I'm currently modifying the PC part of the code to generate a special file which could be distributed and read by the PPC app, that way anyone can do an image pack
Cool idea
I do not have ones so I will w8 for new versions xD

Video editing software for our Diamond ?

Hi all,
I used to be really enthused by the small video editing app included in my Sony Ericsson fans. It was very useful to edit video, make personal editing etc... to send via MMS. Assembling clips was made easy and intuitive.
I can't find such an app for pocket PC. I stumbled onto http://www.trakax.com/software/mobile. It's a useful editing software with cutting edge graphix, but not free and quite cumbersome to use...
Do you happen to know a complete video editing software for our beloved pocket pc? It SHOULD exist but I could'nt find anything out there...
THX a lot !
I found nothing.. I hope there will be some video editing software some day, i had a sony ericsson phone, and they have this simple video editing software called VideoDJ. So maybe there will be one to ppc too...
I don't know about video editing for PPC (maybe there r some) , but I think You don't need such a program, you can
edit it by using PC (with many video editing programs) and export the file..
arix said:
I don't know about video editing for PPC (maybe there r some) , but I think You don't need such a program, you can
edit it by using PC (with many video editing programs) and export the file..
Click to expand...
Click to collapse
I like those simple video editing software. Video editing wherever you go..
niikoo said:
I like those simple video editing software. Video editing wherever you go..
Click to expand...
Click to collapse
I just hope you have electricity socket ready wherever u go
i used to use trackax mobile on my atom exec:
http://www.trakax.com/software/mobile/
edit:
missed that you found it already...reccomenned though
New Version of TrakAxPC for VGA devices
Hi Cormac here from TrakAxMobile.
Just a quick note to say we have released a new version of trakAxmobile for VGA devices.
Here is quick list of the improvements we have made.
1) We have improved the search function, allowing you to search your content by day/month/year. You can also highlight a number of days/months or years. This will allow you find the media on your device much quicker.
2) We have also improved the editing. We now decompress the file when you click on the edit button allowing you to access time positions in the file quicker and easier. When editing audio you can just highlight the area you wish to cut on the waveform with your stylus.
3) We now allow you to crop photos and you can add a ken burns effect to photos allowing you to Pan and Zoom into particular areas of the photo.
4) We have added a whole range of new transitions.
5) In the mixing screen, you can now control the tempo of the media by switching the slider function from volume to tempo. The slider now allows to slow down or speed up the clip. This is cool if you want a video clip to play in slow motion or wish to speed it up. The same applies to audio, you can speed it up or slow it down by adjusting the slider.
6) We now also allow you add themes and effects to videos or photos. You can also change the color of the text and add background colors to your credits.
You can check out the new features at our website -
http://www.trakax.com/software/mobile/trakaxmobile_vga_devices/
and there is a 7 day free trial available from the following link.
http://www.trakax.com/software/mobile/trial_version/
Check it out and if you have any question, please don't hesitate to contact me.
Best regards
Cormac
Been using trakAx for a while now - awesome app!!!
Just be patient when its rendering your clips as it can take a while - its got a lot of processing to do.
Output is only 640x480 though I think

[C#/C++] Camera Access with DirectShow

Hi Guys,
Because the standard API's to use the camera aren't flexible enough I need to use directshow.
Unfortunately I'm not a very good C++ programmer (more C# ;-))
I found this solution. Wich compiles a C++ DLL and can be called from C#.
Perfect! Except the C++ code doesn't really do what I want to. (And I have no idea how to change it)
See attachement for the C++ project
Dll does: Capture one frame from the camera and store it as a file. (with 320x240 resolution, not great quality)
I'd prefer to use the best available quality, or mayby choose the quality I want.
Also I'd prefer not saving/storing the file but return a stream / bitmap / image
Because I only want to show it on screen (actualy let a mobile webserver respond an image with as much frames per sec as possible)
(Saves a step, storing and deleting everytime)
Any Help?
PS. I also tried Directshow.Net Library But it doesn't seem to work on Windows Mobile.
C# Code
Btw, this is the code I use in C# to create the functions:
[DllImport("CameraCaptureDLL.DLL")]
private static extern bool CaptureStill(string Path);
[DllImport("CameraCaptureDLL.DLL")]
private static extern bool InitializeGraph(IntPtr hWnd);
Just to keep y'all posted, I'm now looking @ this solution (CodeProject.com)
They rewrote the DLL file, and I think it's gonna do what I want, but I first need to install Windows CE 5.0 wich takes alot of time....
I met same problem with you.
I just want to show the camera sight, like the Camera app's Preview function.
I don't know if there is a HTC's Camera SDK.
Please keep contract, if I have any improvment, I will tell you.
I had fun with camera but not using directshow or the preview...I'm just launching the camera app (using sample camera in SDK).
If anyone find an easy way to have "embedded camera display" in an application I'm really interested!! (like a pictureBox having camera as image source)
If I found something I'll tell...
DarkAngelFR said:
I had fun with camera but not using directshow or the preview...I'm just launching the camera app (using sample camera in SDK).
If anyone find an easy way to have "embedded camera display" in an application I'm really interested!! (like a pictureBox having camera as image source)
If I found something I'll tell...
Click to expand...
Click to collapse
I found functions and its parameters by sniffig camera calls on my VOX
Captured data is stored as UYVY.
m32
m32 said:
I found functions and its parameters by sniffig camera calls on my VOX
Captured data is stored as UYVY.
m32
Click to expand...
Click to collapse
Could you provide the compiled version of the htccamera dll ?
Will try to build this later (@work don't have cc compiler, just VS2008)
Thanks!
An in-memory capture would almost certainly improve the live-scan mode in Barcorama also! I could really use that in-memory capable CameraCaptureDll.dll.
Many users seem to have successfully compiled the source at http://www.codeproject.com/KB/mobile/samplegrabberfilter-wm6.aspx, but I can't find the compiled dll somewhere .
I fail to compile it myself as it needs the WindowsCE Platform Builder and VS2008...
Anybody that comes across the DLL, please share!
have fun,
hypest
Hello,
working on it ^^ I will upload the dll here later today
Here you go : download (if fails : try here)
is the source code compiled (look in /bin/Release). Tested and works nice (deploy the dll then the sample app).
Hope this helps!
Thanx!!
will try it!
UPDATE:
The sample opens up but seems to do nothing on my kaiser. <-UPDATE: wrong! it works OK.
I have managed to use the DLL directly though. The capturing works fine but the capture-stop seems to fail: the Stop() function hangs. I use the Shutdown() that seems to be OK, but then I have trouble re-initializing the whole procedure. Also, there seem to be a sensitivity on manually using the garbage collector.
Thanks again anyway!!
Cannot seem to import the dll into another project
@DarkAngelFR
Thanks very much for the sample app for video streaming, was very helpful.
However I really need to use the dll or even the import the CameraCaptureDLL c++ code into our project. I have already read over the ReadMe text file but need further help on how to create this object? Have already tried the Ignore Input Library property and that does not work sadly. Any help would be great!
Thanks,
John
m32 said:
I found functions and its parameters by sniffig camera calls on my VOX
Captured data is stored as UYVY.
m32
Click to expand...
Click to collapse
I have build the camerasniffer dll (and called it htccamera.dll) with mingw32ce, but how do I use it?
I tried copying it to "/windows" and rebooted the phone (hermes) but I do not get a log file on the storage card. Any hints?
Thanks a lot!
Hi,
I got this error when I try to debug this application on my mobile (HTC HD2)
"An unhandled exception of type 'System.MissingMethodException' occurred in TestCameraCapture.exe
Additional information: Can't find PInvoke DLL 'CameraCaptureDLL.DLL'."
But it seem to works fine on the Emulator.
How can I test it on my mobile then?
EDIT
Problem solved, I just had to copy the 'CameraCaptureDLL.DLL' file to the folder where the application is running.

QMG files and Quram Slideshow?

Anybody know what QuramSlideshow.apk does? I've noticed it in /system/app while de-bloating a few Vibrants. I'm kind of wondering if it's the player for the mysterious .qmg file formats (the boot-up animations).
There is even a Quram Software in Korea, whose "about" page has this interesting comment:
we have studied and developed new technologies for digital image compression/edition, binary code, resource (font, wave, movie and so on) and data compression, and simultaneously have deployed embedded software related business while co-working with several leading companies in mobile area.
Click to expand...
Click to collapse
http://quramsoft.com/company/overview.asp
Are there decompilers for apk files? Or can they be analyzed as raw bytecode?
MV10 said:
Anybody know what QuramSlideshow.apk does? I've noticed it in /system/app while de-bloating a few Vibrants. I'm kind of wondering if it's the player for the mysterious .qmg file formats (the boot-up animations).
There is even a Quram Software in Korea, whose "about" page has this interesting comment:
http://quramsoft.com/company/overview.asp
Are there decompilers for apk files? Or can they be analyzed as raw bytecode?
Click to expand...
Click to collapse
http://www.cs.cornell.edu/home/vavasis/qmg-home.html possibly, but I am assuming this is the project. If someone wants to compile the software it looks like we could edit it.
nbs11 said:
http://www.cs.cornell.edu/home/vavasis/qmg-home.html possibly, but I am assuming this is the project. If someone wants to compile the software it looks like we could edit it.
Click to expand...
Click to collapse
No, that's an engineering analysis utility. Just a coincidence, but it's all you'll find if you only hit up Google with QMG.
QuramSlideshow.apk is the slide show app, for some reason the slide show feature of the gallery app is built as a different app all together. A simple rename of QuramSlideshow.apk made cause the slide show viewer not to pop up in the gallery app.
So anyone knows how to produce\edit\view .QMG video files like the "bootanimation.qmg" ??
Thanks
Not so far. Quram's Qmage codec (see URL below) is the codec for reading and writing QMG files but so far nobody has laid their hands on a copy to see what makes it tick.
http://quramsoft.com/solution_e/qmage.asp
MV10 said:
Not so far. Quram's Qmage codec (see URL below) is the codec for reading and writing QMG files but so far nobody has laid their hands on a copy to see what makes it tick.
http://quramsoft.com/solution_e/qmage.asp
Click to expand...
Click to collapse
They may be good at producing a codec but not so great at proof reading!
"Recently mobile manufacturer trends to employee more images to support fashionable UI and multi-functions, which results in increasing costs of memory and degrading user’s experience in UI performance. "
employ maybe?
cappysw10 said:
They may be good at producing a codec but not so great at proof reading!
"Recently mobile manufacturer trends to employee more images to support fashionable UI and multi-functions, which results in increasing costs of memory and degrading user’s experience in UI performance. "
employ maybe?
Click to expand...
Click to collapse
lol
btw, any news on the case? anyone knows where i ican get a copy of the encryption software or something like that?
Thanks,
Interesting, this one. Quram claim 80%-90% lossless compression. Really?
I did find some interesting StackOverflow posts that seem to centre around an image editing tool:
http://stackoverflow.com/questions/5607318/intptr-causing-memory-leak
http://stackoverflow.com/questions/5610294/opencv-memory-leak-issue
but we don't get any glimpse of compression, sadly. Whether this is related to the Qmage codec/toolset or not is anyone's guess.
I'm going to pull the QMGs off my Galaxy Tab and have a poke around with a hex editor, it COULD be really simple. There are a number of schemes you could use to get a variety of quick wins with low CPU compression. The key to working out the file format is to find the bits that couldn't be compressed first - they're likely to be a raw bitmap.
That's not a promise that anything can be done, though.
madkat said:
Interesting, this one. Quram claim 80%-90% lossless compression. Really?
I did find some interesting StackOverflow posts that seem to centre around an image editing tool:
http://stackoverflow.com/questions/5607318/intptr-causing-memory-leak
http://stackoverflow.com/questions/5610294/opencv-memory-leak-issue
but we don't get any glimpse of compression, sadly. Whether this is related to the Qmage codec/toolset or not is anyone's guess.
I'm going to pull the QMGs off my Galaxy Tab and have a poke around with a hex editor, it COULD be really simple. There are a number of schemes you could use to get a variety of quick wins with low CPU compression. The key to working out the file format is to find the bits that couldn't be compressed first - they're likely to be a raw bitmap.
That's not a promise that anything can be done, though.
Click to expand...
Click to collapse
Any update?

How to overlay two videos

there is two videos , first one is normal video captured by phone camera from my room and second is flying butterfly in white background.
how can i overlay second video on the first one and build a final video that butterfly , fly in my room ?
thx
Is this a development question??
coolbud012 said:
Is this a development question??
Click to expand...
Click to collapse
i guess so , i just want to do something like "FxGuru" app but much simpler on my app ,
my app gets two video files and output the result as a video file , like what i said in the first post
i searched , i mean alot , but still no clue where to start ,
so , i would be thankful for any help
_joey_ said:
i guess so , i just want to do something like "FxGuru" app but much simpler on my app ,
my app gets two video files and output the result as a video file , like what i said in the first post
i searched , i mean alot , but still no clue where to start ,
so , i would be thankful for any help
Click to expand...
Click to collapse
do you know java or c++ ? Do you know video formats and any image processing ? and maybe a little about composition/compositing along with pixel blending modes ? Cause what you ask is quite substantial and requires quite a bit of background knowledge
deanwray said:
do you know java or c++ ? Do you know video formats and any image processing ? and maybe a little about composition/compositing along with pixel blending modes ? Cause what you ask is quite substantial and requires quite a bit of background knowledge
Click to expand...
Click to collapse
i know java and c++ syntax and coding , and a little bit of image processing but just a little bit
i think there is following phases to do the job
phass 1: extract a picture frame by frame from video 'A' and video 'B'
phass 2: map each frame picture into a matrix 'A' and 'B'
phass 3: apply image processing algorithms to matrix 'A' and 'B' and build final matrix 'C'
phase 4: build a frame picture from matrix 'C'
phase 5: make a video file from 'C' frame pictures
phase 6: mix up 'C' video file and audio file into a single final video file
but i don't know how to do each step in java and android SDK ?!
really ?
nothing ?!
_joey_ said:
really ?
nothing ?!
Click to expand...
Click to collapse
well you seem to have the tasks down, are you asking for people to do the code for you?
What I will say is the blend driving component or the "matte" that will be used will need some clever extrapolation ... hence why I say look at compositing software and tech ... find a way to generate the matte/mask or however you want.
Since you control the source, you would have control over the key/matte/mask anyways, but white is not a great choice Blue. Green. or even separate bit channel or stream would be best

Categories

Resources