Git Product home page Git Product logo

browserlivestream's Introduction

badge

badge

badge

api.video livestream a video

api.video is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.

March 2021: If you'd like to share your screen & camera with a livestream, check out record.a.video. Code is related to this repo, but updated.

browserLiveStream

Use your webcam, browser and NodeJS to stream live video from a webpage to your users.

Based on the https://github.com/chenxiaoqino/getusermedia-to-rtmp codebase, this project allows you to stream directly from the browser to your RTMP endpoint (in this case I am using api.video to distribute my stream.)

Since my Livestream is already established at api.video - there are no API keys or authentication needed, the video will just playback, and anyone with the URL for the playabck will be able to watch. (I am not providing the playback url - this is not a "free streaming tool" :) ).

Requiremennts: The website will only work in Chrome, Edge and Firefox (Safari/Webkit does not yet support the MediaRecorder API, so unfortunately, no browsers on iPhones will work).

RTMP video

The Node backend takes the webcam video, and transcodes it into FLV format - so it can be ingested by any "live straeming" site with an RTMP endpoint, which is configurable in the form on the page.

api.video

The default RTMP endpojnt is a livestream hosted at api.video.

Note: The RTMP endpoint in the code is streaming into my account - and I can see all your videos. Please wear pants. :D

Camera usage on a webpage

In order to use the webcam in the browser, your site must be served via HTTPS, or you users will have to bypass a security message every time they go to yur site (will work in Chrome, but not in Firefox).

Alternatively: If you host this site locally on your computer, localhost will allow you to use the camera

To launch your own local version on localhost, simply clone the repo and run "node server.js" on the command line. Youo'll need FFMPEG on the server to do the transcoding.

In your browser, go to localhost:1437 - and you are up and running!

Installation

clone the repo

npm install (for all dependencies)

install ffmpeg

node server.js

Try it out!

This is running at livestream.a.video

browserlivestream's People

Contributors

anthony-dantard avatar dougsillars avatar erikkai avatar promathieuthiry avatar thibaultbee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

browserlivestream's Issues

not maintaining given frame rate 30

HI,

I would like to thank you for this great project, I have a requirement of 30 fps and I am using the video of size 240x240 .
what I am observing is the working for the very first run after all setup.
From 2nd run it is always going back to 15 frames max. is there a way to always honor the frames we provide in the options?
Please let me know

the options i am using
var ops=[
'-y',
'-thread_queue_size', '5096',
'-guess_layout_max', '0',
'-i','-',
'-s' ,'1280x720',
'-c:v', 'libx264',
'-c:a', 'mp2', '-r', '30000/1001',
'-b:v', '512k',
'-profile:v', 'high',
'-level', '4',
'-preset', 'ultrafast', '-tune', 'zerolatency' ,
'-pix_fmt', 'yuv420p',
'-refs', '4', '-weightp', '0' ,'-x264opts', 'keyint=60:keyint_min=15:intra_refresh=0:bframes=3:open_gop=0:nal-hrd=cbr:vbv-bufsize=10000:vbv-maxrate=5000',
'-deblock', '1:1:1' ,'-threads', '8', '-me_range', '24' ,'-trellis' ,'2',
'-f', 'mpegts', '-flush_packets', '0', '-mpegts_flags', 'resend_headers', '-mpegts_service_id', '1' ,'-mpegts_pmt_start_pid', '480','-mpegts_start_pid', '481',
'-f', 'mpegts', '-flush_packets', '0', 'udp://192.168.1.100:5000?pkt_size=1316โ€‹'

	];

Thanks

[Bug]: Not running after upgrade socket.io server to 4.7.2

Version

latest

Environment that reproduces the issue

Browser : Chrome 117.0.5938.89
OS : Windows 10

Is it reproducible in the example application?

No

Reproduction steps

  1. Perform upgrading socket.io library in node_module to 4.7.2
  2. add CORS

var io = require('socket.io')(server,{
cors: {
origin: "*",
methods: ["GET", "POST"]
}
});

Expected result

Streaming to rtmp successfully

Actual result

  1. Server restarted after couple of minutes
  2. No Stream output to Youtube/Facebook RTMP

Additional context

No response

Relevant logs output

showing this error after couple minutes start a streaming https://prnt.sc/eagHJPX8RJhz

TypeError: Cannot read property 'stdin' of undefined

Hello,

First of all thank you for the great work.

I faced the issue while sending the stream not sure it's ffmpeg issue or something else. Kindly review the attached screenshot for more details.

Same issue with getusermedia-to-rtmp version miss-match of ffmpeg or os issue.

I'm using
OS: Window10
ffmpeg version n4.3.1-26-gca55240b8c Copyright (c) 2000-2020 the FFmpeg developers built with gcc 9.3-win32 (GCC) 20200320

image

transcoding with ffmpeg.js (wasm)

Is it possible to use ffmpeg.js on the frontend side and transcode, then send pre-processed video to FFmpeg for relay (-c copy) for the final destination?

This way it won't consume much server resources and also paves the way for sending video directly from a web browser via websockify (it's just an idea) or node app (similar approach)

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.