You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
3.2 KiB
Plaintext

webvideo () {
ffmpeg -i $1 -map_metadata -1 -c:a libopus -c:v libaom-av1 -crf 34 -b:v 0 -pix_fmt yuv420p -movflags +faststart -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" -strict experimental $1.av1.mp4
ffmpeg -i $1 -map_metadata -1 -c:a libfdk_aac -c:v libx265 -crf 24 -preset veryslow -pix_fmt yuv420p -movflags +faststart -tag:v hvc1 -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" $1.hevc.mp4
ffmpeg -i $1 -map_metadata -1 -c:a libfdk_aac -c:v libx264 -crf 24 -preset veryslow -profile:v main -pix_fmt yuv420p -movflags +faststart -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" $1.h264.mp4
}
webvideonoaudio () {
ffmpeg -i $1 -map_metadata -1 -an -c:v libaom-av1 -crf 34 -b:v 0 -pix_fmt yuv420p -movflags +faststart -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" -strict experimental $1.av1.mp4
ffmpeg -i $1 -map_metadata -1 -an -c:v libx265 -crf 24 -preset veryslow -pix_fmt yuv420p -movflags +faststart -tag:v hvc1 -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" $1.hevc.mp4
ffmpeg -i $1 -map_metadata -1 -an -c:v libx264 -crf 24 -preset veryslow -profile:v main -pix_fmt yuv420p -movflags +faststart -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" $1.h264.mp4
}
webvideooptimized () {
ffmpeg -i $1 -map_metadata -1 -c:a libfdk_aac -c:v libx264 -crf 24 -preset veryfast -profile:v main -pix_fmt yuv420p -movflags +faststart -vf "scale=900:trunc(ow/a/2)*2" $1.h264.mp4
}
webvideooptimizednoaudio () {
ffmpeg -i $1 -map_metadata -1 -an -c:v libx264 -crf 24 -preset veryslow -profile:v main -pix_fmt yuv420p -movflags +faststart -vf "scale=1920:trunc(ow/a/2)*2" $1.h264.mp4
}
webvideooptimizednoaudiomobile () {
ffmpeg -i $1 -map_metadata -1 -an -c:v libx264 -crf 24 -preset veryslow -profile:v main -pix_fmt yuv420p -movflags +faststart -vf "scale=720:trunc(ow/a/2)*2" $1.h264.mp4
}
webvideoposter () {
ffmpeg -ss 00:00:02 -i $1 -frames:v 1 $1.jpg
}
# create and change to directory/folder
take () {
mkdir -p $1
cd $1
}
# a function to get the current branch for git shortcuts etc
current_branch () {
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
echo ${ref#refs/heads/}
}
# easy vim/terminal switch
fancy-ctrl-z () {
if [[ $#BUFFER -eq 0 ]]; then
BUFFER="fg"
zle accept-line
else
zle push-input
zle clear-screen
fi
}
# creates an archive from given directory
mktar () { tar cvf "${1%%/}.tar" "${1%%/}"; }
mktgz () { tar cvzf "${1%%/}.tgz" "${1%%/}"; }
mkzip () { zip -r "${1%%/}" "${1%%/}"; }
# easy extract
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) rar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xvf $1 ;;
*.tgz) tar xvzf $1 ;;
*.tbz2) tar xvjf $1 ;;
*.tbz) tar xvjf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "don't know how to extract '$1'..." ;;
esac
else
echo "'$1' is not a valid file!"
fi
}
wttr () {
if [[ -n "$1" ]]
then
curl "wttr.in/$1?format=v2"
else
curl "wttr.in/Leipzig?format=v2"
fi
}