Cannot stop and start again webcam capture

99 views
Skip to first unread message

Daniel Morales Salas

unread,
Feb 5, 2010, 1:14:45 PM2/5/10
to v4...@googlegroups.com
Hi

I was trying v4l4j r237 and I found that when i press start, webcam capture works ok, then press stop and press start again and it does not anymore, v4l4j gives me this message:
Error obtaining the frame grabber.

All i can do is restart the app but that is not the idea, any suggestion ?
I've attached the output when i was running the app and a screenshot showing the error message.

Thanks and greetings !

--
Atte:
Daniel Dario Morales Salas
Ingeniero Civil en Computación e Informática
Teléfono: 02 684 3417
Celular: 09 643 1802
Santiago, Chile
output.txt
snapshot1.png

Gilles

unread,
Feb 6, 2010, 5:14:03 AM2/6/10
to v4l4j
Hi Daniel,
Thanks for reporting this issue. Looking at the log you sent (and the
older ones from the previous issue you reported), I can see an
exception being thrown at the time FrameInterval objects are
instantiated. I am not sure but i think this may be the reason why
existing FrameGrabbers are not properly released, which is why capture
works only the first time and fails subsequently unless you restart
the application. So i will first try to fix the FrameInterval object
instantiation, and we will see if the other issue disappears.
I will get back to you when a fix is ready to be tested.
Cheers,
Gilles

>  output.txt
> 166KViewDownload
>
>  snapshot1.png
> 321KViewDownload

Gilles

unread,
Feb 6, 2010, 6:53:38 AM2/6/10
to v4l4j
Daniel,
The FrameInterval exception should be fixed. Before you run the tests
again, can I get you to delete the existing svn copy you have and
start with a clean one, followed by the usual procedure (uninstall,
build with debug, install and test). Let me know how you go.
Gilles

Daniel Morales Salas

unread,
Feb 6, 2010, 8:21:08 AM2/6/10
to v4...@googlegroups.com
Hi

I uninstalled v4l4j r237 and installed r240 (clean install).
The FrameInterval objects issue dissapear but now appears another exception:

au.edu.jcu.v4l4j.exceptions.JNIException: Error looking up the StepwiseInterval fieldID
     [java]     at au.edu.jcu.v4l4j.FrameInterval.doGetStepwise(Native Method)
     [java]     at au.edu.jcu.v4l4j.FrameInterval.<init>(FrameInterval.java:153)
     [java]     at au.edu.jcu.v4l4j.ResolutionInfo.doGetDiscrete(Native Method)
     [java]     at au.edu.jcu.v4l4j.ResolutionInfo.<init>(ResolutionInfo.java:148)
     [java]     at au.edu.jcu.v4l4j.ImageFormat.<init>(ImageFormat.java:84)
     [java]     at au.edu.jcu.v4l4j.ImageFormatList.listFormats(Native Method)
     [java]     at au.edu.jcu.v4l4j.ImageFormatList.<init>(ImageFormatList.java:111)
     [java]     at au.edu.jcu.v4l4j.DeviceInfo.getInfo(Native Method)
     [java]     at au.edu.jcu.v4l4j.DeviceInfo.<init>(DeviceInfo.java:254)
     [java]     at au.edu.jcu.v4l4j.VideoDevice.initDeviceInfo(VideoDevice.java:288)
     [java]     at au.edu.jcu.v4l4j.VideoDevice.<init>(VideoDevice.java:264)
     [java]     at au.edu.jcu.v4l4j.examples.DeviceChooser$DeviceInfoPane.<init>(DeviceChooser.java:208)
     [java]     at au.edu.jcu.v4l4j.examples.DeviceChooser.actionPerformed(DeviceChooser.java:153)
     [java]     at au.edu.jcu.v4l4j.examples.DeviceChooser.<init>(DeviceChooser.java:85)
     [java]     at au.edu.jcu.v4l4j.examples.DeviceChooser$1.run(DeviceChooser.java:173)
     [java]     at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:226)
     [java]     at java.awt.EventQueue.dispatchEvent(EventQueue.java:602)
     [java]     at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275)
     [java]     at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200)
     [java]     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
     [java]     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
     [java]     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
     [java]     at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
     [java] There was an error checking the supported intervals.
     [java] Please report this error to thev4l4j mailing list.
     [java] See REAME file for information on reporting bugs

