From cacb93686a91d926aec7a3a07e21582fdffaa016 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Wed, 29 Aug 2018 12:43:37 +0200 Subject: [PATCH] gst-screencast.sh: fix and improve audio recording --- shell/gst-screencast.sh | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/shell/gst-screencast.sh b/shell/gst-screencast.sh index e601a62..dd4cd88 100755 --- a/shell/gst-screencast.sh +++ b/shell/gst-screencast.sh @@ -113,7 +113,25 @@ else if [ $CAPTURE_AUDIO -eq 1 ]; then - AUDIO_PIPELINE="pulsesrc ! audioconvert ! audio/x-raw,rate=44100,channels=2 ! queue ! mux." + # Record from everything + if ! pactl list short sinks | grep -q module-null-sink; + then + + PA_IDS=$(pactl load-module module-null-sink) + trap 'exit 1' INT + trap 'trap INT; for pa_id in $PA_IDS; do pactl unload-module "$pa_id"; done' EXIT + + SOURCES=$(pactl list short sources | cut -f 2 | grep -v "^null\.monitor$") + for source in $SOURCES; + do + MODULE_ID=$(pactl load-module module-loopback latency_msec=1 source="$source" sink=null) + PA_IDS="$MODULE_ID $PA_IDS" + done + + pactl set-sink-mute null 0 + fi + + AUDIO_PIPELINE="pulsesrc device=null.monitor ! audioconvert ! audio/x-raw,rate=44100,channels=2 ! vorbisenc ! queue ! mux." fi gst-launch-1.0 -v -e \ -- 2.1.4