Play a Youtube video in slow motion with MPV.
┌──(john㉿DESKTOP-PF01IEE)-[~] └─$ mpv --vf="setpts=2.0*PTS" https://www.youtube.com/watch?v=aReMxsXAsK4 |
This is a handy MPV tip. Play a Youtube video with a fancy emboss and sepia effect.
┌──(john㉿DESKTOP-PF01IEE)-[~] └─$ mpv --vf="curves=vintage,convolution=-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2" https://www.youtube.com/watch?v=0PRbchekcUM |
This is very cool, the ability to use ffmpeg filters with MPV. I guess this could be very useful if the user found a suitable filter for a Youtube video.
Get a listing of all video and audio formats for a Youtube video.
┌──(john㉿DESKTOP-PF01IEE)-[~] └─$ yt-dlp -F https://www.youtube.com/watch?v=0PRbchekcUM [youtube] 0PRbchekcUM: Downloading webpage [youtube] 0PRbchekcUM: Downloading android player API JSON [youtube] 0PRbchekcUM: Downloading MPD manifest [youtube] 0PRbchekcUM: Downloading MPD manifest [info] Available formats for 0PRbchekcUM: ID EXT RESOLUTION FPS │ FILESIZE TBR PROTO │ VCODEC VBR ACODEC ABR ASR MORE INFO ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────── sb2 mhtml 48x27 0 │ mhtml │ images storyboard sb1 mhtml 80x45 0 │ mhtml │ images storyboard sb0 mhtml 160x90 0 │ mhtml │ images storyboard 139-dash m4a audio only │ 2.08MiB 50k dash │ audio only mp4a.40.5 50k 22k DASH audio, m4a_dash 139 m4a audio only │ 2.08MiB 49k https │ audio only mp4a.40.5 49k 22k low, m4a_dash 140-dash m4a audio only │ 5.51MiB 131k dash │ audio only mp4a.40.2 131k 44k DASH audio, m4a_dash 140 m4a audio only │ 5.51MiB 129k https │ audio only mp4a.40.2 129k 44k medium, m4a_dash 251-dash webm audio only │ 4.90MiB 125k dash │ audio only opus 125k 48k DASH audio, webm_dash 251 webm audio only │ 4.90MiB 115k https │ audio only opus 115k 48k medium, webm_dash 17 3gp 176x144 7 │ 3.21MiB 75k https │ mp4v.20.3 75k mp4a.40.2 0k 22k 144p 160 mp4 256x144 30 │ ~ 4.71MiB 108k dash │ avc1.4d400b 108k video only DASH video, mp4_dash 278 webm 256x144 30 │ ~ 4.14MiB 95k dash │ vp9 95k video only DASH video, webm_dash 133 mp4 426x240 30 │ ~ 10.55MiB 242k dash │ avc1.4d400c 242k video only DASH video, mp4_dash 242 webm 426x240 30 │ ~ 9.61MiB 220k dash │ vp9 220k video only DASH video, webm_dash 134-dash mp4 640x360 30 │ 20.24MiB 645k dash │ avc1.4d401e 645k video only DASH video, mp4_dash 134 mp4 640x360 30 │ 20.24MiB 476k https │ avc1.4d401e 476k video only 360p, mp4_dash 18 mp4 640x360 30 │ ~ 26.33MiB 604k https │ avc1.42001E 604k mp4a.40.2 0k 44k 360p 243 webm 640x360 30 │ ~ 17.68MiB 406k dash │ vp9 406k video only DASH video, webm_dash 135 mp4 854x480 30 │ ~ 50.33MiB 1155k dash │ avc1.4d400d 1155k video only DASH video, mp4_dash 244 webm 854x480 30 │ ~ 32.80MiB 753k dash │ vp9 753k video only DASH video, webm_dash 22 mp4 1280x720 30 │ ~ 76.52MiB 1756k https │ avc1.64001F 1756k mp4a.40.2 0k 44k 720p 136-dash mp4 1280x720 30 │ 69.23MiB 2256k dash │ avc1.64001f 2256k video only DASH video, mp4_dash 136 mp4 1280x720 30 │ 69.23MiB 1628k https │ avc1.64001f 1628k video only 720p, mp4_dash 247 webm 1280x720 30 │ ~ 65.60MiB 1505k dash │ vp9 1505k video only DASH video, webm_dash 137-dash mp4 1920x1080 30 │ 130.40MiB 4563k dash │ avc1.640028 4563k video only DASH video, mp4_dash 137 mp4 1920x1080 30 │ 130.40MiB 3065k https │ avc1.640028 3065k video only 1080p, mp4_dash 248 webm 1920x1080 30 │ ~115.31MiB 2646k dash │ vp9 2646k video only DASH video, webm_dash |
Once the user has decided upon a format, this is how to get it.
┌──(john㉿DESKTOP-PF01IEE)-[~] └─$ yt-dlp -f 160 https://www.youtube.com/watch?v=0PRbchekcUM [youtube] 0PRbchekcUM: Downloading webpage [youtube] 0PRbchekcUM: Downloading android player API JSON [youtube] 0PRbchekcUM: Downloading MPD manifest [youtube] 0PRbchekcUM: Downloading MPD manifest [info] 0PRbchekcUM: Downloading 1 format(s): 160 [dashsegments] Total fragments: 68 [download] Destination: Home and Away - Selina arrives and has her eyes set on Luke! [0PRbchekcUM].mp4 [download] 86.8% of ~5.44MiB at 70.16KiB/s ETA 00:11 (frag 59/68) |
This makes downloading Youtube videos very easy. The yt-dlp script can also download Twitter and TikTok videos. The Swiss Army Knife of video download utilities.
Last login: Fri Sep 23 09:34:52 2022 from 192.168.1.5 (base) jason@jason-Lenovo-H50-55:~$ yt-dlp https://twitter.com/MichaelGalanin/status/1572740994306805761 |
It also works with Vimeo as well, probably not with videos displayed using blobs. They are a nightmare.
If you get this error when trying to run yt-dlp.
pkg_resources.DistributionNotFound: The 'brotli' distribution was not found and is required by yt-dlp |
Then install the brotli distribution with apt. I installed a package with pip, but it did not fix the issue.
(base) jason@jason-Lenovo-H50-55:~$ sudo apt install python3-brotli |