aboutsummaryrefslogtreecommitdiff
path: root/example-scripts/gstreamer
diff options
context:
space:
mode:
authorMaZderMind <git@mazdermind.de>2015-12-06 20:28:02 +0100
committerMaZderMind <git@mazdermind.de>2015-12-06 20:28:57 +0100
commit39c8cb3a0e3813ef77c61c601d0028281c04ad2d (patch)
tree8e4798e9b70732f1c28f180457e962c63f1a20ec /example-scripts/gstreamer
parentb2b0e458a59ef8ede58b369a5d5194939021165d (diff)
[example-scripts] overhaul and test all example scripts, fixes #5
Diffstat (limited to 'example-scripts/gstreamer')
-rwxr-xr-xexample-scripts/gstreamer/play-cam1-av.sh13
-rwxr-xr-xexample-scripts/gstreamer/play-mixed-audio.sh5
-rwxr-xr-xexample-scripts/gstreamer/play-mixed-av.sh13
-rwxr-xr-xexample-scripts/gstreamer/play-mixed-video.sh6
-rw-r--r--example-scripts/gstreamer/play-mixer-video.sh6
-rwxr-xr-xexample-scripts/gstreamer/record-mixed-av.sh21
-rwxr-xr-xexample-scripts/gstreamer/source-avsync-test-clip-as-cam1.sh23
-rwxr-xr-xexample-scripts/gstreamer/source-background-loop.py66
-rwxr-xr-xexample-scripts/gstreamer/source-test-background.sh6
-rwxr-xr-xexample-scripts/gstreamer/visualize-mixed-audio.sh9
10 files changed, 168 insertions, 0 deletions
diff --git a/example-scripts/gstreamer/play-cam1-av.sh b/example-scripts/gstreamer/play-cam1-av.sh
new file mode 100755
index 0000000..ab237ec
--- /dev/null
+++ b/example-scripts/gstreamer/play-cam1-av.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+gst-launch-1.0 \
+ tcpclientsrc host=localhost port=13000 !\
+ matroskademux name=demux \
+ \
+ demux. !\
+ queue !\
+ glupload !\
+ glimagesink ts-offset=500000000 \
+ \
+ demux. !\
+ queue !\
+ alsasink provide-clock=false ts-offset=500000000
diff --git a/example-scripts/gstreamer/play-mixed-audio.sh b/example-scripts/gstreamer/play-mixed-audio.sh
new file mode 100755
index 0000000..a1dfa1f
--- /dev/null
+++ b/example-scripts/gstreamer/play-mixed-audio.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+gst-launch-1.0 \
+ tcpclientsrc host=localhost port=11000 !\
+ matroskademux !\
+ alsasink ts-offset=500000000
diff --git a/example-scripts/gstreamer/play-mixed-av.sh b/example-scripts/gstreamer/play-mixed-av.sh
new file mode 100755
index 0000000..7437f43
--- /dev/null
+++ b/example-scripts/gstreamer/play-mixed-av.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+gst-launch-1.0 \
+ tcpclientsrc host=localhost port=11000 !\
+ matroskademux name=demux \
+ \
+ demux. !\
+ queue !\
+ glupload !\
+ glimagesink ts-offset=500000000 \
+ \
+ demux. !\
+ queue !\
+ alsasink provide-clock=false ts-offset=500000000
diff --git a/example-scripts/gstreamer/play-mixed-video.sh b/example-scripts/gstreamer/play-mixed-video.sh
new file mode 100755
index 0000000..49cc6f7
--- /dev/null
+++ b/example-scripts/gstreamer/play-mixed-video.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+gst-launch-1.0 \
+ tcpclientsrc host=localhost port=11000 !\
+ matroskademux !\
+ glupload !\
+ glimagesink ts-offset=500000000
diff --git a/example-scripts/gstreamer/play-mixer-video.sh b/example-scripts/gstreamer/play-mixer-video.sh
new file mode 100644
index 0000000..49cc6f7
--- /dev/null
+++ b/example-scripts/gstreamer/play-mixer-video.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+gst-launch-1.0 \
+ tcpclientsrc host=localhost port=11000 !\
+ matroskademux !\
+ glupload !\
+ glimagesink ts-offset=500000000
diff --git a/example-scripts/gstreamer/record-mixed-av.sh b/example-scripts/gstreamer/record-mixed-av.sh
new file mode 100755
index 0000000..b8818c6
--- /dev/null
+++ b/example-scripts/gstreamer/record-mixed-av.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+gst-launch-1.0 \
+ tcpclientsrc host=localhost port=11000 !\
+ matroskademux name=demux \
+ \
+ demux. !\
+ queue !\
+ videoconvert !\
+ avenc_mpeg2video bitrate=5000000 max-key-interval=0 !\
+ queue !\
+ mux. \
+ \
+ demux. !\
+ queue !\
+ audioconvert !\
+ avenc_mp2 bitrate=192000 !\
+ queue !\
+ mux. \
+ \
+ mpegtsmux name=mux !\
+ filesink location=foo.ts
diff --git a/example-scripts/gstreamer/source-avsync-test-clip-as-cam1.sh b/example-scripts/gstreamer/source-avsync-test-clip-as-cam1.sh
new file mode 100755
index 0000000..ca7fc27
--- /dev/null
+++ b/example-scripts/gstreamer/source-avsync-test-clip-as-cam1.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+gst-launch-1.0 \
+ uridecodebin \
+ uri=http://c3voc.mazdermind.de/testfiles/avsync.mp4 \
+ name=src \
+ \
+ src. !\
+ queue !\
+ videoconvert !\
+ videoscale !\
+ video/x-raw,format=UYVY,width=1920,height=1080,framerate=25/1,pixel-aspect-ratio=1/1 ! \
+ mux. \
+ \
+ src. !\
+ queue !\
+ audioconvert !\
+ audioresample !\
+ audiorate !\
+ audio/x-raw,format=S16LE,channels=2,layout=interleaved,rate=48000 !\
+ mux. \
+ \
+ matroskamux name=mux !\
+ tcpclientsink host=localhost port=10000
diff --git a/example-scripts/gstreamer/source-background-loop.py b/example-scripts/gstreamer/source-background-loop.py
new file mode 100755
index 0000000..be59d18
--- /dev/null
+++ b/example-scripts/gstreamer/source-background-loop.py
@@ -0,0 +1,66 @@
+#!/usr/bin/python3
+import sys, gi, signal
+
+gi.require_version('Gst', '1.0')
+from gi.repository import Gst, GObject
+
+# init GObject & Co. before importing local classes
+GObject.threads_init()
+Gst.init([])
+
+class LoopSource(object):
+ def __init__(self):
+ # it works much better with a local file
+ pipeline = """
+ uridecodebin name=src uri=http://c3voc.mazdermind.de/testfiles/bg.ts !
+ videoscale !
+ videoconvert !
+ video/x-raw,format=UYVY,width=1920,height=1080,framerate=25/1,pixel-aspect-ratio=1/1 !
+ matroskamux !
+ tcpclientsink host=localhost port=16000
+ """
+
+ self.senderPipeline = Gst.parse_launch(pipeline)
+ self.src = self.senderPipeline.get_by_name('src')
+
+ # Binding End-of-Stream-Signal on Source-Pipeline
+ self.senderPipeline.bus.add_signal_watch()
+ self.senderPipeline.bus.connect("message::eos", self.on_eos)
+ self.senderPipeline.bus.connect("message::error", self.on_error)
+
+ print("playing")
+ self.senderPipeline.set_state(Gst.State.PLAYING)
+
+
+ def on_eos(self, bus, message):
+ print('Received EOS-Signal, Seeking to start')
+ self.src.seek(
+ 1.0, # rate (float)
+ Gst.Format.TIME, # format (Gst.Format)
+ Gst.SeekFlags.FLUSH, # flags (Gst.SeekFlags)
+ Gst.SeekType.SET, # start_type (Gst.SeekType)
+ 0, # start (int)
+ Gst.SeekType.NONE, # stop_type (Gst.SeekType)
+ 0 # stop (int)
+ )
+
+ def on_error(self, bus, message):
+ print('Received Error-Signal')
+ (error, debug) = message.parse_error()
+ print('Error-Details: #%u: %s' % (error.code, debug))
+ sys.exit(1)
+
+def main():
+ signal.signal(signal.SIGINT, signal.SIG_DFL)
+
+ src = LoopSource()
+
+ mainloop = GObject.MainLoop()
+ try:
+ mainloop.run()
+ except KeyboardInterrupt:
+ print('Terminated via Ctrl-C')
+
+
+if __name__ == '__main__':
+ main()
diff --git a/example-scripts/gstreamer/source-test-background.sh b/example-scripts/gstreamer/source-test-background.sh
new file mode 100755
index 0000000..94dc978
--- /dev/null
+++ b/example-scripts/gstreamer/source-test-background.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+gst-launch-1.0 \
+ videotestsrc pattern=ball !\
+ video/x-raw,format=UYVY,width=1280,height=720,framerate=25/1,pixel-aspect-ratio=1/1 !\
+ matroskamux !\
+ tcpclientsink host=localhost port=16000
diff --git a/example-scripts/gstreamer/visualize-mixed-audio.sh b/example-scripts/gstreamer/visualize-mixed-audio.sh
new file mode 100755
index 0000000..ce9bc0a
--- /dev/null
+++ b/example-scripts/gstreamer/visualize-mixed-audio.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+gst-launch-1.0 \
+ tcpclientsrc host=localhost port=13000 !\
+ matroskademux !\
+ audioconvert !\
+ wavescope shader=none style=lines !\
+ video/x-raw,width=800,height=300 !\
+ glupload !\
+ glimagesink