mirror of
https://github.com/JanJastrow/.dotfiles.git
synced 2024-11-21 18:19:56 +01:00
Compare commits
6 Commits
9f2b194021
...
b9fce71df9
Author | SHA1 | Date | |
---|---|---|---|
|
b9fce71df9 | ||
|
0f3778ba72 | ||
|
1c10548a77 | ||
|
4edf109dcd | ||
|
49b9c9f0d2 | ||
|
6a4d49cb73 |
@ -80,10 +80,11 @@ ff-x264-scale540p() {
|
|||||||
|
|
||||||
# Recompress input MP4 to 720p AV1 MP4 (copy audio)
|
# Recompress input MP4 to 720p AV1 MP4 (copy audio)
|
||||||
ff-av1-scale720p() {
|
ff-av1-scale720p() {
|
||||||
|
local crf=${1-23}
|
||||||
for input in *.mp4; do
|
for input in *.mp4; do
|
||||||
if [[ -f "$input" ]]; then
|
if [[ -f "$input" ]]; then
|
||||||
tempfile="temp_${input%.mp4}"
|
tempfile="temp_${input%.mp4}"
|
||||||
ffmpeg -hide_banner -loglevel info -i "$input" -vf format=yuv420p10le,scale=1280:-2 -c:v libsvtav1 -preset 6 -crf 23 -g 30 -svtav1-params tune=0 -c:a copy -c:s copy "$tempfile.mp4"
|
ffmpeg -hide_banner -loglevel info -i "$input" -vf format=yuv420p10le,scale=1280:-2 -c:v libsvtav1 -preset 6 -crf "$crf" -g 30 -svtav1-params tune=0 -c:a copy -c:s copy "$tempfile.mp4"
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
mv "$input" "_$input"
|
mv "$input" "_$input"
|
||||||
mv "$tempfile.mp4" "$input"
|
mv "$tempfile.mp4" "$input"
|
||||||
@ -93,14 +94,16 @@ ff-av1-scale720p() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
pushover "FFmpeg done ✔"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Recompress input MP4 to 540p AV1 MP4 (copy audio)
|
# Recompress input MP4 to 540p AV1 MP4 (copy audio)
|
||||||
ff-av1-scale540p() {
|
ff-av1-scale540p() {
|
||||||
|
local crf=${1-23}
|
||||||
for input in *.mp4; do
|
for input in *.mp4; do
|
||||||
if [[ -f "$input" ]]; then
|
if [[ -f "$input" ]]; then
|
||||||
tempfile="temp_${input%.mp4}"
|
tempfile="temp_${input%.mp4}"
|
||||||
ffmpeg -hide_banner -loglevel info -i "$input" -vf format=yuv420p10le,scale=960:-2 -c:v libsvtav1 -preset 6 -crf 23 -g 30 -svtav1-params tune=0 -c:a copy -c:s copy "$tempfile.mp4"
|
ffmpeg -hide_banner -loglevel info -i "$input" -vf format=yuv420p10le,scale=960:-2 -c:v libsvtav1 -preset 6 -crf "$crf" -g 30 -svtav1-params tune=0 -c:a copy -c:s copy "$tempfile.mp4"
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
mv "$input" "_$input"
|
mv "$input" "_$input"
|
||||||
mv "$tempfile.mp4" "$input"
|
mv "$tempfile.mp4" "$input"
|
||||||
@ -110,6 +113,7 @@ ff-av1-scale540p() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
pushover "FFmpeg done ✔"
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
28
zsh/scripts
28
zsh/scripts
@ -39,18 +39,20 @@ function manp() {
|
|||||||
man -t $1 | pstopdf -o $TMPDIR/$1.pdf && open $TMPDIR/$1.pdf && sleep 1 && rm $TMPDIR/$1.pdf
|
man -t $1 | pstopdf -o $TMPDIR/$1.pdf && open $TMPDIR/$1.pdf && sleep 1 && rm $TMPDIR/$1.pdf
|
||||||
}
|
}
|
||||||
|
|
||||||
# pushover notification
|
# Send pushover notification (if set)
|
||||||
function pushover() {
|
if [[ -z "$pushover_token" ]]; then
|
||||||
curl -s \
|
function pushover() {
|
||||||
--form-string "token=$pushover_token" \
|
curl -s \
|
||||||
--form-string "user=$pushover_user" \
|
--form-string "token=$pushover_token" \
|
||||||
--form-string "title=$HOST" \
|
--form-string "user=$pushover_user" \
|
||||||
--form-string "message=$1" \
|
--form-string "title=$HOST" \
|
||||||
https://api.pushover.net/1/messages.json
|
--form-string "message=$1" \
|
||||||
}
|
https://api.pushover.net/1/messages.json
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
# png to jpg 95
|
# png to jpeg 95
|
||||||
function png2web() {
|
function png2jpeg() {
|
||||||
findpath=$1
|
findpath=$1
|
||||||
: "${findpath:="."}"
|
: "${findpath:="."}"
|
||||||
find "$findpath" -name '*.png' | while read -r f ; do
|
find "$findpath" -name '*.png' | while read -r f ; do
|
||||||
@ -63,7 +65,7 @@ function png2web() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function jpeg1024() {
|
function jpeg1024() {
|
||||||
magick "$1" -resize '1024x1024\>' -background black -flatten TGA:- | cjpeg -targo -quality 90 -optimize -progressive -outfile "$1".jpg
|
magick "$1" -resize '1024x1024\>' -background black -flatten TGA:- | cjpeg -targo -optimize -progressive -quality 90 -outfile "$1".jpg
|
||||||
}
|
}
|
||||||
|
|
||||||
# Make PDFs look like scanned
|
# Make PDFs look like scanned
|
||||||
@ -105,7 +107,7 @@ function dl() {
|
|||||||
echo "usage: dl url (directory)"
|
echo "usage: dl url (directory)"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [[ -x $(which aria2) ]]; then
|
if [[ -x $(which aria2c) ]]; then
|
||||||
aria2c --dir="$HOME/Downloads" --continue=true --max-connection-per-server=5 "$1"
|
aria2c --dir="$HOME/Downloads" --continue=true --max-connection-per-server=5 "$1"
|
||||||
else
|
else
|
||||||
(cd "$HOME/Downloads" && curl -O "$1")
|
(cd "$HOME/Downloads" && curl -O "$1")
|
||||||
|
Loading…
Reference in New Issue
Block a user