-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a1d0af5
Showing
12 changed files
with
2,664 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# VNREZ Tool [<img src="./assets/icon.png" width="225" align="left" alt="VNREZ Logo">](https://github.com/verysillycat/vnrez) | ||
|
||
#### Make Recordings & Screenshots and upload them to your favorite file hosts on Linux, with support for region, GIF, and audio at ease. | ||
|
||
[![Total Commits](https://img.shields.io/github/commit-activity/t/verysillycat/vnrez?style=flat&logo=github&label=Commits&labelColor=%230f0f0f&color=%23191919)](https://github.com/verysillycat/vnrez/commits/) | ||
<br> | ||
[![Last commit](https://img.shields.io/github/last-commit/verysillycat/vnrez?style=flat&logo=git&logoColor=d16d38&label=Activity&labelColor=%230F0F0F&color=1A1A1A)](https://github.com/verysillycat/vnrez/commits/) | ||
<br><br><br><br> | ||
|
||
## Dependencies | ||
|
||
- **Wayland**: `jq`, `wl-clipboard`, `slurp` & `wf-recorder` or `wl-screenrec` | ||
- **COSMIC & GNOME / KDE Wayland**: `jq`, `wl-clipboard` & `kooha` | ||
- **X11**: `jq`, `xclip`, `slop` & `ffmpeg` | ||
|
||
<details> | ||
<summary>How to install them?</summary> | ||
|
||
Go to your prefered terminal and execute this command depending on your Distro. | ||
| Compositor | Distribution | Instructions | | ||
| ------------------- | ----------------------- | ----------------------------------------------------------------------------------------------------- | | ||
| **Wayland** | **Debian/Ubuntu** | `sudo apt install wf-recorder jq wl-clipboard slurp` or `sudo apt install wl-screenrec jq wl-clipboard slurp` | | ||
| **Wayland** | **Fedora** | `sudo dnf install wf-recorder jq wl-clipboard slurp` or `sudo dnf install wl-screenrec jq wl-clipboard slurp` | | ||
| **Wayland** | **Arch** | `sudo pacman -S wf-recorder jq wl-clipboard slurp` or `sudo pacman -S wl-screenrec jq wl-clipboard slurp` | | ||
| **Wayland** | **Gentoo** | `sudo emerge -av gui-apps/wf-recorder app-misc/jq x11-misc/wl-clipboard gui-apps/slurp` or `sudo emerge -av media-video/wl-screenrec app-misc/jq x11-misc/wl-clipboard gui-apps/slurp` | | ||
|
||
| Compositor | Distribution | Instructions | | ||
| ---------- | ----------------- | ----------------------------------------------------------------------------- | | ||
| **X11** | **Debian/Ubuntu** | `sudo apt install ffmpeg jq xclip slop` | | ||
| **X11** | **Fedora** | `sudo apt install ffmpeg jq xclip slop` | | ||
| **X11** | **Arch** | `sudo pacman -S ffmpeg jq xclip slop` | | ||
| **X11** | **Gentoo** | `sudo emerge -av media-video/ffmpeg app-misc/jq x11-misc/xclip x11-misc/slop` | | ||
|
||
| Compositor | Distribution | Instructions | | ||
| -------------------------------- | ----------------- | --------------------------------------------------------------------- | | ||
| **COSMIC & GNOME / KDE Wayland** | **Debian/Ubuntu** | `sudo apt install kooha jq wl-clipboard` | | ||
| **COSMIC & GNOME / KDE Wayland** | **Fedora** | `sudo dnf install kooha jq wl-clipboard` | | ||
| **COSMIC & GNOME / KDE Wayland** | **Arch** | `sudo pacman -S kooha jq wl-clipboard` | | ||
| **COSMIC & GNOME / KDE Wayland** | **Gentoo** | `sudo emerge -av media-video/kooha app-misc/jq x11-misc/wl-clipboard` | | ||
|
||
</details> | ||
|
||
## Installation | ||
<!-- | ||
[![vnrez](https://img.shields.io/badge/AVAILABLE_ON_THE_AUR-333232?style=for-the-badge&logo=arch-linux&logoColor=3d67db&labelColor=%23171717)](https://aur.archlinux.org/packages/vnrez) | ||
--> | ||
|
||
```bash | ||
git clone https://github.com/verysillycat/vnrez | ||
cd vnrez | ||
# [!] Start the Script to Create the Configuration file | ||
./vnrez.sh | ||
``` | ||
|
||
<details> | ||
<summary>How to get my API KEY?</summary> | ||
Log in to Your Preferred File Host, Go to Account Settings, and Copy your API KEY<br> | ||
Now paste that API KEY when doing the initial setup. | ||
</details> | ||
|
||
## Arguments | ||
|
||
- `--help (-h)` show the list of arguments | ||
- `upload (-u)` upload specified video files (mp4, mkv, webm, gif) | ||
- `config` open the configuration file in the default text editor | ||
- `reinstall` reinstall the configuration file with default settings | ||
|
||
### Recording | ||
<small><strong>case: record</strong></small> | ||
- `--abort` abort recording and the upload | ||
- `--sound` snip with sound | ||
- `--fullscreen` full screen without sound | ||
- `--fullscreen-sound` fullscreen with sound | ||
- `--gif` snip with gif output | ||
|
||
##### ★ When using Kooha, you'll not see some of these arguments as they aren't needed. | ||
|
||
### Screenshot | ||
<small><strong>case: shot</strong></small> | ||
- `--gui` select a region to screenshot | ||
- `--full` full screen screenshot | ||
|
||
## Configuration | ||
|
||
- `fps` will be your Max FPS | ||
- `pixelformat` set the pixel format, default is `yuv420p` | ||
- `encoder` set the encoder, default is `libx264` | ||
- `preset` set the preset profile | ||
- `wlscreenrec` set to true if want to use `wl-screenrec` (only for wl-roots based DEs and recommend for old GPUs/iGPUs) | ||
- `bitrate` set the bitrate (only for `wl-screenrec`) | ||
- `codec` set the codec, default is `hevc` (only for `wl-screenrec`) | ||
- `extpixelformat` set the pixel format, default is `nv12` (only for `wl-screenrec`) | ||
- `crf` set crf number | ||
- `save` will save your Recorded Videos on `~/Videos` | ||
- `failsave` if your Video Recording upload fails, it will be saved on `~/Videos/e-zfailed` | ||
- `colorworkaround` re-encode videos on upload for color correction, might take longer to upload | ||
- `startnotif` show the start notification or not | ||
- `endnotif` show the end notification or not | ||
- `directory` set directory to save videos in there will be ignored if using kooha | ||
- `kooha_dir` set the kooha directory also save videos in here if using kooha | ||
|
||
##### ☆ When using Kooha, some of these arguments are unnecessary as they are not supported or required. | ||
|
||
## Credits | ||
|
||
This script was is based on [End's Dotfiles Record script](https://github.com/end-4/dots-hyprland/blob/main/.config/ags/scripts/record-script.sh) but to support alot more DEs, Configuration, allow GIF Output & more. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
if [ -f "$CONFIG_FILE" ]; then | ||
source "$CONFIG_FILE" | ||
fi | ||
|
||
check_root() { | ||
if [[ $EUID -eq 0 ]]; then | ||
echo -e "\e[31mThis script should not be run as root.\e[0m" | ||
sleep 1.8 | ||
exit 1 | ||
fi | ||
} | ||
|
||
check_variables() { | ||
if [[ -z "$service" ]]; then | ||
echo "Service is not set." | ||
echo "Edit the configuration file with config argument to add the service." | ||
notify-send "Service is not set." 'Edit the configuration file to add the service.' -a "VENZ Recorder" | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "$auth" ]]; then | ||
if [[ ! "$service" = none ]]; then | ||
echo "API Key is not set." | ||
echo "Edit the configuration file with config argument to add the API Key." | ||
notify-send "API Key is not added." 'Edit the configuration file to add the API Key.' -a "VENZ Recorder" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
if [[ -z "$encoder" && ! ("$XDG_SESSION_TYPE" == "wayland" && ("$XDG_CURRENT_DESKTOP" == "GNOME" || "$XDG_CURRENT_DESKTOP" == "KDE" || "$XDG_CURRENT_DESKTOP" == "COSMIC")) ]]; then | ||
echo "Encoder is not set." | ||
echo "Edit the configuration file with config argument to add the encoder." | ||
notify-send "Encoder is not set." 'Edit the config file to add the encoder.' -a "VENZ Recorder" | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "$pixelformat" && ! ("$XDG_SESSION_TYPE" == "wayland" && ("$XDG_CURRENT_DESKTOP" == "GNOME" || "$XDG_CURRENT_DESKTOP" == "KDE" || "$XDG_CURRENT_DESKTOP" == "COSMIC")) ]]; then | ||
echo "Pixelformat is not set." | ||
echo "Edit the configuration file with config argument to add the pixelformat." | ||
notify-send "Pixelformat is not set." 'Edit the config file to add the pixelformat.' -a "VENZ Recorder" | ||
exit 1 | ||
fi | ||
} | ||
|
||
check_dependencies() { | ||
local missing_dependencies=() | ||
local dependencies=("jq" "curl" "flameshot") | ||
|
||
if [[ "$XDG_SESSION_TYPE" == "wayland" ]]; then | ||
if [[ "$XDG_CURRENT_DESKTOP" == "GNOME" || "$XDG_CURRENT_DESKTOP" == "KDE" || "$XDG_CURRENT_DESKTOP" == "COSMIC" ]]; then | ||
dependencies+=("wl-copy" "kooha") | ||
else | ||
dependencies+=("wl-copy" "slurp" "wlr-randr") | ||
if ! command -v "wf-recorder" &>/dev/null && ! command -v "wl-screenrec" &>/dev/null; then | ||
missing_dependencies+=("wf-recorder or wl-screenrec") | ||
fi | ||
fi | ||
else | ||
dependencies+=("xclip" "slop" "ffmpeg" "xdpyinfo") | ||
fi | ||
|
||
for dep in "${dependencies[@]}"; do | ||
if ! command -v "$dep" &>/dev/null; then | ||
missing_dependencies+=("$dep") | ||
fi | ||
done | ||
|
||
if [ ${#missing_dependencies[@]} -ne 0 ]; then | ||
local formatted_deps=$(IFS=, echo "${missing_dependencies[*]}") | ||
formatted_deps=${formatted_deps//,/, } | ||
formatted_deps=${formatted_deps//wl-copy/wl-clipboard} | ||
formatted_deps=$(echo "$formatted_deps" | sed 's/, \([^,]*\)$/ \& \1/') | ||
echo -e "\e[31mMissing Dependencies: \033[37;7m${formatted_deps}\033[0m\e[0m" | ||
echo "These are the required dependencies, install them and try again." | ||
notify-send "Missing Dependencies" "${formatted_deps}" -a "VNEZ" | ||
exit 1 | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
SCRIPT_DIR="$(dirname "$(realpath "$0")")" | ||
|
||
source "$SCRIPT_DIR/components/functions/variables.sh" | ||
|
||
create_default_config() { | ||
local service=$1 | ||
local auth_token=$2 | ||
local fps=$3 | ||
local crf=$4 | ||
local preset=$5 | ||
local pixelformat=$6 | ||
local extpixelformat=$7 | ||
local wlscreenrec=$8 | ||
local codec=${9} | ||
local directory=${10} | ||
local failsave=${11} | ||
local save=${12} | ||
local encoder=${13} | ||
|
||
mkdir -p "$CONFIG_DIR" | ||
|
||
local auth_variable="" | ||
if [[ "$service" != "none" ]]; then | ||
auth_variable="${service}_auth" | ||
if [[ "$service" == "e-z" ]]; then | ||
auth_variable="ez_auth" | ||
fi | ||
fi | ||
|
||
cat > "$CONFIG_FILE" << EOL | ||
service="$service"$( [[ -n "$auth_variable" ]] && echo -e "\n$auth_variable=\"$auth_token\"" ) | ||
fps=$fps | ||
crf=$crf | ||
preset=$preset | ||
pixelformat=$pixelformat | ||
encoder=$encoder | ||
save=$save | ||
failsave=$failsave | ||
colorworkaround=false | ||
startnotif=true | ||
endnotif=true | ||
wlscreenrec=$wlscreenrec | ||
codec=$codec | ||
extpixelformat=$extpixelformat | ||
directory="$directory" | ||
kooha_dir="~/Videos/Kooha" | ||
EOL | ||
|
||
if [[ "$prompt_service" != true ]]; then | ||
notify-send "Configuration Created" "VNEZ configuration has been created successfully" -a "VNEZ Recorder" | ||
fi | ||
} | ||
|
||
update_config() { | ||
local config_path="$(eval echo $CONFIG_FILE)" | ||
local updated=false | ||
local new_config_content="" | ||
local auth_variable="" | ||
if [[ "$service" != "none" ]]; then | ||
auth_variable="${service}_auth" | ||
if [[ "$service" == "e-z" ]]; then | ||
auth_variable="ez_auth" | ||
fi | ||
fi | ||
|
||
local default_config_content=$(cat << EOL | ||
service="default_service"$( [[ -n "$auth_variable" ]] && echo -e "\n$auth_variable=\"$auth_token\"" ) | ||
fps=60 | ||
crf=20 | ||
preset=fast | ||
pixelformat=yuv420p | ||
encoder=libx264 | ||
save=false | ||
failsave=true | ||
colorworkaround=false | ||
startnotif=true | ||
endnotif=true | ||
wlscreenrec=false | ||
codec=auto | ||
extpixelformat=nv12 | ||
bitrate="5 MB" | ||
directory="~/Videos" | ||
kooha_dir="~/Videos/Kooha" | ||
EOL | ||
) | ||
|
||
declare -A existing_config | ||
while IFS='=' read -r key value; do | ||
[[ "$key" =~ ^#.*$ || -z "$key" || -z "$value" ]] && continue | ||
existing_config["$key"]="$value" | ||
done < <(grep -v '^#' "$config_path") | ||
|
||
while IFS= read -r line; do | ||
if [[ "$line" =~ ^#.*$ || -z "$line" ]]; then | ||
new_config_content+="$line"$'\n' | ||
continue | ||
fi | ||
key=$(echo "$line" | cut -d '=' -f 1) | ||
if [[ "$key" == "auth" ]]; then | ||
for auth_key in e-z_auth nest_auth; do | ||
if [[ -n "${existing_config[$auth_key]}" ]]; then | ||
new_config_content+="$auth_key=${existing_config[$auth_key]}"$'\n' | ||
unset existing_config["$auth_key"] | ||
fi | ||
done | ||
elif [[ -z "${existing_config[$key]}" ]]; then | ||
new_config_content+="$line"$'\n' | ||
updated=true | ||
else | ||
new_config_content+="$key=${existing_config[$key]}"$'\n' | ||
unset existing_config["$key"] | ||
fi | ||
done <<<"$default_config_content" | ||
|
||
new_config_content=$(echo -n "$new_config_content") | ||
if [[ "$new_config_content" != "$(cat "$config_path")" ]]; then | ||
echo "$new_config_content" > "$config_path" | ||
echo "Configuration updated." | ||
fi | ||
} |
Oops, something went wrong.