Watch youtube video in terminal

So, when use my old computer to watch some fun video in youtube, its so laggy and sometimes freeze, i think “What the heck? why its so lag even though i just watch video about dog and cat length 10 minutes?”, when think about solution, i have idea “What happen if i watch this video on terminal?” and that’s time i realize how cool this idea can be, i trying to find many way to run it in terminal and successfully with mpv and yt-dlp:
First things i want to say is i use Linux, so with other OS, you need to find a way prefer with that OS
1: Install mpv and and yt-dlp:
sudo apt-get install mpv
Use pip for install yt-dlp
sudo pip install --upgrade yt-dlp
or if you isn’t like yt-dlp, you can also use youtube-dl
sudo pip install --upgrade youtube_dl
2: Config mpv:
Create a file config for mpv
nano ~/.config/mpv/mpv.conf
write this line on to config file:
script-opts=ytdl_hook-ytdl_path=yt-dlp
or use youtube-dl
script-opts=ytdl_hook-ytdl_path=youtube-dl
Save and close this file

Now you will able to watch youtube video use this command:
mpv "path to your youtube video"
Example:
mpv "https://www.youtube.com/watch?v=Z11_ceId5HE"(this guy really make me laugh so hard i can)


You can also play playlist use same command:
mpv "path to your playlist", like mpv "https://www.youtube.com/playlist?list=PLC3y8-rFHvwjifDNQYYWI6i06D7PjF0Ua"
Or you can play video in particular index in this playlist by:
mpv --playlist-start=index_of_this_playlist "path to your playlist"(its use zero indexed like array, 0 for first video and 1 for second)

This way use for streaming video, not need to download video you want to play or anything other, for more information, you can go to official website of mpv or some tutorial.
If you have trouble with youtube-dl, you can use yt-dlp as alternative
If you worry about its cache, you can check it by:
du -sh ~/.cache/mpv (remove this file when you want clean up cache)

2 Likes

Không có hình demo, chê :joy:

:)). Không hiểu gì hết =)). Chê mạnh.

Technically, he just uses a program calls mpv on Ubuntu to play Youtube instead of using web browser. The word “in terminal” just add more confusing :slight_smile:

2 Likes

Chưa thử, nhưng nhìn list mấy câu lệnh thì hiểu đại khái là Mở Terminal lên, gõ câu lệnh để gọi 1 program khác lên chiếu video.

Túm lại, +1 điểm cho sự sưu tầm, -2 điểm cho sự phức tạp không đáng có, -7 điểm cho tội fake news

3 Likes

+10 xài mpv :flushed: vlc là cái cone rác :hocho:

Your English is very Vietnamese… It’s hard to understand for someone who doesn’t know Vietnamese grammar. :grinning:
However, what you wrote needs some corrections:

  1. If there is no “pip” under Linux, you have to install it
    sudo apt install python3-pip
    before continuing with further steps.
  2. To configure the MPV file, you need to check whether a MPV directory exists. Create it if it doesn’t exist.
    mkdir $HOME/.config/mpv
    sudo nano $HOME/.config/mpv/mpv.conf

It confuses people because MPV runs ON a terminal, not IN a terminal (like a thing ON the table, not IN the table).

1 Like

Hi everyone,
@otaku_professor wrote something in English, although it is quite incomprehensible, but his contribution turned out to be very valuable for people who like to watch YouTube WITHOUT ads, which are usually very annoying. Once you have successfully installed “mpv” (e.g. Ubuntu or Linux Mint), you can fully enjoy “Youtube” without being interrupted by stupid advertisements. And that’s the most important point that @otaku_professor forgot to mention. As members of the same forum, it’s not nice to throw stones at him…

1 Like

My all English knowledge come from anime, manga, light novel, 2D community, i just learn “How to understand they are saying”, not “How to communicate with them”, listen, speak, and write english just is sub things i gets from it, i’m really not to trying to learn grammar, so, if my english make you hard to understand, im fell sorry about that, i’m just used to with english more than vietnamese, thus i don’t really liking to type vietnamese

1 Like

After walkaround several days, i found if i use Incognito tab, its will make my shitty youtube more smoother, anyway, i’m still like to use mpv to listen music (with option --no-video and --force-window and --cache-secs=times) and its really like to was born for it, not lagging, not consume much my cpu and streaming, yeah, that’s so cool, i will forget music.youtube.com from now.

tải smplayer về mà xài, nó xài mpv backend, có option yt-dl luôn. Bấm Ctrl+U rồi paste youtube url là được. Xem thẳng ko cần qua web browser ko có quảng cáo nên lẹ lắm :triumph:

4 Likes

I will try it, thank for sharing bro :+1:

The problem is that the “language” is not very polite. I’m not a moralist, but sometimes the way you express yourself could offend people. Think about it.

Tây nửa vời. Học tiếng Anh cho tử tế đi :rofl:. Viết như vậy chỉ làm bẽ mặt bạn thôi. Tây nó không hiểu mà người Việt đọc cũng nhăn mặt nốt :joy:

Mới nhìn vào nick cứ tưởng đâu cụ Tokuda bữa nay chán việc nặng nhọc và ướt át chuyển qua làm cốt-đơ rồi chứ.

Túm lại là tiêu đề “Watch youtube video in terminal” là fake news, dân lập trình bị dính vào “câu view” bởi cái tiêu đề. Sau khi đọc xong bài, cảm giác muốn đá đít chủ topic vì xem ra gã này còn ABC, chẳng hiểu gì về text-based và graphic trên máy tính cả.

Có phải mọi người (ít nhất là @ TaoLaoBidaoBanBanhBa) mong đợi:

mong-doi

Trong khi đó, kết quả lại:

bach-tuyet

1 Like

Mấy ông IT thì tiếng Anh hay tiếng Việt gì cũng sai ngữ pháp bét nhè (đa số). Phát âm (tiếng Việt) tùy vùng miền từ L <-> N, từ D <-> V, từ TR <-> CH… là chuyện thường xuyên, nên việc phát âm TA sai cũng ko có gì lạ :))
Theo tôi thì nên khuyến khích thay vì chỉ trích ! Nói như vậy không có nghĩa là cứ tiếp tục giử cái sai của mình, vấn đề là phải biết mình sai để lần sau nó ít sai hơn.

Ngay cả phong cách viết cũng vậy, nếu viết kiểu tiếng Việt đã không “polite” thì qua tiếng Anh cũng vậy thôi :slight_smile:

4 Likes

It depends on your point of view. For a linguist, regardless of the dialect pronunciation, the spelling should (or must?) be correct.
I see that many Vietnamese people are very inattentive and careless when writing in Vietnamese. For example: tui or tôi and dê or vê:
tui dê nhà or tôi vê nhà

1 Like
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?