Git Product home page Git Product logo

berrymse's Introduction

๐Ÿ“ BerryMSE

Simple low-latency live video streaming from a Raspberry Piโ„ข via the Media Source Extensions API.

Note: As of March 2020, Safari on iOS devices still does not support this API (excluding iOS 13 on iPad devices, which do support the API).

Overview

H.264 Network Abstraction Layer (NAL) units are read from /dev/video0, a Video4Linux2 compatible camera interface. Each unit corresponds to one frame. Frames are packaged into MPEG-4 ISO BMFF (ISO/IEC 14496-12) compliant fragments and sent via a websocket to the browser client. The client appends each received buffer to the media source for playback.

Demo

The Demo executable can be downloaded from the release page and run on a Raspberry Pi 32-bit (Buster) with a Raspberry Pi camera as /dev/video0.

The demo files can be found in /cmd/berrymse with a build and usage instruction.

To run, copy the appropriate berrymse executable to the Raspberry Pi and run:

./berrymse -l <raspberry pi ip address>:2020 -d /dev/video<X>

For example:

./berrymse -l 192.168.2.1:2020 -d /dev/video0

The Raspberry Pi Zero uses the armv6l/berrymse executable. Other models use the armv7l/berrymse executable.

The webpage will show a live video stream with approximately 200ms of latency. The browser will buffer frames, providing a lookback window.

Settings

The currently implemented configurations are:

  • H264 bitrate: Changes the bitrate of the video and the encoder will now try to only produce a H264 Stream.
  • Video height resolution: Changes the video height resolution.
  • Video width resolution: Changes the video width resolution.
  • Video rotation: Changes the video rotation resolution. It can only be changed in 90 degree steps and rotates the picture clockwise.
  • Video source: Changes the source Device Node of the video.
  • Server URL address: Changes the URL address were the video and website gets published to.
  • Server websocket name: Changes the websocket name were the video packages can get received. This will break the demo page!

Flags

Flags for ./berrymse:

-c, -- string                  Use config Path/Name.yml
                                Default Path is current directory! (default "config.yml")
-b, --Camera.Bitrate int       Bitrate in bit/s!
                                Only supported for RPI Camera
                                Other Cameras need to use -1 (default 1500000)
-h, --Camera.Height int        Height Resolution (default 720)
-r, --Camera.Rotation int      Rotation in 90degree Step
                                Only supported for RPI Camera
                                Other Cameras need to use -1
-d, --Camera.SourceFD string   Use camera /dev/videoX (default "/dev/video0")
-w, --Camera.Width int         Width Resolution (default 1280)
-l, --Server.URL string        listen on host:port (default "localhost:2020")

Config File

Default config file name is config.yml and default path for it is local directory.

If these configurations don't work/match your camera this can freeze the camera stack. e.g. using resolutions above 1920 times 1080 created crashes.

USB cameras don't support the advanced settings rotation and bitrate and need a -1 as parameter.

camera:
  sourceFD: "/dev/video0"
  width: 1280
  height: 720
  bitrate: 1500000
  rotation: 0

server:
  url: "0.0.0.0:80"

Project folder structure

  • berrymse/ : Project folder
    • cmd/ : CMD Applications
      • berryMSE : Demo
      • berryMSEmulti : Demo for multiple streams
    • src/ : Contains library
      • berryMSE : Main Class
      • ...
    • configs/ : ConfigTemplates

berrymse's People

Contributors

ch3ri0ur avatar kingmaxi95 avatar thinkski avatar jwgcarlson avatar

Stargazers

 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.