convert-psp/convert-psp

34 lines
687 B
Bash

#!/bin/bash
f_convert-psp(){
ffmpeg -y -i "$1" -flags +bitexact -vcodec libx264 -profile:v baseline -level 3.0 -s 480x272 -r 29.97 -b:v 384k -acodec aac -b:a 96k -ar 48000 -f psp -strict -2 "PSP/$1"
}
help(){
printf "Usage: $0 \"directory\" \"URL\"\n"
exit 1
}
[ -z "$1" ] && help
[ "$1" == "-h" ] && help
[ "$1" == "--help" ] && help
saveifs=$IFS
IFS=$'\n'
directory=$1
[ ! -d "$directory" ] && mkdir -p "$directory"
[ ! -d "PSP/$directory" ] && mkdir -p "PSP/$directory"
youtube-dl "$2" -f 18 -o "$directory/%(title)s.%(ext)s"
files=($(ls "$directory"))
for file in ${files[*]}
do
[ ! -f "PSP/$directory/$file" ] && \
f_convert-psp "$directory"/"$file"
done
IFS=$saveifs