Ubuntuにyt-dlpをインストール
- GitHub: https://github.com/yt-dlp/yt-dlp
- Installation: https://github.com/yt-dlp/yt-dlp/wiki/Installation
sudo apt updatesudo apt install software-properties-commonsudo add-apt-repository ppa:tomtomtom/yt-dlpsudo apt updatesudo apt install yt-dlp動画をダウンロード
「【魔王魂公式】シャイニングスター」(https://www.youtube.com/watch?v=Qd01-6xVSHk)をダウンロードします。
yt-dlp https://www.youtube.com/watch?v=Qd01-6xVSHk詳細
最高品質の動画ファイル
yt-dlp --format 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' -o '%(id)s_%(title)s.%(ext)s' https://www.youtube.com/watch?v=Qd01-6xVSHk--format 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best'の指定により、以下のような優先順位でダウンロードを試みます。
- 拡張子が
mp4の、最高品質の動画ストリームと、拡張子がm4aの、最高品質の音声ストリームを結合したファイルの出力を試みる - 上記 1 が利用できなければ、拡張子が
mp4の、最高品質の動画ストリームのダウンロードを試みる - 上記 1、2 どちらも見つからなければ、単に最高品質の動画ストリームのダウンロードを試みる
-o '%(id)s_%(title)s.%(ext)s'の指定により、
Qd01-6xVSHk_【魔王魂公式】シャイニングスター.mp4のようなファイル名で出力されます。
最高品質の音声ファイル
yt-dlp --format 'bestaudio[ext=m4a]/bestaudio[ext=mp3]/bestaudio' -o '%(id)s_%(title)s.%(ext)s' https://www.youtube.com/watch?v=Qd01-6xVSHk--format 'bestaudio[ext=m4a]/bestaudio[ext=mp3]/bestaudio'の指定により、以下のような優先順位でダウンロードを試みます。
- 拡張子が
m4aの、最高品質の音声ストリームのダウンロードを試みる - 上記 1 が利用できなければ、拡張子が
mp3の、最高品質の音声ストリームのダウンロードを試みる - 上記 1、2 のどちらも見つからなければ、単に最高品質の音声ストリームのダウンロードを試みる
-o '%(id)s_%(title)s.%(ext)s'の指定により、
Qd01-6xVSHk_【魔王魂公式】シャイニングスター.m4aのようなファイル名で出力されます。