# Watch youtube video in terminal

**URL:** https://daynhauhoc.com/t/watch-youtube-video-in-terminal/133652
**Category:** writes
**Created:** [January 31, 2024, 2:23pm UTC](https://daynhauhoc.com/t/watch-youtube-video-in-terminal/133652 "2024-01-31T14:23:00Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![otaku\_professor](https://daynhauhoc.com/user_avatar/daynhauhoc.com/otaku_professor/32/63143_2.png) [@otaku\_professor](https://daynhauhoc.com/u/otaku_professor)
#### Post date: [January 31, 2024, 2:23pm UTC](https://daynhauhoc.com/t/watch-youtube-video-in-terminal/133652/1 "2024-01-31T14:23:00Z")

</div>

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)

 ![Screenshot from 2024-01-31 22-34-06](https://daynhauhoc.s3.dualstack.ap-southeast-1.amazonaws.com/original/3X/a/7/a7fa5efa585f8fa0c4ba39081d76bbdb5ac0c58e.jpeg)  
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](https://mpv.io/) 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)

---

<div class="post-metadata">

### Author: ![tonghoangvu](https://daynhauhoc.com/user_avatar/daynhauhoc.com/tonghoangvu/32/46299_2.png) [@tonghoangvu](https://daynhauhoc.com/u/tonghoangvu)
#### Post date: [January 31, 2024, 2:49pm UTC](https://daynhauhoc.com/t/watch-youtube-video-in-terminal/133652/2 "2024-01-31T14:49:40Z")

</div>

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

---

<div class="post-metadata">

### Author: ![anonymous278](https://daynhauhoc.com/letter_avatar_proxy/v4/letter/a/76d3ee/32.png) [@anonymous278](https://daynhauhoc.com/u/anonymous278)
#### Post date: [January 31, 2024, 3:30pm UTC](https://daynhauhoc.com/t/watch-youtube-video-in-terminal/133652/3 "2024-01-31T15:30:23Z")

</div>

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

---

<div class="post-metadata">

### Author: ![csdl](https://daynhauhoc.com/user_avatar/daynhauhoc.com/csdl/32/31003_2.png) [@csdl](https://daynhauhoc.com/u/csdl)
#### Post date: [February 1, 2024, 1:45pm UTC](https://daynhauhoc.com/t/watch-youtube-video-in-terminal/133652/4 "2024-02-01T13:45:04Z")

</div>

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 🙂

---

<div class="post-metadata">

### Author: ![TaoLaoBidaoBanBanhBa](https://daynhauhoc.com/user_avatar/daynhauhoc.com/taolaobidaobanbanhba/32/60062_2.png) [@TaoLaoBidaoBanBanhBa](https://daynhauhoc.com/u/TaoLaoBidaoBanBanhBa)
#### Post date: [February 2, 2024, 3:11am UTC](https://daynhauhoc.com/t/watch-youtube-video-in-terminal/133652/5 "2024-02-02T03:11:44Z")

</div>

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

---

<div class="post-metadata">

### Author: ![tntxtnt](https://daynhauhoc.com/user_avatar/daynhauhoc.com/tntxtnt/32/35315_2.png) [@tntxtnt](https://daynhauhoc.com/u/tntxtnt)
#### Post date: [February 2, 2024, 5:04am UTC](https://daynhauhoc.com/t/watch-youtube-video-in-terminal/133652/6 "2024-02-02T05:04:03Z")

</div>

+10 xài mpv 😳 vlc là cái cone rác 🔪

---

<div class="post-metadata">

### Author: ![Joe](https://daynhauhoc.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@Joe](https://daynhauhoc.com/u/Joe)
#### Post date: [February 2, 2024, 9:53am UTC](https://daynhauhoc.com/t/watch-youtube-video-in-terminal/133652/7 "2024-02-02T09:53:42Z")

</div>

Your English is very Vietnamese… It’s hard to understand for someone who doesn’t know Vietnamese grammar. 😀  
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).

---

<div class="post-metadata">

### Author: ![Joe](https://daynhauhoc.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@Joe](https://daynhauhoc.com/u/Joe)
#### Post date: [February 2, 2024, 2:03pm UTC](https://daynhauhoc.com/t/watch-youtube-video-in-terminal/133652/8 "2024-02-02T14:03:01Z")

</div>

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…

---

<div class="post-metadata">

