Skip to content

Instantly share code, notes, and snippets.

@libraplanet
Last active July 27, 2025 13:25
Show Gist options
  • Select an option

  • Save libraplanet/3aff435e6584d16b1e29f7672769c7c2 to your computer and use it in GitHub Desktop.

Select an option

Save libraplanet/3aff435e6584d16b1e29f7672769c7c2 to your computer and use it in GitHub Desktop.
yt-dlp usage sample.
■ 概要
yt-dlpの利用方法サンプル
■ インストールとファイル構成
・ yt-dlp
https://github.com/yt-dlp/yt-dlp/
・ffmpeg (yt-dlp専用build)
https://github.com/yt-dlp/FFmpeg-Builds/
[./]
├ yt-dlp.conf // カレントに設定ファイルを置くことで、いくつかのオプションをデフォルトで設定できる。
├ yt-dlp.exe
├ ffmpeg.exe // Multiplex (音声+映像の多重化) に必要。
├ ffplay.exe
└ ffprobe.exe
■ コマンド
# ダウンロード
yt-dlp https://****
# ダウンロード可能なフォーマットを確認
yt-dlp -F https://****
yt-dlp --list-formats https://****
# フォーマットを指定してダウンロード
yt-dlp -f 135 https://****
# サムネ付きでm4aをダウンロード
yt-dlp.exe -f 'bestaudio[ext=m4a]' --write-thumbnail https://****
# Lines starting with # are comments
--verbose
# cache directory
--cache-dir ./.cache/youtube-dl
# 640x360
# -f '134+bestaudio[ext=mp4]'
# --merge-output-format mp4
# audio only (mp4)
# -f 'bestaudio[ext=mp4]'
# -x
# Always extract audio
#-x
# merge best formats (mp4)
# -f 'bestvideo[ext=mp4]+bestaudio[ext=mp4]/best[ext=mp4]/best'
# --merge-output-format mp4
# best formats (mp4)
# -f 'best[ext=mp4]'
# Do not copy the mtime
--no-mtime
# Save all videos under Movies directory in your home directory
-o ./downloads/%(title)s.f%(format_id)s.%(ext)s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment