audio: added an audio option in the config

This commit is contained in:
Jesse Bryan 2017-09-05 03:21:11 -05:00
parent a411eb47ea
commit 5c81bb561b
4 changed files with 58 additions and 6 deletions

View file

@ -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

View file

@ -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=""

18
gsu
View file

@ -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

4
gsu.1
View file

@ -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