X-Git-Url: https://git.ao2.it/experiments/gstreamer.git/blobdiff_plain/01038cb6fde6dd9f95879b82c387a99b90710054..2e8d81473f8663741c2860a8ee6e92fc994bbf39:/shell/gst-screencast.sh diff --git a/shell/gst-screencast.sh b/shell/gst-screencast.sh index 243e556..dd4cd88 100755 --- a/shell/gst-screencast.sh +++ b/shell/gst-screencast.sh @@ -73,8 +73,9 @@ done [ -f "$1" ] && { echo "Error: file '${1}' already exists!" 1>&2; exit 2; } FILENAME="$1" +shift -if [ "x" = "x$2" ]; +if [ "x" = "x$1" ]; then SHADOW_SIZE=0 SHADOW_X_OFFSET=0 @@ -99,7 +100,7 @@ then XIMAGESRC_ARGS="startx=$(($X + $SHADOW_SIZE - $SHADOW_X_OFFSET)) starty=$(($Y + $SHADOW_SIZE - $SHADOW_Y_OFFSET)) endx=$(($X + $WIDTH - 1 - $SHADOW_SIZE - $SHADOW_X_OFFSET)) endy=$(($Y + $HEIGHT - 1 - $SHADOW_SIZE - $SHADOW_Y_OFFSET))" else - XIMAGESRC_ARGS="$2" + XIMAGESRC_ARGS="$@" fi if [ $SINGLE_SHOT -eq 1 ]; @@ -112,10 +113,28 @@ 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 \ + gst-launch-1.0 -v -e \ matroskamux name=mux ! filesink location="$FILENAME" \ ximagesrc use-damage=0 show-pointer=$SHOW_POINTER $XIMAGESRC_ARGS ! video/x-raw,framerate=25/1 ! \ videoconvert ! videorate ! $VIDEO_CODEC ! queue ! mux. \