CWAC-Cam2 prerecorded video instead of camera - android

I'm building app using CWAC-Cam2 library. I need to test different application behaviour depending on objects exist on captured pictures. Is it possible to feed to the library video from a video file instead of actual camera output to simulate real environment conditions?
Thank you.
Sincerely,
Sergey

Related

Export video from android application to SD card

I am using below demo for creating slow and fast motion video in android application.
https://github.com/google/grafika
I am able to play slow and fast motion video in application but now i want to export this video to SD card.
I use TextureView to show video in app.
I use this java file to control speed of video.
https://github.com/google/grafika/blob/master/src/com/android/grafika/SpeedControlCallback.java
How can i do this?
any help will be appreciated.
Hi you have to use a MediaMuxer, call AddTrack for the video track and write the data to this track to the muxer after encoding each frame. You can see some examples in grafika page, one of them could be this: https://github.com/google/grafika/blob/master/src/com/android/grafika/ContinuousCaptureActivity.java (here you canhow to do both displaying on screen and recording on SD)
and another one: https://github.com/google/grafika/blob/master/src/com/android/grafika/CameraCaptureActivity.java
Also you can find more examples here:
http://www.bigflake.com/mediacodec/
Thanks

How to detect target on video feed from assets folder or URL using Augmented Reality sdk, instead of Camera

I want to detect the target on a saved video feed or URL video. For this, I have been looking around AR SDKs But found no sdk to support this. All SDKs are supporting the target detection on live camera only But not on saved video or URL streaming video.
Is there any way to do this?
Which SDK support this feature?
I'm not aware of any SDK doing this natively but instead of using camera frames you need to write a piece of code that reads the stored video (or connects to a given URL) and use those frames. In other words, all you need to do is replace the input source. Therefore I assume that any SDK that allows you to provide your own frames would be suited for your need.

How to create a fake Camera

Is it possible and if so "how" would one create a "fake" Camera in an Android application. By "fake" I mean an all software creation that simply looks like a regular Camera to the OS but in actuality takes a Bitmap or byte array as its input data. I want to use such a device with a MediaRecorder to create h.264 videos.
Things this could be used for:
Image slideshow video creation
Screen capture to video file
Caveats: No rooting and no ROM modification
I think what you are looking for is a way to encode videos to H.264 in a way similar to what MediaRecorder does but not from the camera. You do not particularly care whether this is done with a "fake camera" or in some other way, correct? In that case...
You can use the MediaCodec API available in Android 4.1 and later. You can just give it a series of images and it will create video encoded with (where available) the hardware encoder. Some sample code: Create video from screen grabs in android and Encoding H.264 from camera with Android MediaCodec
If you are expecting to affect other apps with your "fake Camera", that is only possible by modifying the Android source code and rolling your own ROM mod.
Yes,you can!
No rooting and no ROM modification,the best way to do this is to build a virtual app that runs the other app as a plugin,so that you can modify anything in the target app. But there is so much work to do, the best news is that there are several open source projects to do this.
And so, the next thing is not so difficult,you only have to hook several libs so in /system/lib that affect the camera recording.
In fact, I have done this on my device, but I modified the system lib directly, it has to be rooted of course. But it works well on almost all apps except some apps that use the service to capture video.
We have to modify the service lib, but it is a little more difficult.

Android - capture video with watermark

I know how to capture video on android device, but i would like to capture video and add some other information on it e.g. some funny timeclock and save it all to file so the person watching the video will see the exact time of capturing. I would also like to add some watermark.
Do you know how can i do it or is it possible on android device? I read the API but couldnt find anything that could help me.
I was being asked this question a short time ago, and as a backup we came up with some sort of backup plan: send your stuff to a server and let that (using ffmpeg?) do the watermark, save the file, and send a link back to the phone.. Maybe that's a route to take?
edit:
There seems to be an android port possible for FFMPEG. see for instance this link: http://gitorious.org/~olvaffe/ffmpeg/ffmpeg-android
I haven't had the time to compile it myself, but it seems you can either use the normal FFMPEG and the NDK, or use this version to compile for android. It's a bit more work, but looks do-able.
I actually don't think that's possible. You can fetch video frames from a camera preview, but there's no good way to encode them to video. The standard video encoder (MediaRecorder) can only record the actual direct camera input into a video file.

Example encoding video using FFMPEG for Android

I am working on an Android app, that needs to do the following:
- capture a (animated) view to video including audio (from a mp3 file)
- encode the captured video (probably a bunch of raw image buffers) and audio to avi.
After searching, FFMPEG seems the most suitable. Does anybody have a sample code to accomplish what I need. I would really appreciate.
Whyhow
It's not clear what you mean by 'a (animated) view' to capture, but be aware that android apps running with normal permissions cannot access the raw framebuffer. The computation part of ffmpeg builds in the ndk without undue work and there's a lot you can read about on the web, but the output (or in your case input) drivers are a bit of a permissions problem. Also you should expect encoding to be much slower than real time unless you can somehow manage to leverage hardware acceleration features of your particular device's SOC.
if u are building your app for android then u can use .avi writer code. You can get this code from "Koders website". Search for "Koders site" on google .you will get the link. I have tested the .avi file writer code and its working fine.

Categories

Resources