Giter VIP home page Giter VIP logo

balena-cam's Introduction

Live stream your balena device's camera feed.

Getting started

Running this project is as simple as deploying it to a balenaCloud application.

One-click deploy to balenaCloud:

or

  • Sign up on balena.io and follow our Getting Started Guide.
  • Clone this repository to your local workspace.
  • Unset (delete) the environment variable BALENA_HOST_CONFIG_gpu_mem or RESIN_HOST_CONFIG_gpu_mem if exists, from the Fleet Configuration application side tab.
  • Set these variables in the Fleet Configuration application side tab
    • BALENA_HOST_CONFIG_start_x = 1

    • Set all the following gpu_mem variables so your Pi can autoselect how much memory to allocate for hardware accelerated graphics, based on how much RAM it has available

      Key Value
      BALENA_HOST_CONFIG_gpu_mem_256 192
      BALENA_HOST_CONFIG_gpu_mem_512 256
      BALENA_HOST_CONFIG_gpu_mem_1024 448
  • Using Balena CLI, push the code with balena push <application-name>.
  • See the magic happening, your device is getting updated 🌟Over-The-Air🌟!
  • In order for your device to be accessible over the internet, toggle the switch called PUBLIC DEVICE URL.
  • Once your device finishes updating, you can watch the live feed by visiting your device's public URL.

Password Protect your balenaCam device

To protect your balenaCam devices using a username and a password set the following environment variables.

Key Value
username yourUserNameGoesHere
password yourPasswordGoesHere

πŸ’‘ Tips: πŸ’‘

Optional Settings

  • To rotate the camera feed by 180 degrees, add a device variable: rotation = 1 (More information about this on the docs).
  • To suppress any warnings, add a device variable: PYTHONWARNINGS = ignore

TURN server configuration

If you have access to a TURN server and you want your balenaCam devices to use it. You can easily configure it using the following environment variables. When you set them all the app will use that TURN server as a fallback mechanism when a direct WebRTC connection is not possible.

Key Value
STUN_SERVER stun:stun.l.google.com:19302
TURN_SERVER turn:<yourTURNserverIP>:<yourTURNserverPORT>
TURN_USERNAME <yourTURNserverUsername>
TURN_PASSWORD yourTURNserverPassword

Additional Information

  • This project uses WebRTC (a Real-Time Communication protocol).
  • A direct WebRTC connection fails in some cases.
  • This current version uses mjpeg streaming when the webRTC connection fails.
  • Chrome browsers will hide the local IP address from WebRTC, making the page appear but no camera view. To resolve this try the following
    • Navigate to chrome://flags/#enable-webrtc-hide-local-ips-with-mdns and set it to Disabled
    • You will need to relaunch Chrome after altering the setting
  • Firefox may also hide local IP address from WebRTC, confirm following in 'config:about'
    • media.peerconnection.enabled: true
    • media.peerconnection.ice.obfuscate_host_addresses: false

Supported Browsers

  • Chrome (but see note above)
  • Firefox (but see note above)
  • Safari
  • Edge (only mjpeg stream)

Become a balena poweruser

Want to learn more about what makes balena work? Try one of our masterclasses. Each lesson is a self-contained, deeply detailed walkthrough on core skills to be successful with your next edge project.

Check them out at our docs. Also, reach out to us on the Forums if you need help.

License

Copyright 2018 Balena Ltd.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

balena-cam's People

Contributors

andrewnhem avatar balena-ci avatar chrisys avatar dansku avatar mbalamat avatar robot-army avatar sradevski avatar stenbergd avatar tmigone avatar webtop avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.