.bash_aliases
· 2.0 KiB · Bash
Bruto
alias install_no="sudo pacman -Sy"
alias install_ya="yay -S --noconfirm"
alias backupvps="rsync -avhzr --delete --progress --rsh='ssh -p22' user@ip:/ --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found","/swapfile","/boot/*"} /to/dir/"
# Compress a video with CUDA acceleration (GPU from NVIDIA is required)
function reducevideo {
ffmpeg -hwaccel cuda -i "$1" -c:v libx265 -vtag hvc1 -c:a copy "$2"
}
alias reducevideo="reducevideo"
# Download videos from YouTube in full HD. Creates an JSON file with all the information about the video, includes the chapters, and more.
function ytdl {
yt-dlp \
--check-formats \
--progress \
--ignore-errors \
--format "bv*[height<1080][ext=mp4]+ba" \
--merge-output mkv \
--write-info-json \
--write-annotations \
--write-thumbnail \
--convert-thumbnails jpg \
--add-metadata \
--convert-thumbnail jpg \
--embed-thumbnail \
--embed-chapters \
--embed-info-json \
--restrict-filenames \
--concurrent-fragments 3 \
--sponsorblock-mark all,-preview,-filler,-interaction \
-o "/to/dir/%(channel)s/%(upload_date>%Y-%m-%d)s - %(title)s.%(ext)s" "$1"
notify-send "Video file saved."
}
alias ytdl="ytdl"
# Download a video from YouTube and convert it to a MP3 file. Embed the cover to the file.
function ytdla {
yt-dlp \
--check-formats \
--progress \
--ignore-errors \
--write-info-json \
--no-call-home \
--add-metadata \
--audio-format "mp3" \
--extract-audio \
--format bestaudio/best \
--embed-thumbnail \
--restrict-filenames \
--concurrent-fragments 3 \
-o "/to/dir/%(uploader)s/%(upload_date>%Y-%m-%d)s - %(title)s (%(id)s).%(ext)s" "$1"
notify-send "Audio filed saved."
}
alias ytdla="ytdla"
# Compress an image by reducing size and quality and remove all metadata. Inspired from Telegram.
function reduceimage {
convert -resize 2000x2000 -quality 70 "$1".jpg "$1"-r.webp
exiftool -overwrite_original -all= "$1"-r.webp
}
alias reduceimage="reduceimage"
| 1 | alias install_no="sudo pacman -Sy" |
| 2 | alias install_ya="yay -S --noconfirm" |
| 3 | alias backupvps="rsync -avhzr --delete --progress --rsh='ssh -p22' user@ip:/ --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found","/swapfile","/boot/*"} /to/dir/" |
| 4 | |
| 5 | |
| 6 | # Compress a video with CUDA acceleration (GPU from NVIDIA is required) |
| 7 | function reducevideo { |
| 8 | ffmpeg -hwaccel cuda -i "$1" -c:v libx265 -vtag hvc1 -c:a copy "$2" |
| 9 | } |
| 10 | |
| 11 | alias reducevideo="reducevideo" |
| 12 | |
| 13 | |
| 14 | # Download videos from YouTube in full HD. Creates an JSON file with all the information about the video, includes the chapters, and more. |
| 15 | function ytdl { |
| 16 | yt-dlp \ |
| 17 | --check-formats \ |
| 18 | --progress \ |
| 19 | --ignore-errors \ |
| 20 | --format "bv*[height<1080][ext=mp4]+ba" \ |
| 21 | --merge-output mkv \ |
| 22 | --write-info-json \ |
| 23 | --write-annotations \ |
| 24 | --write-thumbnail \ |
| 25 | --convert-thumbnails jpg \ |
| 26 | --add-metadata \ |
| 27 | --convert-thumbnail jpg \ |
| 28 | --embed-thumbnail \ |
| 29 | --embed-chapters \ |
| 30 | --embed-info-json \ |
| 31 | --restrict-filenames \ |
| 32 | --concurrent-fragments 3 \ |
| 33 | --sponsorblock-mark all,-preview,-filler,-interaction \ |
| 34 | -o "/to/dir/%(channel)s/%(upload_date>%Y-%m-%d)s - %(title)s.%(ext)s" "$1" |
| 35 | |
| 36 | notify-send "Video file saved." |
| 37 | } |
| 38 | |
| 39 | alias ytdl="ytdl" |
| 40 | |
| 41 | |
| 42 | # Download a video from YouTube and convert it to a MP3 file. Embed the cover to the file. |
| 43 | function ytdla { |
| 44 | yt-dlp \ |
| 45 | --check-formats \ |
| 46 | --progress \ |
| 47 | --ignore-errors \ |
| 48 | --write-info-json \ |
| 49 | --no-call-home \ |
| 50 | --add-metadata \ |
| 51 | --audio-format "mp3" \ |
| 52 | --extract-audio \ |
| 53 | --format bestaudio/best \ |
| 54 | --embed-thumbnail \ |
| 55 | --restrict-filenames \ |
| 56 | --concurrent-fragments 3 \ |
| 57 | -o "/to/dir/%(uploader)s/%(upload_date>%Y-%m-%d)s - %(title)s (%(id)s).%(ext)s" "$1" |
| 58 | |
| 59 | notify-send "Audio filed saved." |
| 60 | } |
| 61 | |
| 62 | alias ytdla="ytdla" |
| 63 | |
| 64 | |
| 65 | # Compress an image by reducing size and quality and remove all metadata. Inspired from Telegram. |
| 66 | function reduceimage { |
| 67 | convert -resize 2000x2000 -quality 70 "$1".jpg "$1"-r.webp |
| 68 | exiftool -overwrite_original -all= "$1"-r.webp |
| 69 | } |
| 70 | |
| 71 | alias reduceimage="reduceimage" |