GithubHelp home page GithubHelp logo

walterfan / gstreamer-snippets Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 150 KB

License: Apache License 2.0

CMake 1.44% Shell 0.90% C++ 36.30% Dockerfile 0.39% HTML 0.41% JavaScript 3.04% Meson 0.52% C 49.95% Python 7.04%

gstreamer-snippets's Introduction

GStreamer Snippets

Some snippets for gstreamer cookbook

Environment

You can build a docker image by build-docker.sh and start it by start-docker.sh

or run the below command to intall gstreamer on ubuntu

sudo apt-get install -y gstreamer1.0-tools \
libgstreamer1.0-dev \
libglib2.0-dev \
gstreamer1.0-nice \
gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-ugly \
gstreamer1.0-plugins-good \
libgstreamer-plugins-bad1.0-dev \
gstreamer1.0-plugins-base-apps \
libfmt-dev \
libspdlog-dev \
libyaml-cpp-dev
libgtest-dev

for MACOS, run similar commands by brew, but suggest downloading package from gstream site

brew install gstreamer
...
...
brew install googletest

for ubuntu, the google test library may not be found

sudo apt-get install libgtest-dev
cd /usr/src/gtest
sudo cmake .
sudo cmake --build . --target install

Example

  • start SRS by docker
export CANDIDATE="192.168.0.106"
sudo docker run --rm --env CANDIDATE=$CANDIDATE \
  -p 1935:1935 -p 1975:8080 -p 1985:1985 -p 1995:8000/udp \
  registry.cn-hangzhou.aliyuncs.com/ossrs/srs:5 \
  objs/srs -c conf/rtmp2rtc.conf
  • push local video stream from mp4 to rtmp
gst-launch-1.0 -vv filesrc location=material/talk.mp4 \
! decodebin \
! videoconvert ! identity drop-allocation=1 \
! x264enc tune=zerolatency ! flvmux streamable=true \
! rtmpsink location='rtmp://192.168.0.106:1935/live/waltertest'
  • or run the C++ program
./build-with-vcpkg.sh
./bin/gst-pipeline-verify -f ./example/etc/pipeline.yaml -p pipeline_test_rtmp
  • send/receive video stream over udp
# send video

gst-launch-1.0 -v v4l2src device=/dev/video1 ! decodebin \
  ! videoconvert ! omxh264enc ! video/x-h264,stream-format=byte-stream \
  ! rtph264pay ! udpsink host=192.168.104.236 port=5000

# receive video

gst-launch-1.0 -v udpsrc  port=5000 caps=application/x-rtp \
  ! rtph264depay ! avdec_h264 ! autovideosink

build source code

sudo apt-get install -y \
gstreamer1.0-tools \
libgstreamer1.0-dev \
libglib2.0-dev \
gstreamer1.0-nice \
gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-ugly \
gstreamer1.0-plugins-good \
libgstreamer-plugins-bad1.0-dev \
gstreamer1.0-plugins-base-apps \
libfmt-dev \
libspdlog-dev \
libyaml-cpp-dev \
libgtest-dev \
libsoup2.4-dev \
libjson-glib-dev

mkdir -p build
cd build
cmake ..
make

use vcpkg

  • if you have not install vcpkg, please install it first
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install spdlog
./vcpkg install fmt
./vcpkg install yaml-cpp
  • build with dependencies by vcpkg
./build-with-vcpkg.sh

use conan

  • if you have not install conan, please install it first
python3 -m venv venv
source venv/bin/activate
pip install conan
conan profile detect --force
  • create or update conanfile.txt for dependencies

  • then run the following script to build

./build-with-conan.sh

gstreamer-snippets's People

Contributors

walterfan avatar

Watchers

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