add bestaudio option

This commit is contained in:
Simon Rieger 2025-04-23 08:28:51 +02:00
parent 3bb7af4758
commit 4b8c6d16b0

View file

@ -5,7 +5,7 @@ set -ex
if [ "$1" == "--help" ] if [ "$1" == "--help" ]
then then
echo "bash ./youtube-dl.sh URL FORMAT" echo "bash ./youtube-dl.sh URL FORMAT"
echo "Formate: [opus/m4a/video/hd/fullhd/4k]" echo "Formate: [opus/m4a/video/hd/fullhd/4k/bestaudio]"
echo "Extra: (Zusätzliche Parameter)" echo "Extra: (Zusätzliche Parameter)"
exit 0 exit 0
fi fi
@ -15,7 +15,7 @@ format="$2"
extra="$3" extra="$3"
[[ -z "${url}" ]] && read -p "URL: " url [[ -z "${url}" ]] && read -p "URL: " url
[[ -z "${format}" ]] && read -p "Format [opus/flac/m4a/mp4/video/hd/fullhd/4k]: " format [[ -z "${format}" ]] && read -p "Format [opus/flac/m4a/mp4/video/hd/fullhd/4k/bestaudio]: " format
echo "Wenn man für alle Playlisten Unterordner anlegen will: [-o %(playlist_title)s/%(title)s.%(ext)s/--cookies cookies.txt/--cookies-from-browser firefox] (Praktisch für Downloads ganzer Kanäle" echo "Wenn man für alle Playlisten Unterordner anlegen will: [-o %(playlist_title)s/%(title)s.%(ext)s/--cookies cookies.txt/--cookies-from-browser firefox] (Praktisch für Downloads ganzer Kanäle"
[[ -z "${extra}" ]] && read -p "Sind noch zusätzliche Parameter gewünscht?: " extra [[ -z "${extra}" ]] && read -p "Sind noch zusätzliche Parameter gewünscht?: " extra
@ -57,6 +57,10 @@ then
elif [ "$format" == "4k" ] elif [ "$format" == "4k" ]
then then
format="-S "res:2160" -f "bv+ba/b"" format="-S "res:2160" -f "bv+ba/b""
elif [ "$format" == "bestaudio" ]
then
# Lädt das beste Audioformat OHNE Umwandlung (z.B. Opus/WebM oder AAC/M4A)
format="-f bestaudio"
fi fi
yt-dlp -i -c --socket-timeout 10000 --force-ipv4 --restrict-filenames --embed-thumbnail --embed-metadata --match-filter "!was_live" ${format} ${audio} ${quality} -v ${url} ${extra} yt-dlp -i -c --socket-timeout 10000 --force-ipv4 --restrict-filenames --embed-thumbnail --embed-metadata --match-filter "!was_live" ${format} ${audio} ${quality} -v ${url} ${extra}