gst-input-selector-switch.py: use a better pattern for the second source
[experiments/gstreamer.git] / shell / gst-spectrascope-test.sh
1 #!/bin/sh
2
3 set -e
4
5 # Monitor the default sink
6 DEFAULT_OUTPUT_MONITOR="$(pacmd stat | grep "Default sink" | cut -d ':' -f 2 | tail -c+2).monitor"
7
8 # Take the most recent source as the microphone (in my case it's a USB
9 # microphone I plugged in after pulseaudio started).
10 MICROPHONE=$(pactl list short sources | tail -1 | cut -f 2)
11
12 set -x
13 gst-launch-1.0 -v -e \
14         compositor name=mix sink_1::xpos=256 sink_2::ypos=256 \
15         ! 'video/x-raw, width=512, height=512, framerate=(fraction)30/1' \
16         ! videoconvert \
17         ! autovideosink \
18         pulsesrc device="$DEFAULT_OUTPUT_MONITOR" \
19         ! deinterleave name=deint \
20           deint. \
21           ! audioconvert \
22           ! spectrascope \
23           ! 'video/x-raw, width=256, height=256, framerate=(fraction)30/1' \
24           ! textoverlay valignment=center font-desc='Sans, 50' text='Left speaker' \
25           ! queue \
26           ! mix. \
27           deint. \
28           ! audioconvert \
29           ! spectrascope \
30           ! 'video/x-raw, width=256, height=256, framerate=(fraction)30/1' \
31           ! textoverlay valignment=center font-desc='Sans, 50' text='Right speaker' \
32           ! queue \
33           ! mix. \
34         pulsesrc device="$MICROPHONE" \
35           ! audioconvert \
36           ! spectrascope \
37           ! 'video/x-raw, width=512, height=256, framerate=(fraction)30/1' \
38           ! textoverlay valignment=center font-desc='Sans, 50' text='Microphone' \
39           ! queue \
40           ! mix.