But even with that exception, webcam capture works fine, but only until i press stop and start again, then i get the same problem: Error obtaining the frame grabber.
I've attached the "ant test-gui" output.

Thanks and greetings !

2010/2/6 Gilles <gilles...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "v4l4j" group.
To post to this group, send email to v4...@googlegroups.com.
To unsubscribe from this group, send email to v4l4j+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/v4l4j?hl=en.

output.txt

Gilles

unread,
Feb 7, 2010, 3:04:57 AM2/7/10
to v4l4j
Hi Daniel,
I have made a few fixes in r241, and also added some debug statements
to track down the failure to capture video the second time. However,
there is something I m not sure about:
In the logs you've been sending, the version printed by the libvideo
library all show the same UNKNOWN version tag. The exact line is:
[java] [ libvideo.c:68 ] Using libvideo version 0.8-UNKNOWN
I thought this would be fixed by having you checkout a brand new copy
of v4l4j, but it still occurs. Besides the usual uninstall/update/
compile/install/test procedure, can I also get you to:
- go to the v4l4j dir
- delete "libvideo/version.h",
- run the "./libvideo/svn-version.sh" script (make sure you run it
from the v4l4j/ dir)
- post the content of "libvideo/version.h"

Cheers,
Gilles

Daniel Morales Salas

unread,
Feb 7, 2010, 6:31:59 AM2/7/10
to v4...@googlegroups.com
Hi Gilles

I have uninstalled and deleted the v4l4j folder and then downloaded a brand new copy from svn.
I installed the r241 version and now i don't see any exception, but still cannot get capture the second time :(
I attached the output of ant test-gui.

I deleted libvideo/version.h and ran ./libvideo/svn-version.sh, this creates version.h file again and this is the content of that file:
#define VER_REV "UNKNOWN"

Thanks and greetings !!

2010/2/7 Gilles <gilles...@gmail.com>
Gilles

--
You received this message because you are subscribed to the Google Groups "v4l4j" group.
To post to this group, send email to v4...@googlegroups.com.
To unsubscribe from this group, send email to v4l4j+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/v4l4j?hl=en.

output.txt

Gilles

unread,
Feb 10, 2010, 5:56:22 AM2/10/10
to v4l4j
hi Daniel,
I investigated the issue (and the uvcvideo driver), and I think this
may be a bug in the driver. To that extent, I have written a small
application to test the driver behaviour and track down the precise
location of the issue.
Can you please run the following commands:
- svn co http://v4l4j.googlecode.com/svn/v4l4j/utils/capture-test
- cd capture-test
- make clean all
- ./capture-test /dev/video0

This will run 2 test captures in a row, and hopefully reproduce the
bug you encountered at the beginning of the second capture, ie setting
the capture pixel format to YUYV should fail. Please post the entire
output of the capture-test cmd.

Thanks,
Gilles


