Git Product home page Git Product logo

jcrisp88 / flutter-webrtc_python-aiortc-opencv Goto Github PK

View Code? Open in Web Editor NEW
62.0 2.0 16.0 1.98 MB

Flutter WebRTC demo with Python server to perform image processing on video frames using OpenCV

Dockerfile 0.86% JavaScript 23.01% HTML 18.66% Python 18.81% Kotlin 0.36% Swift 1.11% Objective-C 0.10% Dart 37.10%
flutter webrtc webrtc-demos webrtc-video webrtc-demo python opencv opencv-python aiortc flutter-demo

flutter-webrtc_python-aiortc-opencv's Introduction

flutter + webrtc => python + aiortc + opencv

This demo project should help you to get setup sending a video feed from a flutter app to a python backend to allow you to then perform some image processing on the video frames using OpenCV.

Running the server

First install the required packages:

$ cd server

$ pip install -r requirements.txt

When you start the example, it will create an HTTP server which you can connect to from your browser:

$ cd server

$ python main.py

You can then browse to the following page with your browser:

http://localhost:8080

Once you click Start the browser will send the audio and video from its webcam to the server.

The server will play a pre-recorded audio clip and send the received video back to the browser, optionally applying a transform to it.

In parallel to media streams, the browser sends a 'ping' message over the data channel, and the server replies with 'pong'.

![Server index page](server_index.gif)

Additional options

If you want to enable verbose logging, run:

$ cd server

$ python server.py -v

Running the server in docker

If you have docker setup, run:

$ cd server

$ docker build -t aiortc_server .

$ docker run -p 8080:8080 -it --rm aiortc_server

You can then browse to the following page with your browser:

http://localhost:8080

Setting up flutter

First install the required packages.

Now you will need to update the /offer path to point to your local python server.

![Flutter Demo](flutter_demo.gif)

Credits

The server files were borrowed from the aiortc github project.

https://github.com/aiortc/aiortc

flutter-webrtc_python-aiortc-opencv's People

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

Watchers

 avatar  avatar

flutter-webrtc_python-aiortc-opencv's Issues

ICE connection state: new -> checking -> disconnected in Docker

Hi and thank you for open sourcing your work!

I followed the steps in Running the server in docker, but am still getting:
ICE connection state: new -> checking -> disconnected in Docker

The server is running in a remote server and I try to reach the website from my computer (so not a local camera).

Any idea what's wrong? I believe the problem is that the ICE ports are random and not exposed by docker. Did you came across this problem?

Thanks!

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.