GithubHelp home page GithubHelp logo

gstreamer-cheat-sheet's Introduction

GStreamer command-line cheat sheet

GStreamer is a powerful library for manipulating audio and video - including live streams. This repo provides:

  • a cheat sheet for GStreamer on the command-line, and
  • a few Python examples.

Whilst the command line is great, programmatic usage (in Python or another language) allows you to dynamically manipulate the A/V streams.

Contents

Sources and references

Other cheat-sheets

Interacting with the GStreamer pipeline

If you want to interact with GStreamer after it's started (e.g. respond to an event, or dynamically change a pipeline), the command-line GStreamer doesn't really cut it. Instead, here are some options:

Python with GStreamer

Python is an easy language, so it's no surprise that it's good way to develop using GStreamer.

Some example scripts can be found in the python_examples/ directory.

Other good GStreamer Python resources that I've found:

C/C++ with GStreamer

My favourite reference is Valadoc

Problems or suggestions with this guide?

If you spot anything incorrect or incomplete, reports are welcome, either using issues or pull requests

My GStreamer project

Creating this guide gave me enough GStreamer understanding to make a prototype Brave, a live video editor for the cloud. (Regrettably this prototype has not been updated in a few years.)

gstreamer-cheat-sheet's People

Contributors

5shekel avatar carlfk avatar matthew1000 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  avatar  avatar  avatar  avatar  avatar  avatar

gstreamer-cheat-sheet's Issues

sending-to-an-rtmp-server needs location example

gst-launch-1.0 videotestsrc  is-live=true ! \
    queue ! x264enc ! flvmux name=muxer ! rtmpsink location="$RTMP_DEST live=1"

https://github.com/matthew1000/gstreamer-cheat-sheet/blob/master/rtmp.md#sending-to-an-rtmp-server

RTMP_DEST isn't defined.

it would be great if I knew how to make it work with an example from
https://github.com/arut/nginx-rtmp-module

I'm currently trying different things, all give me:
Could not connect to RTMP stream "rtmp://localhost/xyz/ live=1" for writing

for all xyz

Gstream rtmp to youtube broken?

Hello

Using gst-launch to try to stream to youtube via the documented command:

export RTMP_DEST="rtmp://a.rtmp.youtube.com/live2/xxxx-xxxx-xxxx"
gst-launch-1.0 \
    videotestsrc is-live=1 \
    ! videoconvert \
    ! "video/x-raw, width=1280, height=720, framerate=30/1" \
    ! queue \
    ! x264enc cabac=1 bframes=2 ref=1 \
    ! "video/x-h264,profile=main" \
    ! flvmux streamable=true name=mux \
    ! rtmpsink location="${RTMP_DEST} live=1" \
    audiotestsrc is-live=1 wave=ticks \
    ! voaacenc bitrate=128000 \
    ! mux.

Using version:

gst-launch-1.0 version 1.22.2
GStreamer 1.22.2
Unknown package origin

Seems this command does not work. Can you confirm that it still works on your side.

Thank you very much. ❤️

Question on using appsink on android

i looked through the implementation of gstreamer and it seems like there is a function that i need named Gst.parse_launch_full as well as pipeline.getElementByName("appsink") as AppSink

however, i cant find it in the android implementation of gstreamer.
I looked into the c code and could only find these functions

/* List of implemented native methods */
static JNINativeMethod native_methods[] = {
        {"nativeInit", "()V", (void *) gst_native_init},
        {"nativeFinalize", "()V", (void *) gst_native_finalize},
        {"nativePlay", "()V", (void *) gst_native_play},
        {"nativePause", "()V", (void *) gst_native_pause},
        {"nativeSurfaceInit", "(Ljava/lang/Object;)V",
                (void *) gst_native_surface_init},
        {"nativeSurfaceFinalize", "()V", (void *) gst_native_surface_finalize},
        {"nativeClassInit", "()Z", (void *) gst_native_class_init},
        {"nativeGetGStreamerInfo", "()Ljava/lang/String;", (void *) gst_native_get_gstreamer_info},
        {"nativeSetPipeline", "(Ljava/lang/String;)V", (void *) gst_native_set_pipeline}
};

