7 个版本
0.3.2 | 2024 年 6 月 23 日 |
---|---|
0.3.1 | 2024 年 6 月 22 日 |
0.3.0 | 2023 年 8 月 18 日 |
0.2.5 | 2023 年 1 月 9 日 |
0.1.0 | 2022 年 6 月 22 日 |
#30 in 命令行工具
每月 323 次下载
275KB
5.5K SLoC
vsd
video stream downloader 是一个命令行程序,用于下载从网站、HLS 和 DASH 播单通过 HTTP 服务的视频流。
功能
- 捕获网络请求,从网站收集 .m3u8、.mpd 和字幕,并本地保存。
- 使用 ffmpeg 将流混合到单个视频容器中。
- 完整的下载过程具有与普通文件下载类似的进度条,并实时估计文件大小。
- 支持
AES-128
和CENC
播单解密。 - 支持 HLS 和 DASH
- 支持多线程下载。
- GUI(可能在未来)
- 支持 SAMPLE-AES 播单解密。
- 直播流下载(正在进行中)
安装
依赖项
访问 发布 以获取预构建的二进制文件。下载并解压缩存档,然后将 vsd 二进制文件复制到任何路径。现在将此路径添加到您的 PATH
环境变量。
主机 | 架构 | 下载 |
---|---|---|
Android 7+ (Termux) | aarch64 | .tar.xz |
Linux | aarch64 | .tar.xz |
MacOS 11.7+ | aarch64 | .tar.xz |
Windows | aarch64 | .zip |
Linux | x86_64 | .tar.xz |
MacOS 11.7+ | x86_64 | .tar.xz |
Windows | x86_64 | .zip |
您还可以通过使用此命令通过 cargo 安装 vsd。
cargo install vsd
此外,您还可以安装由 theRealCataclysm 创建的第三方 gui 前端。
用法
- 将 HLS 和 DASH 播放列表下载并保存到磁盘。
$ vsd save <url> -o video.mp4
出于测试目的,您可以使用来自 https://test-streams.mux.dev 的流。
- 从网站收集 .m3u8(HLS)、.mpd(Dash)和字幕,并保存到本地。
$ vsd capture <url> --save
帮助
$ vsd --help
Download video streams served over HTTP from websites, DASH (.mpd) and HLS (.m3u8) playlists.
Usage: vsd.exe [OPTIONS] <COMMAND>
Commands:
capture Capture playlists and subtitles from a website
extract Extract subtitles from mp4 boxes
merge Merge multiple segments to a single file
save Download DASH and HLS playlists
help Print this message or the help of the given subcommand(s)
Options:
--color <COLOR> When to output colored text [default: auto] [possible values: auto, always, never]
-h, --help Print help
-V, --version Print version
$ vsd save --help
Download DASH and HLS playlists
Usage: vsd.exe save [OPTIONS] <INPUT>
Arguments:
<INPUT> http(s):// | .mpd | .xml | .m3u8
Options:
--base-url <BASE_URL> Base url to be used for building absolute url to segment. This flag is usually needed for local input files. By default redirected
playlist url is used
-d, --directory <DIRECTORY> Change directory path for temporarily downloaded files. By default current working directory is used
-o, --output <OUTPUT> Mux all downloaded streams to a video container (.mp4, .mkv, etc.) using ffmpeg. Note that existing files will be overwritten and
downloaded streams will be deleted
--parse Parse playlist and returns it in json format. Note that `--output` flag is ignored when this flag is used
--color <COLOR> When to output colored text [default: auto] [possible values: auto, always, never]
--raw-prompts Raw style input prompts for old and unsupported terminals
-h, --help Print help
Automation Options:
--prefer-audio-lang <PREFER_AUDIO_LANG> Preferred language when multiple audio streams with different languages are available. Must be in RFC 5646 format (eg.
fr or en-AU). If a preference is not specified and multiple audio streams are present, the first one listed in the
manifest will be downloaded
--prefer-subs-lang <PREFER_SUBS_LANG> Preferred language when multiple subtitles streams with different languages are available. Must be in RFC 5646 format
(eg. fr or en-AU). If a preference is not specified and multiple subtitles streams are present, the first one listed in
the manifest will be downloaded
-q, --quality <WIDTHxHEIGHT|HEIGHTp> Automatic selection of some standard resolution streams with highest bandwidth stream variant from playlist. If
matching resolution of WIDTHxHEIGHT is not found then only resolution HEIGHT would be considered for selection. comman
values: [lowest, min, 144p, 240p, 360p, 480p, 720p, hd, 1080p, fhd, 2k, 1440p, qhd, 4k, 8k, highest, max] [default:
highest]
--skip-prompts Skip user input prompts and proceed with defaults
Client Options:
--cookies <COOKIES> Fill request client with some existing cookies value. Cookies value can be same as document.cookie or in json format same as
puppeteer
--header <KEY> <VALUE> Custom headers for requests. This option can be used multiple times
--no-certificate-checks Skip checking and validation of site certificates
--proxy <PROXY> Set http(s) / socks proxy address for requests
--set-cookie <SET_COOKIE> <URL> Fill request client with some existing cookies per domain. First value for this option is set-cookie header and second value is
url which was requested to send this set-cookie header. Example `--set-cookie "foo=bar; Domain=yolo.local" https://yolo.local`.
This option can be used multiple times
--user-agent <USER_AGENT> Update and set user agent header for requests [default: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/112.0.0.0 Safari/537.36"]
Decrypt Options:
--all-keys Use all supplied keys for decryption instead of using keys which matches with default kid only
-k, --key <KEY|KID:KEY> Keys for decrypting encrypted streams. If streams are encrypted with a single key then there is no need to specify key id else specify
decryption key in format KID:KEY. KEY value can be specified in hex, base64 or file format. This option can be used multiple times
--no-decrypt Download encrypted streams without decrypting them. Note that --output flag is ignored if this flag is used
Download Options:
--retry-count <RETRY_COUNT> Maximum number of retries to download an individual segment [default: 15]
--no-merge Download streams without merging them. Note that --output flag is ignored if this flag is used
-t, --threads <THREADS> Maximum number of threads for parllel downloading of segments. Number of threads should be in range 1-16 (inclusive) [default: 5]
替代方案
vsd 的替代方案列表
- N_m3u8DL-RE 是 vsd 的最佳替代方案。它还支持 vsd 不支持的实时播放列表。它不包含像 捕获 这样的功能。
- N_m3u8DL-CLI 也不错,但它不是跨平台的。
- m3u8-downloader 也不错,但它可定制的选项非常少。
- webvideo-downloader 使用 chrome 打开网站,然后捕获 m3u8 请求。vsd 的 捕获 命令与该功能最接近。
- dash-mpd-cli 非常适合下载 DASH 播放列表。此外,vsd 解析和下载 DASH 播放列表的大部分内部代码都用于其主要项目。
许可
双许可
依赖项
~18–35MB
~595K SLoC