On Feb 7, 10:31 pm, Daniel Morales Salas <damora...@gmail.com> wrote:
> Hi Gilles
>
> I have uninstalled and deleted the v4l4j folder and then downloaded a brand
> new copy from svn.
> I installed the r241 version and now i don't see any exception, but still
> cannot get capture the second time :(
> I attached the output of ant test-gui.
>
> I deleted libvideo/version.h and ran ./libvideo/svn-version.sh, this creates
> version.h file again and this is the content of that file:
> #define VER_REV "UNKNOWN"
>
> Thanks and greetings !!
>

> 2010/2/7 Gilles <gilles.gi...@gmail.com>


>
>
>
> > Hi Daniel,
> > I have made a few fixes in r241, and also added some debug statements
> > to track down the failure to capture video the second time. However,
> > there is something I m not sure about:
> > In the logs you've been sending, the version printed by the libvideo
> > library all show the same UNKNOWN version tag. The exact line is:
> >     [java] [ libvideo.c:68 ] Using libvideo version 0.8-UNKNOWN
> > I thought this would be fixed by having you checkout a brand new copy
> > of v4l4j, but it still occurs. Besides the usual uninstall/update/
> > compile/install/test procedure, can I also get you to:
> > - go to the v4l4j dir
> > - delete "libvideo/version.h",
> > - run the "./libvideo/svn-version.sh" script (make sure you run it
> > from the v4l4j/ dir)
> > - post the content of "libvideo/version.h"
>
> > Cheers,
> > Gilles
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "v4l4j" group.
> > To post to this group, send email to v4...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > v4l4j+un...@googlegroups.com <v4l4j%2Bunsu...@googlegroups.com>.


> > For more options, visit this group at
> >http://groups.google.com/group/v4l4j?hl=en.
>
> --
> Atte:
> Daniel Dario Morales Salas
> Ingeniero Civil en Computación e Informática
> Teléfono: 02 684 3417
> Celular: 09 643 1802
> Santiago, Chile
>

>  output.txt
> 211KViewDownload

Daniel Morales Salas

unread,
Feb 10, 2010, 8:12:59 PM2/10/10
to v4...@googlegroups.com
Hi Gilles

This is the output you requested:

[metalklesk@metalklesk-laptop capture-test]$ ./capture-test /dev/video0
Checking device...Found V4L2 device 'Integrated Webcam' - driver 'uvcvideo' - version: 256
Setting format to 640x480 - YUYV ...OK
Asking for 4 V4L2 buffers...Got 4
Querying and mmap'ing buffer 0...OK
Querying and mmap'ing buffer 1...OK
Querying and mmap'ing buffer 2...OK
Querying and mmap'ing buffer 3...OK
Enqueuing all v4l2 buffers...Ok
Starting video stream...OK
Getting last frame...OK
Getting last frame...OK
Getting last frame...OK
Getting last frame...OK
Getting last frame...OK
Getting last frame...OK
Getting last frame...OK
Getting last frame...OK
Getting last frame...OK
Getting last frame...OK
stopping capture...OK
Unmmaping v4l2 buffers...OK
Checking device...Found V4L2 device 'Integrated Webcam' - driver 'uvcvideo' - version: 256

Unable to set capture parameters: Device or resource busy
Setting format to 640x480 - YUYV ...Unable to set image format

Thanks and greetings !!

2010/2/10 Gilles <gilles...@gmail.com>
To unsubscribe from this group, send email to v4l4j+un...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/v4l4j?hl=en.

Gilles

unread,
Feb 10, 2010, 8:40:36 PM2/10/10
to v4l4j
Thanks Daniel, I ll get in touch with the uvcvideo driver author, as I
think this is a driver issue.
I ll get back to you shortly
Gilles

On Feb 11, 12:12 pm, Daniel Morales Salas <damora...@gmail.com> wrote:
> Hi Gilles
>

> 2010/2/10 Gilles <gilles.gi...@gmail.com>


>
>
>
> > hi Daniel,
> > I investigated the issue (and the uvcvideo driver), and I think this
> > may be a bug in the driver. To that extent, I have written a small
> > application to test the driver behaviour and track down the precise
> > location of the issue.
> > Can you please run the following commands:

> > - svn cohttp://v4l4j.googlecode.com/svn/v4l4j/utils/capture-test

> > v4l4j%2Bunsu...@googlegroups.com<v4l4j%252Buns...@googlegroups.com>

Gilles

unread,
Feb 11, 2010, 6:18:11 AM2/11/10
to v4l4j
Daniel,
I have been looking at a few other video drivers, and I have
identified a potential fix to your issue. i have committed it to the
capture-test app. Can you please update your copy of the capture-test
app, run it again and send me the output. If it is successful, I ll
merge the fix across to v4l4j.
Thanks
Gilles

Daniel Morales Salas

unread,
Feb 11, 2010, 7:26:39 AM2/11/10
to v4...@googlegroups.com
Hi Gilles

Now i'm in work so i don't have my notebook with me, as soon as i get home i will download the latest version of capture-test and i will send you the output.

Thanks for everything !
Greetings !!

2010/2/11 Gilles <gilles...@gmail.com>
To unsubscribe from this group, send email to v4l4j+un...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/v4l4j?hl=en.

Daniel Morales Salas

unread,
Feb 11, 2010, 6:00:22 PM2/11/10
to v4...@googlegroups.com
Hi Gilles

Your fix works !!!!!!!!!!!

Here is the output:


[metalklesk@metalklesk-laptop capture-test]$ ./capture-test /dev/video0
====== STARTING TEST ======                                           
Checking device...Found V4L2 device 'Integrated Webcam' - driver 'uvcvideo' - version: 256
Setting format to 640x480 - YUYV ...OK                                                    
Asking for 4 V4L2 buffers...Got 4                                                         
Querying and mmap'ing buffer 0...OK                                                       
Querying and mmap'ing buffer 1...OK                                                       
Querying and mmap'ing buffer 2...OK                                                       
Querying and mmap'ing buffer 3...OK                                                       
Enqueuing all v4l2 buffers...Ok                                                           
Starting video stream...OK                                                                
Getting last frame...OK                                                                   
Getting last frame...OK                                                                   
Getting last frame...OK                                                                   
Getting last frame...OK                                                                   
Getting last frame...OK                                                                   
Getting last frame...OK                                                                   
Getting last frame...OK                                                                   
Getting last frame...OK                                                                   
Getting last frame...OK                                                                   
Getting last frame...OK                                                                   
stopping capture...OK                                                                     
Unmmaping v4l2 buffers...OK                                                               
Releasing V4L2 buffers...OK                                                               
====== TEST END ======                                                                    

====== STARTING TEST ======

Checking device...Found V4L2 device 'Integrated Webcam' - driver 'uvcvideo' - version: 256
Setting format to 640x480 - YUYV ...OK                                                    
Asking for 4 V4L2 buffers...Got 4                                                         
Querying and mmap'ing buffer 0...OK                                                       
Querying and mmap'ing buffer 1...OK                                                       
Querying and mmap'ing buffer 2...OK                                                       
Querying and mmap'ing buffer 3...OK                                                       
Enqueuing all v4l2 buffers...Ok                                                           
Starting video stream...OK                                                                
Getting last frame...OK                                                                   
Getting last frame...OK                                                                   
Getting last frame...OK
Getting last frame...OK
Getting last frame...OK
Getting last frame...OK
Getting last frame...OK
Getting last frame...OK
Getting last frame...OK
Getting last frame...OK
stopping capture...OK
Unmmaping v4l2 buffers...OK
Releasing V4L2 buffers...OK
====== TEST END ======

Greetings !!!

2010/2/11 Daniel Morales Salas <damo...@gmail.com>

Gilles

unread,
Feb 11, 2010, 6:02:51 PM2/11/10
to v4l4j
Great news Daniel !
I ll merge it across to v4l4j later on today or tomorrow, and i ll let
you know when v4l4j s good to test again.
Thanks
Gilles

On Feb 12, 10:00 am, Daniel Morales Salas <damora...@gmail.com> wrote:
> Hi Gilles
>

> 2010/2/11 Daniel Morales Salas <damora...@gmail.com>


>
>
>
> > Hi Gilles
>
> > Now i'm in work so i don't have my notebook with me, as soon as i get home
> > i will download the latest version of capture-test and i will send you the
> > output.
>
> > Thanks for everything !
> > Greetings !!
>

> > 2010/2/11 Gilles <gilles.gi...@gmail.com>

> >> > > > v4l4j%2Bunsu...@googlegroups.com<v4l4j%252Buns...@googlegroups.com>
> >> <v4l4j%252Buns...@googlegroups.com<v4l4j%25252Bun...@googlegroups.com>

Gilles

unread,
Feb 12, 2010, 4:44:58 AM2/12/10
to v4l4j
Hi Daniel,
can you update you copy of v4l4j, and try again, hopefully for the
last time :)
Let met know how you go.
Gilles

Daniel Morales Salas

unread,
Feb 12, 2010, 5:30:34 AM2/12/10
to v4...@googlegroups.com
Hi Gilles

Now it works perfect, no exceptions and the problem is solved with v4l4j r245. Now i can start, stop and start again the webcam capture.
Thanks a lot.

Greetings !!!

2010/2/12 Gilles <gilles...@gmail.com>
Gilles

--
You received this message because you are subscribed to the Google Groups "v4l4j" group.
To post to this group, send email to v4...@googlegroups.com.
To unsubscribe from this group, send email to v4l4j+un...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/v4l4j?hl=en.

Gilles

unread,
Feb 12, 2010, 5:57:51 AM2/12/10
to v4l4j
Great ! I m glad we got to the end of it. I ll make a new release with
this fix (and a few others) shortly.
Thanks for all the testing Daniel.
Gilles
Reply all
Reply to author
Forward
0 new messages