Skip to content

Instantly share code, notes, and snippets.

@acbdef123
acbdef123 / gstreamer-recording.c
Created May 12, 2022 07:40 — forked from crearo/gstreamer-recording.c
A Gstreamer example using GstElements to record a v4l2src stream.
#include <string.h>
#include <gst/gst.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
// gst-launch-1.0 v4l2src ! x264enc ! mp4mux ! filesink location=/home/rish/Desktop/okay.264 -e
static GMainLoop *loop;
static GstElement *pipeline, *src, *encoder, *muxer, *sink;
static GstBus *bus;
@acbdef123
acbdef123 / gstreamer-tee-recording-and-display.c
Created May 12, 2022 07:40 — forked from crearo/gstreamer-tee-recording-and-display.c
Example of tee in gstreamer. recording + display.
#include <string.h>
#include <gst/gst.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
// v4l2src ! tee name=t t. ! x264enc ! mp4mux ! filesink location=/home/rish/Desktop/okay.264 t. ! videoconvert ! autovideosink
static GMainLoop *loop;
static GstElement *pipeline, *src, *tee, *encoder, *muxer, *filesink, *videoconvert, *videosink, *queue_record, *queue_display;
@acbdef123
acbdef123 / gstreamer-recording-dynamic-from-stream.c
Created May 12, 2022 07:39 — forked from crearo/gstreamer-recording-dynamic-from-stream.c
Example of dynamic recording of a stream received from udpsrc.
#include <string.h>
#include <gst/gst.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
// udpsrc port=8554 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, width=(int)720, height=(int)480, encoding-name=(string)H264, payload=(int)96" !
// rtpjitterbuffer name=rtpjitbuff ! rtph264depay !
// tee name=t t. ! avdec_h264 ! appsink name=sink sync=false
@acbdef123
acbdef123 / gstreamer-recording-dynamic.c
Created May 12, 2022 07:38 — forked from crearo/gstreamer-recording-dynamic.c
Example of dynamic pipeline in Gstreamer (recording + display). Stop recording at will by hitting ctrl+c.
#include <string.h>
#include <gst/gst.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
// v4l2src ! tee name=t t. ! x264enc ! mp4mux ! filesink location=/home/rish/Desktop/okay.264 t. ! videoconvert ! autovideosink
static GMainLoop *loop;