MagicMirror² v2.4.1 is available! For more information about this release, check out this topic.
Please read the release notes carefully since this update requires adjustments to your Raspberry Pi configuration!

PICAMERA stream



  • Hi i’d like to have a picamera stream in the mirror, under the compliment text. I currently use 2 raspi, one will stream, the other is where i host the server, but i can simply use the same for both recording and creating the server, to be opened from the other pi. As streamer i use RPi Cam Control v6.2.11 but i can use any other. I have no clue of how to do it, can you advice me please? Thanks



  • Ok, so i have to merge those two codes to make stuffs work:
    The idea is to have a stream as wide as the vertical display at the current place of the “message module”. Is anyone with a suggestion on how to make it work? Tomorrow i’ll start the trials.

    php:

    
    
      
        RPi Cam Preview
        
      
      
        
          <div><img /></div>
        
     
    
    
    

    js:

    var mjpeg_img;
     
    function reload_img () {
      mjpeg_img.src = "cam_pic.php?time=" + new Date().getTime();
    }
    function error_img () {
      setTimeout("mjpeg_img.src = 'cam_pic.php?time=' + new Date().getTime();", 100);
    }
    function init() {
      mjpeg_img = document.getElementById("mjpeg_dest");
      mjpeg_img.onload = reload_img;
      mjpeg_img.onerror = error_img;
      reload_img();
    }
    

    Note from admin: Please use Markdown on code snippets for easier reading!



  • Ok, so my cam have two pure streams:
    http://192.168.0.101/html/cam_pic_new.php
    which is a constant stream (by refreshing the page)
    http://192.168.0.101/html/cam_pic.php
    which is the latest capture from the camera. So basically i need to set a picture viewer area in the mirror that refresh a lot
    any suggestion?

    https://www.npmjs.com/package/imagemagick-stream this could help?



  • @L_i_v_e It actually sounds like you have static images and not a video stream. It also doesn’t seem to be picamera specific. Have you tried using the Camera module? https://github.com/alexyak/camera



  • @frasen said in PICAMERA stream:

    @L_i_v_e It actually sounds like you have static images and not a video stream. It also doesn’t seem to be picamera specific. Have you tried using the Camera module? https://github.com/alexyak/camera

    Hi, thanks for the suggestion but i’m not sure it will work. The description says: The webcamera needs to be connected to the Raspberry Pi via USB.
    My camera in on another raspberry, so there is no way that this could work.
    Anyway i’ll ask to the creator, maybe he knows how to make it work.