Giter VIP home page Giter VIP logo

flask-video-stream's Introduction

Flask-opencv webcam streaming server

This is a simple python3 script that serves a tiny Flask video webserver that allows to take photos or see real time video streaming of a connected camera/webcam controlled with opencv.

Requirements

In order to execute the script you need to install opencv3 -> import cv2 and some python modules.

Move to the project folder and try:

Try #1:

pip install -r requirements.txt

Try #2:

pip install flask opencv-python

If it gets any error, probably with opencv-python try to install them manually.

Running

To start the service cd to project folder and type python server.py or python3 server.py

It only runs on python3

Once done navigate to the ip of the server and access the port 5000.

http://localhost:5000

Configuration

Change running port

The project is default configured to run at port 5000. To change the running port you must specify the argument -p, --port [PORT].

Example:

python3 server.py -p 3000 Runs on port 3000

Change camera source

To change the camera source of opencv you can go to the beginning of file server.py and add a video_source=1 it can be 0,1,2... as many video inputs the device has in the declaration of object Camera. Or you can change the default video source on camera.py Camera class __init__ method.

flask-video-stream's People

Contributors

axelgard avatar ramonus 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

Watchers

 avatar  avatar  avatar  avatar

flask-video-stream's Issues

No License

Hi Ramonus,

It seems like you don't have a license for this project.
I would like to use this project, but I need to know the what license the project is under.

If you are not sure what license to use I would recommend that you use MIT.
There is a default template built into GitHub for this.

Not streaming

Hey !
I was able to successfully run the code.
taking pictures was working fine. But streaming was not happening.
When i tried to debug it using VS Code, i put a breakpoint at this line (frame=..)

frame = camera.get_frame()
yield (b'--frame\r\n'b'Content-Type: image/png\r\n\r\n' + frame + b'\r\n\r\n')

then after yielding it was showing the picture. then again i continued the debug and nothing was loading. I dont seem to understand the problem. Do we need to add some kind of js for it work ??

Stream endless load - local issue

Streaming on localhost and the 192 address seems to endless load, even when I change port to be public it doesnt work on the host server. Although, when I use my phone and go to the 192 address, the stream works just fine...on mobile. I go to one of my other pc's and load the 192 address, I get the same problem as the host server, endless load for the stream output. But not once having this problem on mobile -> wifi/externally so long as I was able to see it, it worked on mobile.

But not once have I managed to make it work on the host pc, or locally from a different pc without setting the port to be open externally while using a pc. But somehow works on mobile just fine.

When clicking stream it also seems like it long polls both tabs, to the point where I have to close them both, then go back to the url in new tabs because of the endless buffering/loading

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.