### Author: ![otaku\_professor](https://daynhauhoc.com/user_avatar/daynhauhoc.com/otaku_professor/32/63143_2.png) [@otaku\_professor](https://daynhauhoc.com/u/otaku_professor)
#### Post date: [February 2, 2024, 2:07pm UTC](https://daynhauhoc.com/t/watch-youtube-video-in-terminal/133652/9 "2024-02-02T14:07:18Z")

</div>

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

---

<div class="post-metadata">

### Author: ![otaku\_professor](https://daynhauhoc.com/user_avatar/daynhauhoc.com/otaku_professor/32/63143_2.png) [@otaku\_professor](https://daynhauhoc.com/u/otaku_professor)
#### Post date: [February 2, 2024, 2:12pm UTC](https://daynhauhoc.com/t/watch-youtube-video-in-terminal/133652/10 "2024-02-02T14:12:32Z")

</div>

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](http://music.youtube.com) from now.

---

<div class="post-metadata">

### Author: ![tntxtnt](https://daynhauhoc.com/user_avatar/daynhauhoc.com/tntxtnt/32/35315_2.png) [@tntxtnt](https://daynhauhoc.com/u/tntxtnt)
#### Post date: [February 2, 2024, 2:19pm UTC](https://daynhauhoc.com/t/watch-youtube-video-in-terminal/133652/11 "2024-02-02T14:19:27Z")

</div>

tải [smplayer](https://www.smplayer.info/) 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 😤

---

<div class="post-metadata">

### Author: ![otaku\_professor](https://daynhauhoc.com/user_avatar/daynhauhoc.com/otaku_professor/32/63143_2.png) [@otaku\_professor](https://daynhauhoc.com/u/otaku_professor)
#### Post date: [February 2, 2024, 2:24pm UTC](https://daynhauhoc.com/t/watch-youtube-video-in-terminal/133652/12 "2024-02-02T14:24:08Z")

</div>

I will try it, thank for sharing bro 👍

---

<div class="post-metadata">

### Author: ![Joe](https://daynhauhoc.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@Joe](https://daynhauhoc.com/u/Joe)
#### Post date: [February 2, 2024, 2:44pm UTC](https://daynhauhoc.com/t/watch-youtube-video-in-terminal/133652/13 "2024-02-02T14:44:11Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![anonymous278](https://daynhauhoc.com/letter_avatar_proxy/v4/letter/a/76d3ee/32.png) [@anonymous278](https://daynhauhoc.com/u/anonymous278)
#### Post date: [February 2, 2024, 7:03pm UTC](https://daynhauhoc.com/t/watch-youtube-video-in-terminal/133652/14 "2024-02-02T19:03:50Z")

</div>

Tây nửa vời. Học tiếng Anh cho tử tế đi 🤣. 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 😂

---

<div class="post-metadata">

### Author: ![superthin](https://daynhauhoc.com/user_avatar/daynhauhoc.com/superthin/32/9673_2.png) [@superthin](https://daynhauhoc.com/u/superthin)
#### Post date: [February 3, 2024, 12:37am UTC](https://daynhauhoc.com/t/watch-youtube-video-in-terminal/133652/15 "2024-02-03T00:37:25Z")

</div>

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](https://daynhauhoc.com/u/TaoLaoBidaoBanBanhBa)) mong đợi:

![mong-doi](https://daynhauhoc.s3.dualstack.ap-southeast-1.amazonaws.com/original/3X/1/8/1880334328bf95a79167e7227f2f61e2fbf95318.png)

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

![bach-tuyet](https://daynhauhoc.s3.dualstack.ap-southeast-1.amazonaws.com/original/3X/3/9/391f0d8de224515b742a60769abbe88312232838.png)

---

<div class="post-metadata">

### Author: ![csdl](https://daynhauhoc.com/user_avatar/daynhauhoc.com/csdl/32/31003_2.png) [@csdl](https://daynhauhoc.com/u/csdl)
#### Post date: [February 3, 2024, 11:31am UTC](https://daynhauhoc.com/t/watch-youtube-video-in-terminal/133652/16 "2024-02-03T11:31:42Z")

</div>

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 🙂

---

<div class="post-metadata">

### Author: ![Joe](https://daynhauhoc.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@Joe](https://daynhauhoc.com/u/Joe)
#### Post date: [February 3, 2024, 12:31pm UTC](https://daynhauhoc.com/t/watch-youtube-video-in-terminal/133652/17 "2024-02-03T12:31:48Z")

</div>

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à`
