-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathffyt
More file actions
executable file
·61 lines (56 loc) · 1.65 KB
/
ffyt
File metadata and controls
executable file
·61 lines (56 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
[ -z "$1" ] && printf "%s\n" "Missing Youtube Link. Use --help for help." && exit 1
player=ffplay
while test $# -gt 0; do
case $1 in
--help|-h|help|h)
printf "%s\n" "${0##*/} - play youtube videos/streams in ffplay/vlc/mpv"
printf "\t%s\n" "--help print help"
printf "\t%s\n" "-v play in vlc"
printf "\t%s\n" "-m play in mpv"
printf "\t%s\n" "-an disable audio"
printf "\t%s\n" "-vn disable video"
exit 0
;;
-v)
player="vlc"
shift
;;
-m)
streamInfo=$(curl -s "$2")
videoTitle=$(printf "%s\n" "$streamInfo" | grep -o '"title":".*\?","len' | sed -e 's/"title"\:"//g' -e 's/","len//g')
player="mpv"
shift
;;
-vn)
player="ffplay"
noDisplay=" -vn"
shift
;;
-an)
player="ffplay"
noAudio=" -an"
shift
;;
*)
[ -z "$1" ] && printf "Missing Link" && exit 1
youtubeLink=$1
shift
[ -z "$1" ] && quality="b" || quality=$1
shift
;;
esac
done
videoStreamLink=$(yt-dlp -g -f "$quality" "$youtubeLink")
case $player in
mpv)
printf "Video Title: %s" "$videoTitle"
mpv --force-media-title="$videoTitle" "$videoStreamLink"
;;
ffplay)
ffplay -probesize 20M -i "$videoStreamLink" -framedrop -infbuf -autoexit $noDisplay $noAudio
;;
vlc)
vlc "$videoStreamLink"
;;
esac