Often we have the need to download videos, such as for learning or collection. Here is how I download videos. I usually use Aria2
to download BT, yt-dlp
to download streaming video.
The machine used in this article is Windows 11, please change it as appropriate for other systems.
1. Aria2
In theory, aria2 is the silver bullet, which can download anything, multi-protocol & cross platform, etc. But I only use it to download BT, because other have better tools.
First of all, I think it’s better to introduce what is BT, Track and P2P.
The full name of BT is BitTorrent, a protocol for P2P, which enables users to distribute and download files over internet. Where P2P means Peer-to-peer file sharing. It’s decentralized and doesn’t even require a network. Track is a special type of server that assists in the communication between peers using BT. If you want to increase the download speed, you should add the appropriate Tracker servers.
1.1 Config
Create this new files (or folder):
1
2
3
4
Download # Path to save the downloaded filearia2.conf # Configaria2.log # Log storage, ignore it if you not neededaria2.session # Blank file
# File name:aria2.conf## aria2 config ### Download path. absolute path or relative path can be used. Default: current startup location# Absolute path: dir=Folder path# Relative path: dir=~/Downloaddir=~/Download
# Disk cache, 0 is to disable cache, default: 16M# Enable disk cache. If SIZE is 0, the disk cache is disabled. Default: 16M# This feature caches the downloaded data in memory, which grows to at most SIZE bytes. SIZE can include K or M. disk-cache=64M
# File pre-allocation method, optional: none, prealloc, trunc, falloc, default: prealloc# Pre-allocation can effectively reduce disk fragmentation, improve disk read and write performance, and extend disk life for mechanical hard disks.# The mechanical hard disk uses ext4 (with extended support), btrfs, xfs or NTFS (only MinGW compiled version) and other file systems are recommended to be set to falloc# SSD does not need to be pre-allocated, it is only recommended to set it to none.file-allocation=none
# File allocation limit size,Unit K or M,default: 5Mno-file-allocation-limit=64M
# Resume from break-pointcontinue=true# Always try to resume the download, if the download cannot be resumed, the download will be terminated, default: truealways-resume=false# URI values that do not support resumable uploads, take effect when always-resume=false.max-resume-failure-tries=0# Get remote server time, default:false# I set this to true to prevent cross-time zone situations.remote-time=true## Session setting ### Path of input download fileinput-file=~/aria2.session
# Path of saved sessionsave-session=~/aria2.session
save-session-interval=1# The time interval to automatically save to the session, default: 60auto-save-interval=20# Force save, default: falseforce-save=false## Download connection settings ### File not found retries, default: 0 (disabled)max-file-not-found=10# Maximum number of attempts, 0 means unlimited, default: 5max-tries=0# Retry wait time (s), default: 0 (disable)retry-wait=10# Default(s)connect-timeout=10# Default(s)timeout=10# The maximum number of simultaneous download tasks, default: 5max-concurrent-downloads=15# Max connection per server, default: 1, max: 16max-connection-per-server=16# The maximum number of connection threads for one task, default: 5split=64# file minimum segment size, 1M-1024M, default 20Mmin-split-size=4M
piece-length=1M
# Allow piece length change, default: falseallow-piece-length-change=true# Minimum download speed limit, Unit K or M ,default:0 (unlimited)lowest-speed-limit=0# Global maximum download speed limit, can be modified at runtime, default: 0 (unlimited)max-overall-download-limit=0# Single task download speed limit, default: 0 (unlimited)max-download-limit=0# Disable IPv6, default: falsedisable-ipv6=true# GZip,default:falsehttp-accept-gzip=true# URIreuse-uri=false# Disable netrcno-netrc=true# Allows overwriting, re-downloading from scratch when the control file (.aria2) doesn't exist. # Default: falseallow-overwrite=false# Auto rename filesauto-file-renaming=true# UTF-8 to Content-Disposition, default:falsecontent-disposition-default-utf8=true# TLS version, option: TLSv1.1、TLSv1.2、TLSv1.3 default: TLSv1.2#min-tls-version=TLSv1.2## BT/PT setting ### BT listen port(TCP), default: 6881-6999# Devices directly connected to internet, such as VPS, must configure firewalls and security group policies to allow this port to enter# Devices in the internal network environment, such as NAS, in addition to firewall settings, you also need to set the external network port forwarding to this port on the routerlisten-port=51413# DHT and UDP tracker listen port(UDP), default:6881-6999dht-listen-port=51413# enable IPv4 DHT, PT download will disable, default:falseenable-dht=true# enable IPv6 DHT, PT download will disable, default:false# Enabling it in an environment without IPv6 support may cause DHT to malfunctionenable-dht6=false# IPv4 DHT path,default:$HOME/.aria2/dht.datdht-file-path=/root/.aria2/dht.dat
# IPv6 DHT path,default:$HOME/.aria2/dht6.datdht-file-path6=/root/.aria2/dht6.dat
# IPv4 DHTdht-entry-point=dht.transmissionbt.com:6881
# IPv6 DHTdht-entry-point6=dht.transmissionbt.com:6881
# local peer discovery, PT download will disable, default:falsebt-enable-lpd=true# Enable peer exchange, PT will auto disableenable-peer-exchange=true# BT maximum connections,0 means unlimted, default: 55bt-max-peers=128# BT download expected speed value (single task) Unit K or M. Default: 50Kbt-request-peer-speed-limit=10M
# Global maximum upload speed limit, default: 0 (default)max-overall-upload-limit=2M
# Single task upload speed limit, default: 0 (unlimited)max-upload-limit=0# Minimum share rate. Stop seeding when the seed sharing rate reaches the value set by this option # 0 means always seeding, default: 1.0# It is strongly recommended that you set this option to >= 1.0seed-ratio=1.5
# min seed time (min)。Setting to 0 will stop seeding after the torrent download is complete.seed-time=0# Check file hash before seeding, default: truebt-hash-check-seed=true# When continuing the previous BT task, there is no need to verify again, default: falsebt-seed-unverified=false# BT tracker server connection timeout (s). Default: 60bt-tracker-connect-timeout=10# BT tracker max timeout (s). default: 60bt-tracker-timeout=10# BT track max time interval. Default: 0 (auto)#bt-tracker-interval=0# BT downloads the beginning or end of the file firstbt-prioritize-piece=head=32M,tail=32M
# Save torrent uploaded via RPC, default: truerpc-save-upload-metadata=true# Automatically start downloading after downloading a torrent.# option:true, false, mem, default: truefollow-torrent=true# only download feed, default: falsepause-metadata=false# save feed(.torrent), default: falsebt-save-metadata=true# Bt load saved metadata(.torrent), default: falsebt-load-saved-metadata=true# remove BT file which be unselected, default: falsebt-remove-unselected-file=true# BT force encrypt, default: false# It can solve the blockade of BT download by some Telecom operators, and can anti-Xunlei(反迅雷)# If you enable it, the next option(bt-require-crypto=true, bt-min-crypto-level=arc4) don't need setting.bt-force-encryption=true# BT require crypto,default:false# bt-require-crypto=true# BT min crypto,option:plain, arc4, default: plain# bt-min-crypto-level=arc4# Bt detach the task of seed only, default: falsebt-detach-seed-only=true## Client agent ### Customize User Agentuser-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36 Edg/93.0.961.47
# BT agent# PT download needs to keep the two parameters of user-agent and peer-agent consistentpeer-id-prefix=-TR2770-
user-agent=Transmission/2.77
peer-agent=Transmission/2.77
## RPC ### If you are not a professional, I do not recommend modifying these# enable JSON-RPC/XML-RPC server, default: falseenable-rpc=true# Accept all remote requests, default: falserpc-allow-origin-all=true# Accept all remote listen, default:falserpc-listen-all=true# RPC port, default:6800rpc-listen-port=6800# RPC keyrpc-secret=P3TERX
# RPC max requestrpc-max-request-size=10M
# RPC server, SSL/TLS encryption, default: false# After enabling encryption, you must use https or wss protocol to connect. It is not recommended to enable it. # It is recommended to use web server reverse proxy, such as Nginx and Caddy, which are more flexible.#rpc-secure=false# 在 RPC certificate(.pem/.crt)#rpc-certificate=/root/.aria2/xxx.pem# 在 RPC private key(.key)#rpc-private-key=/root/.aria2/xxx.key## log setting ### Log file save path, ignore or set to empty to not save, default: not savelog=~/aria2.log
# log level, option: debug, info, notice, warn, error. Default: debug#log-level=warn# console log lever, option debug, info, notice, warn, error, default: noticeconsole-log-level=notice
# Quiet mode, disable log output on the console, default: falsequiet=false#Download summary output interval (s),0 is disable. Default:60summary-interval=0## BitTorrent trackers ### Different trackers are separated by commas(,) # For example bt-tracker=tracker-a,tracker-vbt-tracker=
If you want to make more in-depth changes, I recommend you to read aria2 doc
.
1.2 Tracker
Adding tracker is crucial to improve torrent download speed. Here are some trackers I use, it is very helpful for downloading anime.
If you don’t want to use command line, you can also use third-party GUI, here I list some of the more well-known GUI. But I recommend using the command line, and you will understand the command line after using it a few times.
yt-dp is a free and open source program to download videos from YouTube and other video sites, build written by Python, so we need download Python
and pip. In this way, Python isn’t useless.
You can find all sites which support youtube-dl in here
.
2.1 Download
The following default installed Python version >= 3.10, if not, download Python
please.
Download youtube-dl
1
pip install yt-dlp
Enter the following code to check the installation.
1
yt-dlp --version
Download FFmpeg
1
pip install ffmpeg
Enter the following code to check the installation.
1
ffmpeg
If running FFmpeg fails, please go to the official website to download and add environment variables.
Download FFmpeg
and add bin folder path to Environment variables path. For me, the path is D:\Download\ffmpeg-5.1.2-full_build\bin.
If you don’t set format, yt-dlp will download the best ability by default.
2.2.2 Download video playlist
You may say: OK, It’s easy, I know how to download videos, but what if I want to download all the videos in my collection, do I have to download them one by one?
Of course not, next we will introduce how to download videos that you liked in batches.
In YouTube, Live and video are the same, maybe we want download a private Live, for instance, recoder-man or mark it for future study.
1
yt-dlp --live-from-start [url]
But sometimes yt-dlp may fail to download, so I recommend using ytarchive
.
1
ytarchive -w [url] best
The best means the best ability for the live. ytarchive will download live form start by default.
2.3 GUI
If you really don’t want to use the command line, you can use this yt-dlp gui
, but it lacks a lot of features. For example, through aira2 multi-threaded download.
I don’t recommend using youtube-dl to download YouTube videos, the speed is very slow, always no more than 70 k/s, and not updated for a long time.
Summary
This is how I download videos, if you master these, you can download 99% of videos.
I want to tell you that streaming media is a scam, only downloaded to your hard disk, it really belongs to you, completely under your control, no ads, no censorship…