Live broadcast of my screen, screencapture

PerPer
edited February 2018 in Raspberry PI

Hi!

I havnt got horizontal keystone on my projector and want to project on a surface that is not right in front of the projector.

My idea is to go through a processing sketch running on an raspberry pi. Basically by outputting a corner pinned version of the desktop to my projector connected through hdmi. Using the Keystone library.,

Just need to be able to grab the screen in some way.

Are there any library for capturing the screen and stream it?

Thanks

Tagged:

Answers

  • No way of grabbing the screen?

  • You want to stream what your draw() just output? You can get and capture the content of your final version of your draw() into a PImage object using get():

    void setup(){...}
    
    void draw(){
      //...
      //...
      //...
    
      PImage img=get();
    }
    

    For streaming, not clear what your actual setup is. You run your sketch in a R-pi and you have a PC connected to it? Then you want to stream it to where? Serial? UDP? Not clear, hence you get no answers.

    Kf

  • I'm confused as well. Does your PI have video out? If you are in-lining your PI between your computer and your projector, can't you just draw to the screen in fullscreen, and send the result over the video out cable to the projector? Why "stream" it?

  • PerPer
    edited February 2018

    I try to be more clear :) Lets just forget about the Raspberry Pi for a while.

    I got this sketch based on the "keystone-library".

    import deadpixel.keystone.*;
    import processing.video.*;
    
    Keystone ks;
    CornerPinSurface surface;
    Movie movie; 
    
    PGraphics os;
    int w = 640;
    int h = 325;
    
    int screenW = 1280;
    int screenH = 720;
    
    void settings() {
      size(screenW, screenH, P3D);
    }
    
    void setup() {
      ks = new Keystone(this);
      surface = ks.createCornerPinSurface(w, h, 20);
    
      os = createGraphics(w, h, P3D);
      movie = new Movie(this, "mymovie.m4v"); 
      movie.loop();
    }
    
    void draw() {
      PVector surfaceMouse = surface.getTransformedMouse();
      os.beginDraw();
      os.image(movie, 0, 0);
      os.endDraw();
    
      movie.read();
      background(0);
    
      surface.render(os);
    }
    
    void keyPressed() {
      switch(key) {
      case 'c':
        // calibration mode
        ks.toggleCalibration();
        break;
    
      case 'l':
        // loads the saved layout
        ks.load();
        break;
    
      case 's':
        // saves the layout
        ks.save();
        break;
      }
    }
    

    It works fine on video content I load into processing.

    But I also want to corner pin things that are streamed on the web and output the corner pinned version on a second screen or a projector. So say I got a webbrowser opened on screen1 and my processing sketch running on screen2. Then I want to capture the content on screen1 and display it in my cornerpin sketch on screen2.

    So what I basically want is to exchange mymovie.m4v above with captured content from screen1.

    So that is what Im looking for. Some way of capturing a screen and selected conten into a processing sketch.

    Hope that was more clear.

    • I noticed this was put in Raspberry Pi but since its not exactly raspberry pi question I move it back to processing
  • edited February 2018

    Hm. So the basic Idea could be to run a simple server chrome and firefox are able to share the screen, good possible that you can pipe that video back to processing.

    https://mozilla.github.io/webrtc-landing/ ( Canvas captureStream() )

    https://www.google.com/search?q=webrtc (Also services on the web are aviable, where you can share you screen mostly paid )

    or use normal Broadcaster Software https://obsproject.com/

    Be creative Good Luck

  • @Per -- I hope that the video stream processing project worked out well. Would be interested to hear if you found a solution. If not -- perhaps Spout?

    https://forum.processing.org/two/discussion/22479/fastest-way-to-create-a-video-stream

Sign In or Register to comment.