is there something else equivalent to ```Gst.parse_launch_full```` ?

my goal is to be able to capture individual frames from the video stream so that i can save screenshots (not of the whole screen), save the video,, and also perform object detection (which implies i need to be able to extract the bitmap)

Pulling 2 RTMP Sources and creating a PiP on a Jetson Nano

I'm trying to create a pipeline that will pull in 2 separate local RTMP sources, make them Picture-in-picture, mux it all together and send to a SRTLA server, these are the pipelines I tried but failed;

First Try:

rtmpsrc name=cam1 location=rtmp://127.0.0.1/live/cam1 ! flvdemux name=demux0 ! queue ! demux0.video ! identity name=v_delay signal-handoffs=TRUE ! h264parse ! nvv4l2decoder ! nvvidconv ! queue ! comp.sink_0 
rtmpsrc name=cam2 location=rtmp://127.0.0.1/live/cam2 ! flvdemux name=demux1 ! queue ! demux1.video ! identity signal-handoffs=TRUE ! h264parse ! nvv4l2decoder ! nvvidconv ! queue ! comp.sink_1 

nvcompositor name=comp sink_0::xpos=0 sink_0::ypos=0 sink_0::width=1920 sink_0::height=1080 sink_1::xpos=0 sink_1::ypos=240 sink_1::width=320 sink_1::height=240 ! 
videorate ! video/x-raw,framerate=60/1 ! 
nvvidconv interpolation-method=5 ! 

nvv4l2h265enc control-rate=1 qp-range="28,50:0,38:0,50" iframeinterval=60 preset-level=4 maxperf-enable=true EnableTwopassCBR=true insert-sps-pps=true name=venc_bps ! 
h265parse config-interval=-1 ! queue max-size-time=10000000000 max-size-buffers=1000 max-size-bytes=41943040 ! mux. 

demux0. ! queue ! audio/mpeg ! decodebin ! audioconvert ! audioresample ! autoaudiosink 

mpegtsmux name=mux ! 
appsink name=appsink

Second Try:

rtmpsrc name=cam1 location=rtmp://127.0.0.1/live/cam1 ! 
flvdemux name=demux0
demux0.video ! identity name=v_delay0 signal-handoffs=TRUE ! h264parse ! nvv4l2decoder ! nvvidconv ! queue ! comp.sink_0

rtmpsrc name=cam2 location=rtmp://127.0.0.1/live/cam2 ! 
flvdemux name=demux1
demux1.video ! identity name=v_delay1 signal-handoffs=TRUE ! h264parse ! nvv4l2decoder ! videobox left=-4 right=-4 top=-4 bottom=-4 ! nvvidconv ! queue ! comp.sink_1

nvcompositor name=comp sink_0::width=1920 sink_0::height=1080 sink_1::width=640 sink_1::height=360 sink_1::xpos=10 sink_1::ypos=10 ! 
queue ! identity name=v_delay0 signal-handoffs=TRUE ! nvvidconv interpolation-method=5 ! 
queue ! identity name=v_delay1 signal-handoffs=TRUE ! nvvidconv interpolation-method=5 ! 
nvv4l2h265enc control-rate=1 qp-range="28,50:0,38:0,50" iframeinterval=60 preset-level=4 maxperf-enable=true EnableTwopassCBR=true insert-sps-pps=true name=venc_bps ! 
h265parse config-interval=-1 ! queue max-size-time=10000000000 max-size-buffers=1000 max-size-bytes=41943040 ! 
mpegtsmux name=mux ! appsink name=appsink

demux0.audio ! aacparse ! avdec_aac ! identity name=a_delay signal-handoffs=TRUE ! volume volume=1.0 ! 
audioconvert ! opusenc bitrate=320000 ! opusparse ! queue max-size-time=10000000000 max-size-buffers=1000 ! mux. 

Please help if at all possible, thank you.

Mixing audio sources from n participant and sending n-1 sources as output to each participant

Hi,

This is actually not an issue, but I was looking for ways to implement how with gstreamer( can be audiomixer) with audio sources mixed from n participants can be used and later from output each participant listens to only audio from other n-1, not the self voice

Its same as in one of the GStreamer issues at http://gstreamer-devel.966125.n4.nabble.com/audiomixer-implementation-for-audio-conference-cancel-user-1-contribution-when-streaming-to-user-1-td4659790.html#a4693565

I came across this https://github.com/matthew1000/gstreamer-cheat-sheet/blob/master/mixing.md#mixing-audio section where I was curious if this above issue can be asked in this forum

Any suggestions on this regard will really help

Thanks

Question on splitting pipelines

I need to read rtsp and after that to split pipeline to several branches. Smth like tee plugin does, but tee copy the frame. I need that first frame to go to one branch of pipeline and another one to go to another branch the third frame to the first branch and so on... Is it possible to do in Gstreamer?

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.