Git Product home page Git Product logo

ffmpeg-webcam-rtmp-stream's Introduction

ffmpeg-webcam-rtmp-stream

Webcam capture streaming via RTMP or saving into video file. Cross-platform.

Build (static)

make static

Build (dynamic)

Prerequisites (Ubuntu)

sudo apt-get update
sudo apt-get install libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libavresample-dev libavdevice-dev -y
sudo apt-get install ffmpeg -y
sudo apt-get install build-essential clang -y

Prerequisites (MacOS)

brew install ffmpeg

After you installed everything for your host OS, run:

make

Build artifacts will be stored inside build/ directory.

Example Live Stream

On MacOS:

./build/stream 0 rtmp://localhost/live/stream flv 1920 1080 30

On Linux:

./build/stream /dev/video0 rtmp://localhost/live/stream flv 800 600 24

You can also save webcam stream into file:

./build/stream 0 out.mp4 mp4 800 600 30

Docker

There are 3 Docker files prepared, choose your preferable one and build an image:

  • Ubuntu (dynamic)
docker build -t ffmpeg-webcam-rtmp-stream .
  • Ubuntu (static)
docker build -t ffmpeg-webcam-rtmp-stream -f Dockerfile.ubuntu.static .
  • Alpine (static)
docker build -t ffmpeg-webcam-rtmp-stream -f Dockerfile.alpine.static .

Then run stream from container (only works on Linux as host):

docker run --device /dev/video0 -it ffmpeg-webcam-rtmp-stream stream /dev/video0 rtmp://localhost/live/stream flv 1280 720 30

RTMP Server

For testing purposes you can run RTMP server as:

docker run -it -p 1935:1935 --name rtmp-server jkuri/rtmp-server

License

MIT

ffmpeg-webcam-rtmp-stream's People

Contributors

jkuri 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.