m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Chrzanowski <m@m-chrzan.xyz>2025-07-17 16:09:01 +0200
committerMarcin Chrzanowski <m@m-chrzan.xyz>2025-07-17 16:09:01 +0200
commit55604140337ae635d20983ae6ea0a1781b61ad8d (patch)
tree2e781b574a7740f62d613fc378887a74b7dfda83
parent32d89bf2e20987da1bf0cc8f36d40343c05697b2 (diff)
Select video only format, use best audioHEADmaster
-rwxr-xr-xyt-dl-choose17
1 files changed, 8 insertions, 9 deletions
diff --git a/yt-dl-choose b/yt-dl-choose
index 7d33588..63a78a7 100755
--- a/yt-dl-choose
+++ b/yt-dl-choose
@@ -22,15 +22,14 @@ if [[ $NO_PLAYLIST ]]; then
URL=`echo "$URL" | sed -e 's/&list=.*&/\&/'`
fi
-formats=`yt-dlp --list-formats $URL \
- | grep -v "audio only" \
- | grep -v "video only" \
- | grep -v mhtml \
- | sed '0,/---------/d' `
-format=`echo "$formats" | dmenu | cut -d' ' -f1`
-
-if [ -z "$format" ]; then
+video_formats=`yt-dlp --list-formats $URL \
+ | grep "video only" \
+ | grep -v mhtml`
+echo "video formats are:\n$video_formats"
+video_format=`echo "$video_formats" | dmenu | cut -d' ' -f1`
+
+if [ -z "$video_format" ]; then
exit 0;
fi
-mpv --ytdl-format=$format $1
+mpv --ytdl-format="$video_format+bestaudio" $URL