From 5c81bb561b1911d46afbdf6de10a0f4422913de4 Mon Sep 17 00:00:00 2001 From: Jesse Bryan Date: Tue, 5 Sep 2017 03:21:11 -0500 Subject: [PATCH] audio: added an audio option in the config --- README.md | 37 ++++++++++++++++++++++++++++++++++++- config/config.conf | 5 +++++ gsu | 18 +++++++++++++++--- gsu.1 | 4 ++-- 4 files changed, 58 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a06b8e8..91e19ac 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ $ sudo apt-get install maim slop ffmpeg curl jq **Unsupported.** slop and maim both are terribly out of date in Ubuntu's 17.04 repositories, resulting in artifacting and improper screenshots. When Ubuntu 17.10 is released, it will be properly supported. -If you can't wait until then, you can install [slop] and [maim] from source. Afterwards, run the following command. +If you can't wait until then, you can install [slop] and [maim] from source. Afterwards, run the following command to install the remaining dependencies. ``` $ sudo apt-get install ffmpeg curl jq @@ -90,6 +90,37 @@ $ sudo make install You can optionally install `xclip` if you want automatic URL clipboard pasting after the utility finishes an upload. +## Configuration + +The configuration file can be found in `$XDG_CONFIG_HOME/gsu`. The most common location is `~/.config/gsu`. + +```bash +# Audio input device. If empty, gsu defaults to pulseaudio. +# See https://www.ffmpeg.org/ffmpeg-devices.html#Input-Devices for a list +# of valid input devices. +AUDIO="" + +# Streamable email/username. +# REQUIRED for video upload without a custom upload command. +STREAMABLE_USER="" + +# Streamable password. +# REQUIRED for video upload without a custom upload command. +STREAMABLE_PASS="" + +# Custom screenshot upload command. Leave empty to upload to uguu.se. +# Use the string "GSUFILEOUT" to refer to your gsu operand. +S_UPLOAD="" + +# Custom video upload command. Leave empty to upload to streamable. +# Use the string "GSUFILEOUT" to refer to your gsu operand. +V_UPLOAD="" + +# Custom gif upload command. Leave empty to upload to uguu.se. +# Use the string "GSUFILEOUT" to refer to your gsu operand. +G_UPLOAD="" +``` + ## Troubleshooting Here are some frequent problems users may face and their respective solutions. If you have more solutions, feel free to send in an issue or pull request. @@ -101,6 +132,10 @@ This is a common problem with older versions of maim. You have a few choices: * On Debian 8, enable the `unstable` APT repository, and upgrade maim and slop. * On Ubuntu 17.04 and other distros, install both maim and slop from source. +### There is no audio in the captured video. + +Pulseaudio is the default audio capture device. If you do not use pulseaudio, adjust your audio capture device in the configuration file. + ## Credits * [Dalton Nell](https://github.com/naelstrof) for maim and slop, used for screenshot creation and selections diff --git a/config/config.conf b/config/config.conf index 8be5524..eab2d15 100755 --- a/config/config.conf +++ b/config/config.conf @@ -1,5 +1,10 @@ #!/usr/bin/env bash +# Audio input device. If empty, gsu defaults to pulseaudio. +# See https://www.ffmpeg.org/ffmpeg-devices.html#Input-Devices for a list +# of valid input devices. +AUDIO="" + # Streamable email/username. # REQUIRED for video upload without a custom upload command. STREAMABLE_USER="" diff --git a/gsu b/gsu index 2e9bebc..db9b76f 100755 --- a/gsu +++ b/gsu @@ -1,6 +1,6 @@ #!/usr/bin/env bash -VERSION="1.1.1" +VERSION="1.1.1-git" config_path="${XDG_CONFIG_HOME:-${HOME}/.config}/gsu" print_help() { @@ -233,12 +233,24 @@ get_command() { countdown "$countdown_enable" "Handing control over to ffmpeg in COUNTNUM seconds." fi + if [[ -z "$AUDIO" ]]; then + if ! type -p pulseaudio >/dev/null; then + echo -e "\ngsu: no audio device set, default device 'pulse' cannot be found" + echo "Either install pulseaudio, " + echo "or add your audio device to `$config_path/config.conf`" + + exit 1 + fi + + AUDIO="pulse" + fi + echo "Press [q] or [Ctrl+C] to stop recording." if [[ -z "$display" ]]; then - cmd=$(ffmpeg -y -f alsa -i pulse -r 30 -f x11grab -show_region 1 $draw_mouse -s "$W"x"$H" -i :0.0+$X,$Y -c:v libx264 -crf 18 -preset:v ultrafast -c:a aac -b:a 192k -loglevel error "$output" 2>&1>/dev/null) + cmd=$(ffmpeg -y -f alsa -i $AUDIO -r 30 -f x11grab -show_region 1 $draw_mouse -s "$W"x"$H" -i :0.0+$X,$Y -c:v libx264 -crf 18 -preset:v ultrafast -c:a aac -b:a 192k -loglevel error "$output" 2>&1>/dev/null) else - cmd=$(ffmpeg -y -f alsa -i pulse -r 30 -f x11grab -show_region 1 $draw_mouse -s "$MONW"x"$MONH" -i :0.0+$MONX,$MONY -c:v libx264 -crf 18 -preset:v ultrafast -c:a aac -b:a 192k -loglevel error "$output" 2>&1>/dev/null) + cmd=$(ffmpeg -y -f alsa -i $AUDIO -r 30 -f x11grab -show_region 1 $draw_mouse -s "$MONW"x"$MONH" -i :0.0+$MONX,$MONY -c:v libx264 -crf 18 -preset:v ultrafast -c:a aac -b:a 192k -loglevel error "$output" 2>&1>/dev/null) fi ;; esac diff --git a/gsu.1 b/gsu.1 index 0ee3e29..b953e5e 100644 --- a/gsu.1 +++ b/gsu.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4. -.TH GSU "1" "September 2017" "gsu 1.1.1" "User Commands" +.TH GSU "1" "September 2017" "gsu 1.1.1-git" "User Commands" .SH NAME -gsu \- manual page for gsu 1.1.1 +gsu \- manual page for gsu 1.1.1-git .SH SYNOPSIS .B gsu [\fI\,OPTION\/\fR]... \fI\,SOURCE\/\fR