「Yt-dlp」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(→‎トリミング: add === URL from clipboard ===)
107行目: 107行目:
   
 
[[wikipedia:Dynamic_Adaptive_Streaming_over_HTTP|DASH]] 動画の一部を {{ic|youtube-dl -g -f ''format'' ''URL''}} の出力を使って ''ffmpeg'' の {{ic|-ss}}, {{ic|-t}}, {{ic|-c copy}} [http://ffmpeg.org/ffmpeg.html#Main-options オプション] で入力することでダウンロードできます。
 
[[wikipedia:Dynamic_Adaptive_Streaming_over_HTTP|DASH]] 動画の一部を {{ic|youtube-dl -g -f ''format'' ''URL''}} の出力を使って ''ffmpeg'' の {{ic|-ss}}, {{ic|-t}}, {{ic|-c copy}} [http://ffmpeg.org/ffmpeg.html#Main-options オプション] で入力することでダウンロードできます。
  +
  +
=== URL from clipboard ===
  +
  +
A shell [[alias]], a [[desktop launcher]] or a keyboard shortcut can be set to download a video (or audio) of a selected (or copied) URL by outputting it from the [[Wikipedia:X_Window_selection|X selection]]. See [[Clipboard#Tools]].
   
 
== 参照 ==
 
== 参照 ==

2021年10月13日 (水) 11:57時点における版

関連記事

youtube-dl は1000以上のウェブサイトから動画・音声を簡単にダウンロードできるコマンドラインプログラムです。詳しくは サポートされているサイト一覧 を参照。

インストール

youtube-dl パッケージをインストールしてください。もしくは youtube-dl-gitAUR で開発版をインストールできます。一部のサイトでは多重化に使用されるため、FFmpeg もインストールすることをお勧めします。オプションの依存関係も参照してください。

youtube-dl の様々なフォークも存在し、追加機能が含まれている場合があります。特に youtube-dlpAUR はより多くのサイトのサポート、コメントのダウンロード、フォーマット設定の改善およびその他の変更を加えています。youtube-dlcAUR は前述の新機能の多くを備えた別のフォークです。また tartubeAURyt-dlg (youtube-dl-gui-gitAUR) など、youtube-dl やその他のフォークに対する様々なグラフィカルフロントエンドがあります。

Configuration

The system-wide configuration file is /etc/youtube-dl.conf and the user-specific configuration file is ~/.config/youtube-dl/config. The syntax is simply one command-line option per line. Example configuration:

--ignore-errors
# --no-playlist

# Save in ~/Videos
-o ~/Videos/%(title)s.%(ext)s

# Prefer 1080p or lower resolutions
-f bestvideo[ext=mp4][width<2000][height<=1200]+bestaudio[ext=m4a]/bestvideo[ext=webm][width<2000][height<=1200]+bestaudio[ext=webm]/bestvideo[width<2000][height<=1200]+bestaudio/best[width<2000][height<=1200]/best

See [1] for more information.

使用方法

youtube-dl(1)man ページを見てください。例:

$ youtube-dl [OPTIONS] URL

フォーマットの選択

複数のフォーマットが選択できる場合、youtube-dl はデフォルトで一番良いフォーマットをダウンロードします。ダウンロードするフォーマットを指定したい場合、まず利用可能なフォーマットを確認してください:

$ youtube-dl -F URL

ダウンロードしたいフォーマットのコードを覚えたら、以下のコマンドを実行:

$ youtube-dl -f format URL

上記の方法で音声のみ・動画のみフォーマットでダウンロードすることもできます。FFmpeg をインストールしていれば、動画のみ・音声のみフォーマットをダウンロードしてから、ひとつのファイルにまとめることができます:

$ youtube-dl -f video_format+audio_format URL

音声の抽出

音声のみをダウンロードしたい場合は -x を使います (FFmpeg が必要):

$ youtube-dl -x -f bestaudio URL

Subtitles

To see which languages are available:

$ youtube-dl --list-subs URL

To download a video with selected subtitles (comma separated):

$ youtube-dl --write-sub --sub-lang LANG URL

For auto-generated subtitles:

$ youtube-dl --write-auto-sub --sub-lang LANG URL

Add --skip-download to get only subtitles.

設定

システム全体の設定ファイルは /etc/youtube-dl.conf で、ユーザー個別の設定ファイルは ~/.config/youtube-dl/config です。

構文はシンプルで1行ずつコマンドラインオプションを指定します。使用できるオプションについては youtube-dl(1)man ページを参照してください。設定例:

~/.config/youtube-dl/config
# Save in ~/Videos
-o ~/Videos/%(title)s.%(ext)s

# Prefer 1080p or lower resolutions
-f (bestvideo[height<=1080]/bestvideo)+bestaudio/best[height<=1080]/best

ヒントとテクニック

ダウンロード速度の改善

一部のウェブサイトはダウンロード速度を制限しています。マルチ接続ダウンロードをサポートしている外部ダウンローダ、Aria2 を使うことでダウンロード速度を向上させることができます。例:

$ youtube-dl --external-downloader aria2c --external-downloader-args '-c -x 5 -k 2M' URL

Playlist

Using youtube-dl for a playlist usually boils down to the following options:

$ youtube-dl --ignore-errors --continue --no-overwrites --download-archive progress.txt usual options URL

This set of options allow for the download to effectively continue even after interruption. If you are archiving, add the usual --write-xxx and --embed-xxx options you may have.

トリミング

DASH 動画の一部を youtube-dl -g -f format URL の出力を使って ffmpeg-ss, -t, -c copy オプション で入力することでダウンロードできます。

URL from clipboard

A shell alias, a desktop launcher or a keyboard shortcut can be set to download a video (or audio) of a selected (or copied) URL by outputting it from the X selection. See Clipboard#Tools.

参照