Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera snapshot #20

Open
Zodiase opened this issue Jun 29, 2021 · 4 comments
Open

Camera snapshot #20

Zodiase opened this issue Jun 29, 2021 · 4 comments

Comments

@Zodiase
Copy link

Zodiase commented Jun 29, 2021

I'm wondering if I can pull a snapshot from a Wyze cam. I know video streaming needs the RTSP firmware but the "prevent the camera from supporting any future functions or features in the Wyze app" warning with a lack of reverting instructions scares me. I only need the latest shot from the cam not the whole stream.

@noelportugal
Copy link
Owner

noelportugal commented Jun 29, 2021

Unfortunately, I don't think there is a way to directly get the snapshot from the wyze cam at the moment..There is a property that suggest it might be possible in the future. In the meantime what I use is a server (raspberry pi) on the same network and I take the snapshot from RTSP and serve it with express:

https://gist.github.com/noelportugal/e6943256549103ca28e143c03df7fef9

// Dependencies:
// npm install -S express fluent-ffmpeg
// brew install ffmpeg

// Run:
// RTSP_USERNAME=[username] RTSP_PASSWORD=[password] RTSP_IP=[ip] node index.js

const path = require('path');
const ffmpeg = require('fluent-ffmpeg');
const express = require("express")
const app = express()

const port = process.env.PORT || 8080
const rtsp_ip = process.env.RTSP_IP
const rtsp_username = process.env.RTSP_USERNAME
const rtsp_password = process.env.RTSP_PASSWORD

app.get('/screenshot',(_, res) => {
    const screenshot = './screenshot.png';
    ffmpeg(`rtsp://${rtsp_username}:${rtsp_password}@${rtsp_ip}/live`)
      .on('end', () => {
          res.sendFile(path.join(__dirname, '/', screenshot));
      })
      .on('error', (err) => {
          res.json({
              error : err.message
          });
      })
      .outputOptions(['-f image2', '-vframes 1', '-vcodec png', '-f rawvideo', '-ss 00:00:01'])
      .output(screenshot)
      .run();
})

let listener = app.listen(port, function() {
console.log("Express server listening on port " + listener.address().port);
})

@noelportugal
Copy link
Owner

I just did some digging, and found out the the api does have a thumbnails_url, but this only works with WyzeCams V2 not the V3s. Also the thumbnail is not in real-time..not sure how often it gets updated.

  let device = await wyze.getDeviceByName("Garage Cam");
  console.log(device.device_params.camera_thumbnails.thumbnails_url);

@MisterSquishy
Copy link

MisterSquishy commented Aug 17, 2021

perhaps this should be a separate issue, but is there also no support for instructing the camera to take a snapshot? i would like to schedule a daily snapshot; i don't need to be able to retrieve that snapshot programmatically. is there a magic actionKey i'm missing or anything?

@Zodiase
Copy link
Author

Zodiase commented Aug 26, 2021

Also the thumbnail is not in real-time..not sure how often it gets updated.

Yeah I've seen the thumbnails in the app lag behind sometimes for days without updating. But it's better than nothing :D

Thanks for digging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants