How to make H.264 file fast-forwardable in Android application? - java

I am an intern at company and my 'learning task' is to make Android application in Java, which takes H.264 format videos (at first they will be stored at SD card) and make like a very simple player, which would have the following features:
1.You can pause/play/fast-forward/fast-backward video
2.When you are at certain point of video and it is stopped, you can switch to the same time in a different video (same picture frame index i guess).
How could i do that? Is using Gstreamer a good way? I looked at the poor tutorial available on net and because of my lack of experience in video processing (I've never worked with video in Android applications) I have quite a hard time understanding what is pipelines, also the JNI and even setting up Gstreamer for Eclipse. Is there a better way of doing this? What should I get to know before starting to mess with this program?
Thanks, in advance!

All of your mentioned features are possible in Gstreamer, however, there is a learning curve.
To understand the GStreamer android tutorials, you must first go through the basic tutorials here: http://docs.gstreamer.com/display/GstSDK/Basic+tutorials
If you feel comfortable with the pipeline architecture, then go ahead and set up your android environment (which is no easy task by itself). Gstreamer is a very very powerful framework where you can do almost anything, if you're willing to make the effort to overcome the learning curve.
So i suggest to go ahead in gstreamer only if you have the time and patience, else go for a simpler solution. Unfortunately i'm not familiar with android, so i cannot suggest any. maybe a quick google search will help.

Related

How can I do face recognition of two images using opencv java in android

I'm trying to create a face recognition application in android studio in java language. I spent considerable amount of time, searching for step by step guides for achieving this function. I found many tutorials for python language and i couldn't find any proper tutorial or atleast a video tutorial for java.
Can someone please provide me with a proper link with the steps to do face recognition with OpenCv in android using java language.
I'm new to OpenCv, so i have no big idea on its functions.
Your help is highly appreciated
Update 1 ::
I'm trying to capture the image of the user and then cross check the taken image with an image that is already available in the gallery.
I want to know if both are the same so that i can allow the user to use the application.
I actually made a Java program that utilised OpenCV for facial recognition earlier this year.
For me it was an utter nightmare. Guides to doing this on Java are basically nonexistent and the documentation for Java OpenCV is very poor.
What I ended up doing to get to grips with OpenCV was I used PyImageSearch to learn how OpenCV works and then just trawled through the OpenCV javadocs until I found the most similar classes to what was being used in PyImageSearch.
There are a few guides for OpenCV recognition using Java (I'll have a look through my notes when I get a chance and see if I saved any links for my own reference) but none of them were for what I needed.
If you edit your post with some more information on the recognition you're trying to do (video or jpeg or png?; frontal faces or side faces?; specific faces or faces in general?) I may be able to help a little more.
The Youtube link that #Varma posted might help you get to grips with OpenCV as a whole, but that series doesn't seem to cover facial recognition.
EDIT #1
Okay, recognising who someone is via an image is definitely doable with OpenCV, but it's not something I've done. Here's a PyImageSearch page on how to do it in Python. The methodology for doing it in Java with OpenCV will most likely be more or less the same even thought the syntax will - of course - make it look very different (should mostly be a matter of finding the equivalent Java classes and methods).
If it proves difficult, there are alternatives to OpenCV you could use, like these or Google's API. Keep in mind though that facial recognition is not very secure and does come with some controversy.

How to build and use ffmpeg within android

I am prototyping a fairly simple camera app to test out using MediaRecorder to create a custom camera activity with one snag, I want to set the aspect ratio of recorded videos to a 1x1. Through much research I have found that this is only possible by using a library like FFMPEG to crop each frame of the video to the size I desire.
I have read many tutorials and articles on different ways to build FFMPEG into Android, but most of them are either outdated and use older versions of both the Android NDK and FFMPEG, or more recent ones just do not work when followed. I tried following the popular http://www.roman10.net/how-to-build-ffmpeg-for-android/‎ and a few other similar ones that all lead to an error about a missing pkg-config file because FFMPEG is generally meant to be installed on linux or another OS apparently. I found some information about building FFMPEG in android by using a make-standalone-toolchain.sh file here http://software.intel.com/en-us/android/blogs/2013/12/06/building-ffmpeg-for-android-on-x86 and can't make heads or tails as to how to go about using this method.
This now leads into my question: What is the best/proven way currently to build and use FFMPEG within android applications? If the standalone toolchain method is the way to go, is there any material better than the one listed that is easier to follow? I would even be open to a reliable template application with the FFMPEG Libraries ready to go (if this is possible); although, I would much rather know how to build this into android for future use.
Thank you in advance for any advice or suggestions on this issue.
I have successfully build ffmpeg libraries using
https://code.google.com/p/dolphin-player/
You have to be on Ubuntu to build that.
This is the guide I liked the most: http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/
If you need more options, you can take a look at these, which are equally good:
https://github.com/guardianproject/android-ffmpeg
https://github.com/halfninja/android-ffmpeg-x264
https://vec.io/posts/how-to-build-ffmpeg-with-android-ndk
EDIT: I updated the first link with a more recent article (it uses NDK r9).

Resize mp4 video with mp4parser

I'm trying to figure out how to resize/scale an mp4 video using mp4parser in an android app. After quite a bit of googling and looking through the mp4parser source and examples, I'm still not sure how to go about doing this.
Does mp4parser have some built in way of doing this?
If not, can I grab the raw video data and resize it myself using mp4parser? (a link to an example would be awesome if possible)
NOTES:
mp4parser website https://code.google.com/p/mp4parser/
I'm willing to consider using a different library than mp4parser, but I'd like something with licensing similar to LGPL. In other words, I am willing to supply library source code and give credit where credit is due, but I'd rather not be forced to make my source code publicly available. (This app will eventually be commercially available).
I need this functionality to append 2 files together that have different resolutions (taken from front camera and back camera).
I have successfully used mp4parser to append 2 files of the same resolutions.
I'm pretty new to video editing.
While I've relied on stackoverflow for many years, this is my very first question asked. Please be gentle. I'll gladly take constructive criticism on the proper way to ask questions here.
mp4parser will not have the ability to do this. To rescale a video, you must decode each frame, rescale then re-encode. ffmpeg (libavformat,libavcodec,swscale) can do this. As for LGPL compatibility, you may be able to achieve it for some codecs, but not all. I assume you are looking for LGPL to include this is a commercial app? If so, you must also license the codecs. For example, x264 is free/open source software. But distributing the videos it creates may require you to pay MPEG-LA.
I am searching it for long time. I couldn't find samples or example.
But i found working app in Google Play.
click to see

Sequenced video playback (cutlists) in Java.. can it be done?

If I have a bunch of video files, all in precisely the same format, shape, whatever, then can I play them back seamlessly without jumps or gaps? The effect from the end user's point of view would be as though they are watching one video.
I understand that this is possible in DirectX, but I'd rather use Java if possible.
If you want to play media in Java, the Sun standard is JMF (http://java.sun.com/javase/technologies/desktop/media/jmf/) which unfortunately has been dormant for quite a while.
The FMJ project (http://fmj-sf.net/) is API-compatible and under active development.
I cannot answer your question better, but hopefully this can get you further.

Video training program

I am looking to create a video training program which records videos - via webcam, user screen capture and captures sound. Now the main problem is that I need a cross-platform (mac and windows) solutions.
I know its possible to use flash to record webcam + audio. But its not possible to record the user's screen via flash.
So am wonder if I should use Java (which i believe will work on mac & windows). I do not want to develop to separate versions because of the cost involved in developing two versions.
Please guide me as I am new to this.
Thank you.
UPDATE
Hello again,
I had a look at the following site: www.screencast-o-matic.com or www.screentoaster.com. I see that they have developed a java applet which helps interact with Windows/Mac to record the screen.
I am wondering how to go about developing something like that and integrating it with Flash (for webcam and audio recording).
Is this a better idea?
This is not an answer to your question, but I strongly recommend against using video for educational programmes. Our company delivers university courses on-line, and we long ago learned that video feeds are only effective under particular scenarios. In general, a talking head is a waste of bandwidth. You're much better off to put together a well designed powerpoint presentation, record a voice-over (and edit it!) and then assemble the whole thing as a flash presentation. This is a non-trivial amount of work, but it provides a much more interesting product for the student.
When to use video:
1) When you are demonstrating something dynamic - Mechanics or Chemistry for example.
2) When you are acting out a scenario or case as an illustration -- For example, threat de-escalation techniques for high school teachers.
When you solve the screen recording problem, seriously consider whether you need full motion or if you can get away with stills. Often the motion is distracting, and a still with good voice over can be more effective. (Hint: Replace mouse pointers with something HUGE before recording -- Like Fox did with hockey pucks)
Try CamStudio. I don't know, if it works on Mac, but on windows, it's the best solution I know. It's open source, so you can use it's source code, if you want to :)
If you're looking to build an application that does all of the recording and screen capture itself, then you might consider using Adobe AIR (essentially, Flash running on the desktop) in combination with Merapi. Merapi is essentially a bridge between Adobe AIR and Java. So for example, for your project, you might use Java to handle the lower-level (but still cross-platform) stuff you can't do natively in AIR, and use Merapi to wire the Java application to your AIR UI.
This is by no means a simple project. Lets get that said and out the way. There are open source (and cross-platform) options for each element, but nothing (I know of) that will do everything for you.
I think the "cleanest" option would be to use Flash for webcam and audio, as you said, and run a VNC server to send the screen video... The only closed-platform code will be the VNC launching code. That should be pretty simple to maintain!
That raises a problem because most people are behind NAT firewalls these days. Setting up port forwarding is a pain in the behind. I've used an app called Gitso before which allows people to connect to me and send their desktop to my screen (for tech support). Its VNC-based and all it really does is add another layer on top of the VNC connection so rather than me connecting to them, they connect to me. That makes the whole business of port forwarding a non-issue.
And once you've recorded everything, there's the final issue of syncing it all back together... Might not be so hard.
Well, Camtasia provides the solution to get your problem done. It can record the onscreen activity and also the webcam video and put them in the same player template. Another screen recorder DemoCreator can publish the screen recording as Flash movie, but can not record the webcam.

Categories