Youtube: Difference between revisions
(→mp3) |
|||
Line 364: | Line 364: | ||
= Add YouTube Player Controls To Your Linux Desktop With browser-mpris2 (Chrome Extension) = | = Add YouTube Player Controls To Your Linux Desktop With browser-mpris2 (Chrome Extension) = | ||
https://www.linuxuprising.com/2018/08/add-youtube-player-controls-to-your.html | https://www.linuxuprising.com/2018/08/add-youtube-player-controls-to-your.html | ||
= Browser extension/add-on = | |||
[[Firefox#Youtube|Firefox]] | |||
= Live Stream on youtube = | = Live Stream on youtube = |
Revision as of 09:56, 9 December 2021
Download videos
VLC
See VLC tips.
- Play the video in VLC
- On VLC, check Tools -> Codec information and find a URL there
- Open the URL on a browser. Right click the video and choose to save the video.
The method works for youtube and vimeo videos.
Firefox/Chrome add-on
3 Easy Ways to Download YouTube Videos in Ubuntu and Other Linux Distributions
Video DownloadHelper add-on works fine when I test it on Firefox and Chrome. I need to install an app Video DownloadHelper companion app (the source code is on Github) in order to use the extension. It saves the videos to ~/dwhelper folder.
Online websites
https://www.y2mate.com/en5/youtube
In one instance, I can view an olympics video when I was in a incognito mode but not the regular mode. So ytfzf utility does not work. But y2mate still works!
Youtube-dl
- https://rg3.github.io/youtube-dl/download.html
- It is based on Python2. Ubuntu 20.04 does not include python2.
- What are the Best Youtube Video Downloader for Ubuntu
- The Best YouTube Downloader on Linux: youtube-dl, Minutube, ClipGrab
- 4 Best open source & free YouTube Downloader for Ubuntu Linux
# which youtube-dl # sudo rm /usr/bin/youtube-dl # Method 1. sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl sudo chmod a+rx /usr/local/bin/youtube-dl # Method 2. sudo pip install --upgrade youtube_dl # Log out and log in youtube-dl --version # 2019.01.02 # Download as an mp4 youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4' URL # Download a youtube playlist youtube-dl -f mp4 --yes-playlist URL
- For videos with 1080p resolution, youtube-dl will download 720p by default. To download 1080p, see this post
# show the available resolutions youtube-dl -F XXX # download the desired resolution youtube-dl -f 137+141 XXXX # Note the two numbers 137, 141 is case dependent. They could be 137 & 140. youtube-dl -f 22 XXX # if the format 22 is mp4. If I do not specify the format, the mkv file will be downloaded # But playing mkv file tends to be stuttering with VLC.
This assumes Ubuntu has installed avconv; otherwise video(mp4) and audio(m4a) files will be downloaded separately.To install avconv, install the libav-tools package. Note that libav-tools was replaced by ffmpeg in Ubuntu 18.04.sudo apt-get install ffmpeg
- Play/Download youtube video using mps-youtube
mps-youtube
- 4k videos samples (vlc v2.1.4 cannot play), FLYING OVER NORWAY
- 8K videos Yellowstone National Park in 8K 60P, Peru
stuttering
https://github.com/ytdl-org/youtube-dl/issues/29326#issuecomment-966416070
VERSION=8e069597c658810567ced5f8046dc5d14ab93037 wget https://github.com/ytdl-org/youtube-dl/archive/$VERSION.zip unzip $VERSION.zip cd youtube-dl-$VERSION sudo pip install .
mpsyt: mps-youtube (mp3 + stream + youtube)
By default, mps-youtube is basically a YouTube audio player (and downloader), but you can enable external video playback (via mpv or MPlayer) from its options. Check out
Installation on Linux (works on Odroid with low CPU usage for audio stream from youtube but Odroid gives dirty noise when I played the music).
sudo apt-get install python3-pip sudo pip3 install mps-youtube sudo pip3 install youtube_dl # On Ubuntu/Mint. Do not use mplayer. Use mpv instead. # sudo add-apt-repository ppa:mc3man/mpv-tests # sudo apt-get update && sudo apt-get install mpv mpsyt # launch set player mpv pl https://www.youtube.com/playlist?list=PL6h94tLpXv3LabUa7B0tCz7K0pI5ZzZEi # a playlist h # help Space # pause p # play q # quit mpsyt h search url https://www.youtube.com/watch?v=hgIfZz8STLk # retrieve specific youtube video by url or id
Some highlight
- Search
- Local playlist
- support YouTube Playlists
- Download
- Music Album Matching
If something is wrong with using 'set' command, just run rm -rf ~/.config/mps-youtube/ and restart everything.
By default, it only streams audio. To watch the video, use set show_video true.
Below is what I got from the set command (as you can see the default player is mpv)
Key Value order : relevance user_order : max_res : 2160p player : mpv playerargs : encoder : 0 [None] notifier : checkupdate : True show_mplayer_keys : True fullscreen : False show_status : True columns : ddir : /home/odroid/Downloads/mps overwrite : True show_video : False search_music : True window_pos : window_size : download_command : audio_format : auto api_key : AIzaSyCIM4EzNqi1in22f4Z3Ru3iYvLaY8tc3bo
The screenshot shows mpsyt contains basic playing keyboard shortcuts.
[Update 4-7-2017]: to fix an error Signature extraction failed: Traceback (most recent call last):
sudo apt-get remove -y youtube-dl # Removing youtube-dl (2014.02.17-1) ... sudo pip3 install -U youtube-dl $ youtube-dl --version 2017.04.11
mp3 download
- How to Download Audio Only Using youtube-dl & Download entire YouTube playlist in MP3 format.
- To download mp3 from a Youtube Video (assume libav-tools or ffmpeg has been installed). See more info here.
youtube-dl -x --audio-format mp3 URL youtube-dl --extract-audio --audio-format mp3 URL
- To convert the video to mp3 format, use soundconverter
sudo apt-get install soundconverter
- How To Download A YouTube Playlist And Convert It To MP3 Using youtube-dl (Command Line)
mpv
- http://www.makeuseof.com/tag/terminal-alternatives-linux-desktop-apps/
- http://www.makeuseof.com/tag/5-amazing-linux-video-players-for-watching-movies-and-shows/
- MPV Player: A Minimalist Video Player for Linux
- mpv keyboard shortcuts
- https://wiki.archlinux.org/index.php/Mpv. Choosing the resolution.
- Play youtube audio only
mpv link_to_youtube_vid --no-video
- Open YouTube (And More) Videos From Your Web Browser With mpv [Firefox, Chrome]. Using this is especially useful if your web browser doesn't support hardware-accelerated video playback.
sudo apt install mpv mpv --ytdl-format="bestvideo[height<=?1080]+bestaudio/best" <URL_of_Video> mpv --start=56:00 Some_YT_URL # include time mpv https://youtu.be/JlHsTd7nJW0?t=16 # embed time in the URL
- Record live youtube video. For some reason, mp4 or mkv format does not work.
mpv --stream-record=video.ts https://youtu.be/UCG1aXVO8H8
ytfzf: search & play or download
- https://github.com/pystardust/ytfzf
- It's useful to create an alias in ~/.bashrc e.g. alias youtube="ytfzf"
- ytfzf - Search (With Thumbnails) And Play YouTube Videos From A Terminal
- Download
- Video history
- Choose the media format
- Queue multiple tracks
- Audio only
- Auto-play
- Repeat
- Playlist (not yet)
sudo apt install jq mpv fzf # youtube-dl cd github ~/github$ cd ytfzf/ ~/github/ytfzf$ sudo make install ~/github/ytfzf$ cd # WARNING: The script ueberzug is installed in '/home/brb/.local/bin' which is not on PATH. sudo apt install python3-pip pip3 install ueberzug export PATH=/home/brb/.local/bin:$PATH ytfzf -t scRNA # -t means thumbnails, scRNA is an example of some keywords ytfzf -d scRNA # -d means download $ ytfzf --version ytfzf: 1.0.0 $ ytfzf --help Usage: ytfzf [OPTIONS] <search-query> OPTIONS: -h, --help Show this help text -v, --version -v for ytfzf's version, --version for ytfzf + youtube-dl's version -t, --thumbnails Show thumbnails (requires ueberzug) Doesn't work with -H -D -D, --ext-menu Use external menu(default dmenu) instead of fzf -H, --choose-from-history Choose from history -x, --clear-history Delete history -m, --audio-only <search-query> Audio only (for music) -d, --download <search-query> Download to current directory -f <search-query> Show available formats before proceeding -a, --auto-play <search-query> Auto play the first result, no selector -r --random-play <search-query> Auto play a random result, no selector -n, --video-count= <video-count> To specify number of videos to select with -a or -r -l, --loop <search-query> Loop: prompt selector again after video ends -s <search-query> After the video ends make another search -L, --link-only <search-query> Prints the selected URL only, helpful for scripting --previews= <left/right> the side of the screen to show thumbnails --upload-time= <time-range> Time range can be one of, last-hour, today, this-week, this-month, this-year You can also put the filter as it's own option eg: --today --upload-sort= <sort-filter> The filter to sort the videos can be one of, upload-date, view-count, rating You can also put the filter as it's own option eg: --upload-date --filter-id= <filter> The id of the filter to use for video reults A filter id can be found by going to youtube searching, filtering how you want Then taking the value of the &sp= part of the url Filters may not work especially when the filter sorts for non-videos In addition this overrides any filter provided through options Example: ytfzf --filter-id=EgJAAQ minecraft This will filter by livestream --update clones the latest commit and installs it on Arch ytfzf is available in the AUR Use - instead of <search-query> for stdin Option usage: ytfzf -fDH to show history using external menu and show formats ytfzf -fD --choose-from-history same as above Defaults can be modified through ENV variables Defaults: YTFZF_HIST=1 0 : off history YTFZF_CACHE=~/.cache/ytfzf YTFZF_LOOP=0 1 : loop the selection prompt YTFZF_PREF='' 22: 720p, 18: 360p YTFZF_CUR=1 For status bar bodules YTFZF_EXTMENU=' dmenu -i -l 30' To use rofi YTFZF_EXTMENU=' rofi -dmenu -fuzzy -width 1500' YTFZF_ENABLE_FZF_DEFAULT_OPTS=0 1 : fzf will use FZF_DEFAULT_OPTS For more details refer https://github.com/pystardust/ytfzf
Convert av1 format to h264 format
This is necessary if we add videos to Plex. Convert a video to MP4 (H.264/AAC) with ffmpeg.
Use Handbrake. Converting Video Files to H.264 MP4 Format Using HandBrake on Linux
$ apt-cache show handbrake-cli $ sudo apt-get install handbrake-cli $ HandBrakeCLI --help $ HandBrakeCLI -e x264 -i input.mp4 -o output.mp4
GUI
Learning
- The YouTube Starter Kit: 20 YouTubers Worth Watching
- 5 Nifty YouTube Channels for Learning a New Skill or Strength
Tips 1: SMTube
Tips 2: Pennywise
Open Websites In A Floating, Borderless Window/Picture in picture
Keyboard shortcuts
Keyboard shortcuts for YouTube
24 of the Most Useful YouTube Keyboard Shortcuts
- j: backward 10 seconds
- l: forward 10 seconds
- >: Speed up the video playback rate.
- <: Slow down the video playback rate.
- c: captions
- m: mute
Search for Words in a YouTube Video
How to Search for Words in a YouTube Video
Biology
- PCR from http://k12videos.mit.edu/academic-subject/biology/video
- genetic engineer
- Crash Course Biology from CrashCourse.
- Google: campbell biology pdf
Bypass any restricted youtube video without an extension
http://www.makeuseof.com/tag/bypass-restricted-youtube-video-without-extension/
7 of the Best YouTube Channels for Learning Drums
http://www.makeuseof.com/tag/best-youtube-channels-learn-drums/
Cooking
5 Unique YouTube Cooking Channels Worth Watching
How to find HDR content on YouTube
https://lifehacker.com/how-to-find-hdr-content-on-youtube-1829374364
Add YouTube Player Controls To Your Linux Desktop With browser-mpris2 (Chrome Extension)
https://www.linuxuprising.com/2018/08/add-youtube-player-controls-to-your.html
Browser extension/add-on
Live Stream on youtube
- How to Live Stream on YouTube
- How To Live Stream Computer Screen on YouTube?
- Watch wildlife with a Raspberry Pi nature camera
5 Relaxing YouTube Channels to Help You Chill Out
- https://www.makeuseof.com/tag/relaxing-youtube-channels-chill-out/
- RELAXING MUSIC TO CALM THE MIND AND REDUCE STRESS, RELAXATION AND MEDITATION MUSIC
Natural sounds
- Rainforest Rain Sounds for Sleeping or Studying 🌧️ White Noise Rainstorm 10 Hours
- Sounds of nature, birds singing, Sounds of Forests, for relaxation, sleep, Meditation, Relax 8 hours
- Beautiful Relaxing Music • Peaceful Piano Music & Guitar Music | Sunny Mornings by @Peder B. Helland
Suggested videos overlay
How to remove the suggested videos overlay from a paused, embedded YouTube video
How to Watch Flagged YouTube Videos Without Logging In
How to Watch Flagged YouTube Videos Without Logging In
How to Pause Your YouTube Watch History
H How to Pause Your YouTube Watch History. Library -> History -> stacked dots icon -> History Controls -> toggle switch to Pause watch history.
How Much Money Can You Make on YouTube
How Much Money Can You Make on YouTube?
Stats for Nerds
How to Use YouTube's 'Stats for Nerds'
Picture in picture mode
Youtube Music
Make Any YouTube Link Open in the YouTube Music App
Music
- https://en.wikipedia.org/wiki/Lo-fi_music
- Lofimusic.app
- The 6 Greatest Free Christmas Music and Radio Apps
Crop audio
Trim audio file using start and stop times
ffmpeg -i file.mkv -ss 00:00:20 -to 00:00:40 -c copy file-2.mkv