I want to (manually) adjust the "shutter speed" of my webcam with Java code.
Is it possible to do this (with java) ?
How do I realize it ?
Extra info:
Windows vista and NetBeans IDE 7.3.1
Webcam : Logitech webcam pro 4000
Driver : Quickcam v11
Language : java
Library : LTI-CIVIL with example code for image capturing
I think I need to adjust somewhere the time between the command for
the camera to collect light and stop collecting light. (half thinking of
an SLR camera).
There are certain available API's that can be used to control your webcam using java.
Java Media Framework (JMF)
The Java Media Framework API (JMF) enables audio, video and other time-based media to be added to applications and applets built on Java technology. This optional package, which can capture, playback, stream, and transcode multiple media formats, extends the Java 2 Platform, Standard Edition (J2SE) for multimedia developers by providing a powerful toolkit to develop scalable, cross-platform technology.
Freedom for Media in Java (FMJ)
FMJ is an open-source project with the goal of providing an alternative to Java Media Framework (JMF), while remaining API-compatible with JMF. It aims to produce a single API/Framework which can be used to capture, playback, process, and stream media across multiple platforms.Since FMJ is API-compatible with latest JMF, you may use existing JMF codes and run them.
Xuggler
Xuggler is the easy way to uncompress, modify, and re-compress any media file (or stream) from Java. This is more widely used for manipulation of media files and related operations.
You can refer the following links:
Java Media Framework
Freedom for Media in Java
Xuggler
You can find tons of tutorials on them. I'm sure you can figure out an efficient way to control the shutter speed of your webcam using any of these API's. :)
Related
I want to be able to play video files that were downloaded from a web server, as .mkv files, in a Swing application. What is a good library for doing this? Also, although this isn't really necessary, I would prefer it if it was a jar file, so that it could download it via the application and the end user wouldn't have to install anything manually.
Thanks!
You can use vlcj - Java Framework for the vlc Media Player
Taken from the site:
The vlcj project provides Java bindings to allow an instance of a native vlc media player to be embedded in a Java AWT Window or Swing JFrame. You get more than just simple bindings, you also get a higher level API that hides a lot of the complexities of working with libvlc.
You can try using JMF: http://www.oracle.com/technetwork/java/javase/tech/index-jsp-140239.html
or FMJ (open source version with some ffmpeg hooks): http://fmj-sf.net/
I'm not sure how well those projects are maintained though.
I have been trying to find a way to get the metadata out of video files such as frame rate, length, codec, aspect ratio. What java libraries are out there that would be good for this?
You can use VLCJ (GPL license)
VLCJ wraps around libVLC DLL library (the library used in VLC) via JNA for Java app. It supports reading the metadata from a media file via MediaPlayer.getMediaMeta()
Take note: certain versions of VLCJ don't work in full functionality with certain versions of libVLC. For example, VLCJ 1.2.x only works perfectly well with libVLC 1.2.0 (which is not released yet - a nightly build at the moment). If you use it with libVLC 1.1.x, it won't be able to read media file metadata via MediaPlayer.getMediaMeta(). In this case, you need to get the correct libVLC library for VLCJ version you choose.
http://code.google.com/p/vlcj/wiki/WhichVersion
VLCJ 1.2.x has some design changes when compared to VLCJ 1.1.x which may frustrate seasoned developer of VLCJ but it is for the good reasons.
I wanted to stream live audio & video from one client to another over the internet, I'm using WebSphere community edition as my server, and I'm supposed to do this task using Java EE technologies.
I'm doing this as a part of the project for IBM TGMC.
Which particular API or tech is best suited for my purpose?
I googled for JMF, but heard that it's a bit complex and old. Is there a better alternative?
JMF is complex because media handling is complex - there is no 'magic wand'. It is not only old but abandoned.
JMF works just fine for the codecs it supports, but those codecs are not as compressive as some that were developed later. OTOH if you can develop an encoder/decoder for the codec of interest, it should be relatively simple to get JMF to use it - JMF supports new codecs via the SPI.
No there is no better alternative that I know about. FMJ was designed as an alternative to JMF, but last I heard, it had also been abandoned.
Is it possible to stream mp3s using pure Java?
If so, what are the best resources to implement this.
If not, are any other music formats streamable using Java only?
As Mario says, JMF - Java Media Framework is a good starting point.
What Mario does not say is that Sun killed MP3 support since 2.1.1b as detailed in the "My Lost Streaming MP3 Article" blog entry.
So you need to add a plugin to support MP3:
the JMF Formats list does mention MP3 (under the ACM -- Window's Audio Compression Manager support -- section), but only for Windows, and not with JMF alone.
You could use MP3SPI from JavaZoom to stream MP3 files
As it says on their webpage:
"MP3SPI is a Java Service Provider Interface that adds MP3 (MPEG 1/2/2.5 Layer 1/2/3) audio format support for Java Platform. It supports streaming, ID3v2 frames, Equalizer, .... "
People have already used it to build applicatons that stream from Shoutcast
Hope this helps
I think you can use the Java Media Framework from SUN to achieve what you want. Being this the official SUN implementation this would be the way to go. I am pretty sure that the actual streaming is native though.
I looked in the FAQ and I found the following answer:
Q: Will JMF 2.1.1 support streaming?
Yes. JMF 2.1.1 provides RTP/RTSP
streaming support.
JMF 2.1.1 also provides HTTP and FTP
streaming support on the client side.
I want to generate a thumbnail preview of videos in Java. I'm mostly JMF and video manipulation alienated.
Is there an easy way to do it?
What about codecs? Will I have to deal with it?
Any video type is suported? (including Quicktime)
Well, since you're not stuck with JMF, have you considered Xuggler? Xuggler is a Java API that uses FFmpeg under the covers to do all video decoding and encoding. It's free and LGPL licensed.
In fact, we have a tutorial that shows How to Make Thumbnails of an Existing File
There seems to be a few examples out there that are far better than what I was going to send you.
See http://krishnabhargav.blogspot.com/2008/02/processing-videos-in-java.html.
I'd agree with Stu, however. If you can find a way to get what you want using some command-line tools (and run them using Commons-Exec), you might have a better overall solution than depending on what is essentially the Sanskrit of Java extensions.
Are you sure that JMF is right for you? Unfortunately, it is not in particularly good shape. Unless you are already committed to JMF, you very well may want to investigate alternatives. Wikipedia has a decent overview at en.wikipedia.org/wiki/Java_Media_Framework
Many JMF developers have complained that it supports few codecs and formats in modern use. Its all-Java version, for example, cannot play MPEG-2, MPEG-4, Windows Media, RealMedia, most QuickTime movies, Flash content newer than Flash 2, and needs a plug-in to play the ubiquitous MP3 format. While the performance packs offer the ability to use the native platform's media library, they're only offered for Linux, Solaris and Windows. Furthermore, Windows-based JMF developers can unwittingly think JMF provides support for more formats than it does, and be surprised when their application is unable to play those formats on other platforms.
Another knock against JMF is Sun's seeming abandonment of it. The API has not been touched since 1999, and the last news item on JMF's home page was posted in November 2004.
While JMF is built for extensibility, there are few such third-party extensions.
Furthermore, editing functionality in JMF is effectively non-existent, which makes a wide range of potential applications impractical.
My own server-side app shells out to FFmpeg to do the encoding. I'm 98.42% sure FFmpeg does snapshots, too. (It is an all singing, all dancing beast of a program. The command line options alone could fill a book.)
Check it out: ffmpeg.mplayerhq.hu
There is a relatively newer option called JThumbnailer that you find here: https://github.com/makbn/JThumbnail
JThumbnail is a Java library for creating Thumbnails of common types
of file including .doc, .docx, .pdf , .mp4 and etc. full list