41
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

posted at

updated at

コマンドラインからyoutubeを再生する

使うもの

  • youtube-dl
  • mplayer (or mpv)

install

https://github.com/rg3/youtube-dl/blob/master/README.md#installation

Mac

Homebrew
$ brew install youtube-dl mplayer

Linux

apt*/yum
$ sudo apt-get install youtube-dl mplayer

Windows

youtube-dl.exe
https://yt-dl.org/latest/youtube-dl.exe

https://github.com/rg3/youtube-dl/releases

mplayer-win
http://oss.netfarm.it/mplayer-win32.php

update

native
$ sudo youtube-dl -U # -U/--update
# or
youtube-dl -U

python-pip

install
$ sudo apt-get install python-pip # if needed
$ sudo pip install youtube-dl
update
$ sudo pip install -U youtube-dl # -U/--update

コマンド

通常再生

$ youtube-dl 'https://www.youtube.com/watch?v=hoge' -o - | mplayer -

音声のみ

$ youtube-dl 'https://www.youtube.com/watch?v=hoge' -o - | mplayer - -novideo

or

fetch-sound-only
$ youtube-dl 'https://www.youtube.com/watch?v=hoge' -f bestaudio -o - | mplayer -


mpv

next mplayer2

install

play

play
$ mpv 'https://www.youtube.com/watch?v=hoge'
sound-only
$ mpv 'https://www.youtube.com/watch?v=hoge' --no-video # or -no-video

http://mpv.io/manual/master/

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Sign upLogin
41
Help us understand the problem. What are the problem?