What can I use to connect Java to Video4Linux? - java

I need to talk to Video4Linux (to capture output from a webcam) on a debian system running on an armel system (OpenMoko). JavaMediaFramework won't work in this case as it only have x86 and AMD versions. The linux kernel is 2.6.24 (with the v4l drivers compiled in separatly) and I cannot upgrade it (as it is not available on my hardware.

I have been following closely a project called video4linux4java . I now works with a lot of drivers (therefore a lot of webcams & capture cards), and produces a JPEG-encoded stream of images captured from a video device. Recently, the author has added classes to report information on the video device itself (webcam, TV tuner, ...). It is simple to use and comes with some examples. One of them (used to test v4l4j) displays a video stream in a JFrame. I use v4l4j in my own app to capture frames from my Logitech Quickcam Sphere AF, and control the pan and tilt. Works Great !

Video 4 Linux devices should be accessible through a device file (like /dev/video).
So I think you can open the device you want to access as you would do with a normal file and then read the stream coming from it.
To have more info about the devices, the video format etc... just check V4L web site

Related

How to create a loopback camera through Android HAL?

1\ Regarding to Android Source Project hosted by source.android.com, Android supports multi-camera functionality. Also we have some information about how a camera driver really works in Android.
2\ As you know there is an old project called v4l2loopback that you can install and run on your Linux (it's simple if you have root access). For example you can also have fun with ffmpeg to stream a video as a dummy webcam device. (v4l2virtualdevice_android)
Qust\ What I'm really watching for is simple in logic and hard to develop. I want a solution that my Android application (that is provided as an APK) will be able to create a dummy camera and I can feed that from another source (not really important; maybe a video file). So user will be able to use original camera app, Instagram app (Live), etc ... to record the video.
I don't really know if it's necessary for device to be root or not. And if it's possible how can it be done using java or NDK?
You can do that if you replace the system camera HAL. It's quite possible if you build a custom ROM. Having root access on a known device is essentially same as having your custom ROM. But this doesn't help if your APK is installed (with root access) on a different device, even if the changes are minimal. Sure you can prepare logic that will work on many devices, but each will require separate consideration and testing.

Is there a way to auto detect a camera (USB) on windows with Java/JavaFX?

My goal is to have a java application running, when the camera is plugged in or already plugged in, the program can auto detect the camera. After writing that sentence it doesn't seem possible in distinguishing between the USB drives on windows.
Can someone help me with pointing me in the right direction with allowing the user to specify the camera location? If the camera location is specified i should be able to auto-generate some sort of list of jpeg files on it correct?
My overall goal is to have a user enter a "job number", then from the camera (auto-detected or user location specified), the program automatically takes all the photos that exist on it, dump them into a folder named after the job number, then erase the photos on the camera.
It's like an auto photo storage dump pretty much.
I'm currently working with Eclipse and the JavaFX plug-in with using SceneBuilder.
libjitsi is an advanced Java media library for secure real-time audio/video communication. It allows applications to capture, playback, stream, encode/decode and encrypt audio and video flows. It also allows for advanced features such as audio mixing, handling multiple streams, participation in audio and video conferences.
Originally libjitsi was part of the Jitsi client source code but we decided to spin it off so that other projects can also use it.
libjitsi is distributed under the terms of the LGPL.
Feature list
Video capture and rendering on Windows, Mac OS X and Linux.
Video codecs: H.264 and H.263 (VP8 coming in early 2013)
.
.
.
More Info

BlackBerry Java Media Unsupported

I download an MP4 file from the internet and play it on the blackberry device. I get the following error: "the video portion of the media being played uses an unsupported format". The audio starts playing, but the video doesn't play, while showing this error.
It should be noted that this only happens on Device OS 5 & 6. The same video plays properly or OS 7 and OS 7.1. I am guessing this is because RIM included some updates to MMAPI. What could i do to allow devices prior to OS 7 play the videos? OS 5 & 6 devices play MP4 files, just not all of them.
I have been looking into custom decoding the bytes of the MP4 file, but that will take a lot of time, looking into existing decoder implementation before adapting to J2ME, not an easy task.
Any help would be great here.
Edit:
The video content owners have control of the videos on the server side, but arent willing to re encode, mainly due to size concerns on the server, even though i recommended they do as well.
The resolution of the video is about 720w x 400h. This is quite high for a BB, but Bold 9790 and Torch 9810 both play it without a problem. So why cant Bold 9780 play the same file?
Update:
Regarding the problem with the video playing on a 9790 and not a 9780, those are different devices. The 9790 came out about a year after the 9780, and apparently RIM added more capability.
From 9780 specs:
Video player DivX/WMV/XviD/3gp
From 9790 specs:
DivX/XviD/MP4/H.264/H.263/WMV player
So, that explains why you can't get that video to play on the 9780. If playing this video is fundamental to your app, you might change the settings in BlackBerry App World to list it as incompatible with 9780s. If this is only one of many features of your app, you might at least catch the media exception and inform the user gracefully that their device can't play the video requested, so they don't think it's your app's fault.
Original Answer:
MP4 actually contains a family of related formats.
The actual support for your video probably depends both on your BlackBerry OS version (e.g. 5/6/7) and also the device itself.
Here is a BlackBerry reference document that describes video format capabilities of various BlackBerry devices.
See also this reference document.
Of course, different devices also have different sizes of screens.
It might be useful for you to produce the videos in a variety of formats and resolutions, and have your BlackBerry app download different versions of the video depending on the device. Since video downloads are slow, doing it this way will also ensure that the user sees the fastest possible download on their device. There's no use downloading a higher resolution than the device can display.
You didn't specify whether you have control of the videos on the server side or not, so this may not be an option for you.

How to detect and capture video from webcam in java?

I tried programming a application that detects and captures video from webcam. I use JMF 2.1 and JDK 1.7u5 but when I compile and run my application, it couldn't detect any devices. And then, I tried with JMyron but it is not supported in x64 (My OS is Win 7 x64).
Can you tell me why? and how to capture video from webcam in my java application?
Thanks for your help!
JMF 2.1.1e works with a 64 bit JDK/JRE. I tested it on Windows 7 x64. Assuming the webcam drivers are installed properly and you could also test it with an alternative application such as Skype just to make sure it works, then you are set to verify your JMF installation.
Start JMStudio and go to the 'File->Preferences' menu. That brings up the JMF registry editor. Go to the 'Capture Devices' tab and click on 'Detect Capture Devices'. That should bring up your webcam in the list. It would be listed as 'WDM Image Capture' or something similar. Please note that if you want to commit something then you should have launched JMStudio with administrative privileges.
You can capture videos or take snapshots using your webcam by selecting the 'File->Capture' menu (Ctrl-P).
Your application should be able to use JMF and work with your webcam if the above works unless you forget to include the correct libraries or miss something in your code.
I know you might not want this, but I would recommend using HTML5 instead for capturing, recording or streaming videos. Have a look at http://www.html5rocks.com/en/tutorials/getusermedia/intro/ and hopefully you could make it out iff your requirement allows.
HTML5 has a lot of things to offer which can easily be achievable.

Which Java library to use for record a video from a connected camera?

You would have thought that tere is a simple solution to this but there isn't :(
My application needs to capture a stream from a USB/firewire (or whatever is the connection) connected camera (result would be a file like output.flv). I would prefer that I can detect all connected cameras and choose which one to use (one or more at the same time --> one or more output files). Application has to be cross platform.
Found libraries:
Xuggle - not very good camera support. Good for manipulating over images and video.
JMF - an old API but if I can use it, I will. I don't see a MAC OS X link on downloads page.
FMJ - looks like a better version of JMF but a can't find a way of installing it.
LTI-CIVIL - FMJ uses it. It looks like it only captures images from camera (not video). I could use Xuggle to create a video from images taken from LTI-CIVIL. And like FMJ, it is difficult to install.
What are your suggestions on this one?
I'd recommend VLCj for this - it should be able to stream from webcams onto a Java canvas without any difficulties. It uses native code so you need to provide libvlc.so / dll but from there on it should work on all the major platforms (Windows, Mac, Linux).
You may need to look at out of process players for complete reliability which is a bit more complex (see here for my efforts so far) but once you've got that in place it should work fine.
There really is no good camera support for Java. You will have to use native code, tailored for each platform, through JNI to get video capture for your project.
There's a related question here. Basically they're suggesting OpenCV wrapped with JNI.

Categories

Resources