add new default formats
This commit is contained in:
parent
d74ad85037
commit
f0af44bb27
1 changed files with 15 additions and 7 deletions
22
youtube.sh
22
youtube.sh
|
@ -13,16 +13,17 @@ url="$1"
|
||||||
format="$2"
|
format="$2"
|
||||||
|
|
||||||
[[ -z "${url}" ]] && read -p "URL: " url
|
[[ -z "${url}" ]] && read -p "URL: " url
|
||||||
[[ -z "${format}" ]] && read -p "Format [opus/flac/m4a/video/hd/fullhd/4k]: " format
|
[[ -z "${format}" ]] && read -p "Format [opus/flac/m4a/mp4/video/hd/fullhd/4k]: " format
|
||||||
|
|
||||||
if [ "$format" == "opus" ]
|
if [ "$format" == "opus" ]
|
||||||
then
|
then
|
||||||
format="--audio-format opus"
|
# https://github.com/yt-dlp/yt-dlp/issues/979
|
||||||
|
format="--audio-format opus -f "ba" --format-sort "abr,codec""
|
||||||
audio="-x"
|
audio="-x"
|
||||||
quality="--audio-quality 0"
|
quality="--audio-quality 0"
|
||||||
elif [ "$format" == "flac" ]
|
elif [ "$format" == "flac" ]
|
||||||
then
|
then
|
||||||
format="--audio-format flac"
|
format="--audio-format flac -f "ba" --format-sort "abr,codec""
|
||||||
audio="-x"
|
audio="-x"
|
||||||
quality="--audio-quality 0"
|
quality="--audio-quality 0"
|
||||||
elif [ "$format" == "m4a" ]
|
elif [ "$format" == "m4a" ]
|
||||||
|
@ -35,16 +36,23 @@ then
|
||||||
audio="-x"
|
audio="-x"
|
||||||
elif [ "$format" == "video" ]
|
elif [ "$format" == "video" ]
|
||||||
then
|
then
|
||||||
format="-f 43"
|
# Download and merge the best video-only format and the best audio-only format,
|
||||||
|
# or download the best combined format if video-only format is not available
|
||||||
|
|
||||||
|
# Download the best video available with the largest resolution but no better than 480p,
|
||||||
|
# or the best video with the smallest resolution if there is no video under 480p
|
||||||
|
# Resolution is determined by using the smallest dimension.
|
||||||
|
# So this works correctly for vertical videos as well
|
||||||
|
format="-S "res:480" -f "bv+ba/b""
|
||||||
elif [ "$format" == "hd" ]
|
elif [ "$format" == "hd" ]
|
||||||
then
|
then
|
||||||
format="-f 247+251"
|
format="-S "res:720" -f "bv+ba/b""
|
||||||
elif [ "$format" == "fullhd" ]
|
elif [ "$format" == "fullhd" ]
|
||||||
then
|
then
|
||||||
format="-f 303+251"
|
format="-S "res:1080" -f "bv+ba/b""
|
||||||
elif [ "$format" == "4k" ]
|
elif [ "$format" == "4k" ]
|
||||||
then
|
then
|
||||||
format="-f 315+251"
|
format="-S "res:2160" -f "bv+ba/b""
|
||||||
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
|
yt-dlp -i -c --socket-timeout 10000 --force-ipv4 --restrict-filenames --embed-thumbnail --embed-metadata --match-filter "!was_live" $format $audio $quality -v $url
|
||||||
|
|
Loading…
Reference in a new issue