Results 1 to 2 of 2
  1. #1
    a_p2011 is offline Member
    Join Date
    Mar 2011
    Posts
    1
    Rep Power
    0

    Default Capturing image from stream of usb video camera

    I am trying to create a web application in which i want to show stream of video on a page and capture image when i click a button.

    I was trying to find a list of devices connected to my pc using the code with jmf
    Java Code:
    public class GetDeviceList
    {
    
    	private static boolean debugDeviceList = false;
    	private static String	defaultVideoDeviceName = "Logitech USB Video Camera";
    	private static String defaultAudioDeviceName = "DirectSoundCapture";
    	private static String	defaultVideoFormatString = "size=176x144, encoding=yuv, maxdatalength=38016";
    	private static String defaultAudioFormatString = "linear, 16000.0 hz, 8-bit, mono, unsigned";
    
    	private static CaptureDeviceInfo	captureVideoDevice = null;
    	private static CaptureDeviceInfo	captureAudioDevice = null;
    	private static VideoFormat			captureVideoFormat = null;
    	private static AudioFormat			captureAudioFormat = null;
    
    
    	public static void device list()
    	{
    		java.util.Vector deviceListVector = CaptureDeviceManager.getDeviceList(null);
    		if (deviceListVector == null)
    		{
    			System.out.println("... error: media device list vector is null, program aborted");
    			System.exit(0);
    		}
    		if (deviceListVector.size() == 0)
    		{
    			System.out.println("... error: media device list vector size is 0, program aborted");
    			System.exit(0);
    		}
    
    		for (int x = 0; x < deviceListVector.size(); x++)
    		{
    			// display device name
    			CaptureDeviceInfo deviceInfo = (CaptureDeviceInfo) deviceListVector.elementAt(x);
    			String deviceInfoText = deviceInfo.getName();
    			if (debugDeviceList)
    				System.out.println("device " + x + ": " + deviceInfoText);
    
    			// display device formats
    			Format deviceFormat[] = deviceInfo.getFormats();
    			for (int y = 0; y < deviceFormat.length; y++)
    			{
    				// serach for default video device
    				if (captureVideoDevice == null)
    					if (deviceFormat[y] instanceof VideoFormat)
    					if (deviceInfo.getName().indexOf(defaultVideoDeviceName) >= 0)
    				{
    					captureVideoDevice = deviceInfo;
    					System.out.println(">>> capture video device = " + deviceInfo.getName());
    				}
    
    				// search for default video format
    				if (captureVideoDevice == deviceInfo)
    					if (captureVideoFormat == null)
    					if (DeviceInfo.formatToString(deviceFormat[y]).indexOf(defaultVideoFormatString) >= 0)
    				{
    					captureVideoFormat = (VideoFormat) deviceFormat[y];
    					System.out.println(">>> capture video format = " + DeviceInfo.formatToString(deviceFormat[y]));
    				}
    
    				// serach for default audio device
    				if (captureAudioDevice == null)
    					if (deviceFormat[y] instanceof AudioFormat)
    					if (deviceInfo.getName().indexOf(defaultAudioDeviceName) >= 0)
    				{
    					captureAudioDevice = deviceInfo;
    					System.out.println(">>> capture audio device = " + deviceInfo.getName());
    				}
    
    				// search for default audio format
    				if (captureAudioDevice == deviceInfo)
    					if (captureAudioFormat == null)
    					if (DeviceInfo.formatToString(deviceFormat[y]).indexOf(defaultAudioFormatString) >= 0)
    				{
    					captureAudioFormat = (AudioFormat) deviceFormat[y];
    					System.out.println(">>> capture audio format = " + DeviceInfo.formatToString(deviceFormat[y]));
    				}
    
    			}
    		}
    		System.out.println("... list completed.");
    
    
    
    }
    }


    This displays the audio devices but no video device is being displayed event hough i have installed the drivers anf the jar files from jmf framework....


    Can anyone help ..

  2. #2
    ozzyman's Avatar
    ozzyman is offline Senior Member
    Join Date
    Mar 2011
    Location
    London, UK
    Posts
    797
    Blog Entries
    2
    Rep Power
    4

    Default

    usb camera? i have a hunch that your device is not capable of uploading a video stream

Similar Threads

  1. Capture Video from ip camera
    By nesrine18 in forum Advanced Java
    Replies: 3
    Last Post: 03-12-2012, 08:08 PM
  2. Captured video From Camera To Frame
    By SQUALL in forum Advanced Java
    Replies: 0
    Last Post: 10-18-2010, 09:57 PM
  3. Replies: 0
    Last Post: 07-01-2010, 03:56 PM
  4. Replies: 0
    Last Post: 11-20-2008, 11:03 AM
  5. Capturing video with Robot
    By russ2620 in forum AWT / Swing
    Replies: 0
    Last Post: 06-03-2008, 04:49 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •