youtube-dl

下载 1080p 视频

官网: https://rg3.github.io/youtube-dl

文档:https://github.com/rg3/youtube-dl/blob/master/README.md#readme

安装:

我用的是 macOS

brew install youtube-dl

获取资源列表

192:~ boitx$ youtube-dl --proxy "https://127.0.0.1:1087/" -F https://www.youtube.com/watch?v=d58VJ-sC1uY
[youtube] d58VJ-sC1uY: Downloading webpage
[youtube] d58VJ-sC1uY: Downloading video info webpage
[youtube] d58VJ-sC1uY: Extracting video information
[youtube] d58VJ-sC1uY: Downloading js player vflUnLBiU
[youtube] d58VJ-sC1uY: Downloading MPD manifest
[info] Available formats for d58VJ-sC1uY:
format code  extension  resolution note
139          m4a        audio only DASH audio   48k , m4a_dash container, mp4a.40.5@ 48k (22050Hz), 1.08MiB
249          webm       audio only DASH audio   53k , opus @ 50k, 1.13MiB
250          webm       audio only DASH audio   72k , opus @ 70k, 1.48MiB
140          m4a        audio only DASH audio  128k , m4a_dash container, mp4a.40.2@128k (44100Hz), 2.89MiB
171          webm       audio only DASH audio  138k , vorbis@128k, 2.82MiB
251          webm       audio only DASH audio  141k , opus @160k, 2.94MiB
278          webm       256x144    144p  116k , webm container, vp9, 12fps, video only, 2.14MiB
160          mp4        256x144    DASH video  120k , avc1.4d400c, 24fps, video only, 2.51MiB
133          mp4        426x240    DASH video  252k , avc1.4d4015, 24fps, video only, 5.60MiB
242          webm       426x240    240p  258k , vp9, 24fps, video only, 4.88MiB
243          webm       640x360    360p  474k , vp9, 24fps, video only, 8.91MiB
134          mp4        640x360    DASH video  641k , avc1.4d401e, 24fps, video only, 10.54MiB
244          webm       854x480    480p  886k , vp9, 24fps, video only, 15.97MiB
135          mp4        854x480    DASH video 1171k , avc1.4d401e, 24fps, video only, 20.15MiB
247          webm       1280x720   720p 1777k , vp9, 24fps, video only, 31.18MiB
136          mp4        1280x720   DASH video 2336k , avc1.4d401f, 24fps, video only, 37.58MiB
248          webm       1920x1080  1080p 3152k , vp9, 24fps, video only, 56.03MiB
137          mp4        1920x1080  DASH video 4383k , avc1.640028, 24fps, video only, 65.62MiB
17           3gp        176x144    small , mp4v.20.3, mp4a.40.2@ 24k
36           3gp        320x180    small , mp4v.20.3, mp4a.40.2
43           webm       640x360    medium , vp8.0, vorbis@128k
18           mp4        640x360    medium , avc1.42001E, mp4a.40.2@ 96k
22           mp4        1280x720   hd720 , avc1.64001F, mp4a.40.2@192k (best)

下载 1080p 视频

youtube-dl --proxy "https://127.0.0.1:1087/" -f 137+140 https://www.youtube.com/watch?v=d58VJ-sC1uY

结果是两份文件:m4a,mp4.
现在需要把这两个文件合并起来,才能得到最终的视频。幸运的是我们可以通过 FFmpeg 来自动完成

安装 FFmpeg

192:~ boitx$ brew install ffmpeg
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
No changes to formulae.

==> Downloading https://homebrew.bintray.com/bottles/ffmpeg-3.3.4.sierra.bottle.
Already downloaded: /Users/boitx/Library/Caches/Homebrew/ffmpeg-3.3.4.sierra.bottle.tar.gz
==> Pouring ffmpeg-3.3.4.sierra.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink lib/pkgconfig/libavcodec.pc
/usr/local/lib/pkgconfig is not writable.

You can try again using:
  brew link ffmpeg
==> Summary
  /usr/local/Cellar/ffmpeg/3.3.4: 243 files, 50.8MB

Error: The brew link` step did not complete successfully The formula built, but is not symlinked into /usr/local Could not symlink lib/pkgconfig/libavcodec.pc /usr/local/lib/pkgconfig is not writable.

192:~ boitx$ sudo chown -R boitx  /usr/local/lib/pkgconfig
192:~ boitx$ brew install ffmpeg
Warning: ffmpeg 3.3.4 is already installed, it's just not linked.
You can use `brew link ffmpeg` to link this version.
192:~ boitx$ brew link ffmpeg
Linking /usr/local/Cellar/ffmpeg/3.3.4... 81 symlinks created

总结

说说费时的事吧: 明明已经安装了 FFmpeg ,下载的时候总是提示没有安装 FFmpeg , 不会自动合并 m4a 音频文件和 mp4 视频文件。
卸载安装重复了多次,仍然没有解决。太折腾了。

你可能感兴趣的:(youtube-dl)