Add gst-v4l2-capture.sh
authorAntonio Ospite <ao2@ao2.it>
Tue, 28 Aug 2018 14:52:26 +0000 (16:52 +0200)
committerAntonio Ospite <ao2@ao2.it>
Tue, 28 Aug 2018 14:54:05 +0000 (16:54 +0200)
Add a trivial example of how to capture from a webcam.

shell/gst-v4l2-capture.sh [new file with mode: 0755]

diff --git a/shell/gst-v4l2-capture.sh b/shell/gst-v4l2-capture.sh
new file mode 100755 (executable)
index 0000000..ba49867
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+set -e
+
+[ "x$1" = "x" ] && { echo "usage $(basename "$0") <destination_file>" 1>&2; exit 1; }
+
+FILENAME="$1"
+
+VIDEO_CODEC="video/x-raw,format=I420 ! jpegenc quality=90"
+
+gst-launch-1.0 -e \
+  matroskamux name=mux ! filesink location="$FILENAME" \
+  v4l2src ! queue ! videoconvert ! videorate ! $VIDEO_CODEC ! queue ! mux. \
+  pulsesrc ! queue ! audioconvert ! vorbisenc ! queue ! mux.