Maintenance notice: These forum archives are read-only, and will be removed shortly. Please visit our forums at their new location, https://www.evilmadscientist.com/forums/.

Peggy 2 Video stream (webcam)

edited February 2014 in General
Hey everyone,
Im hoping someone can help me, I have completed my Peggy 2 and delighted with the outcome, its brilliant! But im in the process of trying to connect it to my webcam on my laptop. I have soldered the two jumpers into the 'SER' area on the PCB. The peggy works great and i have not had one problem yet. I have the Arduino and Processing software and have installed the Peggy 2 serial library for Arduino.

I uploaded the recieve sketch to the peggy. Then in processing i ran the mirror peggy sketch.

This is where my problem is. After i change the comm port in the code and click run, the webcam window pops up, but its black. Nothing but black!
The small indication light next to the webcam doesn't turn on either.
 
But, when i run a different video sketch in the processing library, it works fine. Webcam window pops up and i can see myself. 
Not sure where i went wrong. Fairly new to this stuff so i apologize in advance :)

Any help/ comments would be great! Iv included some snaps! 

Thanks, Jack
image
This Pic shows the mirror peggy sketch only showing a black window :(

image
This pic shows the example mirror sketch and my webcam working.

Comments

  • This is due to a change in the video library since we last updated the Peggy 2 library.

    Find the line that says:
    video = new Capture(this, 320, 240, 15); //Last number is frames per second 

    And, after that line, add the following:
     video.start();
  • edited February 2014
    Bingo!  

    Thanks Windell!

    It gave me an error at first.."the requested resolution of 320x240,15/1fps is not supported by the selected capture device"

    Does that mean i need a better camera? I changed 15 to 10 and it worked. Would have liked 15 though. 
  • Also, i was wondering if it would be possible to play a video/ mp4 onto the peggy? i presume editing some of the mirrorpeggy code would be necessary. Prehaps replace the 'capture video;' line with something else relating to the directory of the mp4?

    Thanks a million for your help!

    Jack
  • Yes, it is quite possible to change the video source to take video from a file.  I think that a few people have already done this, but I do not have example code for it at this time.
  • Ok thanks, i'll check out the other topics in the forums. 

    Unfortunatly iv come across another problem, the black screen is back, and it wont stream to the peggy, this is the error im getting. As far as i know i havnt changed anything...

    JNA: Callback org.gstreamer.elements.AppSink$2@47c988f threw the following exception:
    java.lang.NoClassDefFoundError: Could not initialize class org.gstreamer.lowlevel.AppAPI
    at org.gstreamer.elements.AppSink.gst(AppSink.java:38)
    at org.gstreamer.elements.AppSink.pullBuffer(AppSink.java:128)
    at org.gstreamer.elements.RGBDataAppSink$AppSinkNewBufferListener.newBuffer(RGBDataAppSink.java:144)
    at org.gstreamer.elements.AppSink$2.callback(AppSink.java:184)
    at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.sun.jna.CallbackReference$DefaultCallbackProxy.invokeCallback(CallbackReference.java:455)
    at com.sun.jna.CallbackReference$DefaultCallbackProxy.callback(CallbackReference.java:485)

    Not sure what gstreamer is....
    Thanks again for your help Windell

    Cheers 

  • I am not otherwise familiar with the issue, but found this discussion online, that might be helpful:

    http://forum.processing.org/two/discussion/2716/windows-8-video-capture-issue/p1
  • You said in the other thread that you had this working now.  Do you know what the problem turned out to be?
  • Yes, there is a bug with the processing version 2.1.1 video library on windows. It wont be fixed until version 2.1.2.
    I just reinstalled 2.1.0 and it worked. 
Sign In or Register to comment.