Dateien hochladen nach „“

This commit is contained in:
esche 2023-07-05 13:48:37 +02:00
parent 835c0b8cc6
commit dfca7e7c40

View file

@ -14,13 +14,17 @@ function finish {
} }
trap finish EXIT trap finish EXIT
extension='' print_help() {
printf "Help: not implemented yet"
}
while getopts 'e:' flag; do while getopts 'e:' flag; do
case "${flag}" in case "${flag}" in
e) extension+=("$OPTARG");; e) extension+=("$OPTARG");;
*) exit 1 ;; h) print_help
esac exit 0;;
*) exit 1 ;;
esac
done done
# write array into string # write array into string
@ -41,10 +45,16 @@ for file in **/*.@($extension); do
print "ffmpeg -i \""file"\" -map 0:a -c:a libopus" print "ffmpeg -i \""file"\" -map 0:a -c:a libopus"
} }
{ # https://wiki.xiph.org/Opus_Recommended_Settings { # https://wiki.xiph.org/Opus_Recommended_Settings
if($1==1) print $2>=64000 ? "-b:a:"NR-1" 64k" : "-b:a:"NR-1" "$2 if($1==1) {
else if($1==2) print $2>=128000 ? "-b:a:"NR-1" 128k" : "-b:a:"NR-1" "$2 if($2>=64000) print "-b:a:"NR-1" 64k"
else if($1<=6) print $2>=256000 ? "-b:a:"NR-1" 256k" : "-b:a:"NR-1" "$2 }
else print $2>=450000 ? "-b:a:"NR-1" 450k" : "-b:a:"NR-1" "$2 else if($1==2) {
if($2>=128000) print "-b:a:"NR-1" 128k"
}
else if($1<=6) {
if ($2>=256000) print "-b:a:"NR-1" 256k"
}
else if ($2>=450000) print "-b:a:"NR-1" 450k"
} }
END{ END{
print "\""file_output"\" -v info -hide_banner" print "\""file_output"\" -v info -hide_banner"
@ -53,7 +63,7 @@ for file in **/*.@($extension); do
is_video=$(ffprobe -i Hair.m4v -v fatal -select_streams V -show_entries stream=codec_type) is_video=$(ffprobe -i Hair.m4v -v fatal -select_streams V -show_entries stream=codec_type)
if [[ -n "$is_video" ]]; then if [[ -n "$is_video" ]]; then
echo "$file is a video file and will not be converted" echo "$file contains a video stream and will not be converted"
#an Example for converting the audiostreams in a container while copying subtitles and videostreams. #an Example for converting the audiostreams in a container while copying subtitles and videostreams.
#ffmpeg -i Hair.m4v -map 0:a -map 0:s -map 0:v -c:a libopus -c:v copy -c:s copy Hair.mkv -hide_banner -v info #ffmpeg -i Hair.m4v -map 0:a -map 0:s -map 0:v -c:a libopus -c:v copy -c:s copy Hair.mkv -hide_banner -v info