将音频提取到stdout [youtube-dl]

时间:2016-09-09 03:05:11

标签: audio youtube-dl

我正在尝试从视频中提取音频并将其输出到stdout。 我能得到的最接近的是将视频下载到stdout。

youtube-dl -o - <link to video>

有谁知道怎么做?

此致 奥斯汀

1 个答案:

答案 0 :(得分:3)

尝试选项-f 首先列出可用的格式-F

youtube-dl -F  https://www.youtube.com/watch?v=CSKewNVWD0Y

然后查找&#34;仅音频&#34;格式:

249          webm       audio only DASH audio   62k , opus @ 50k, 20.17MiB
250          webm       audio only DASH audio   91k , opus @ 70k, 26.26MiB
171          webm       audio only DASH audio  128k , vorbis@128k, 44.89MiB
140          m4a        audio only DASH audio  132k , m4a_dash container, mp4a.40.2@128k, 51.17MiB
251          webm       audio only DASH audio  198k , opus @160k, 65.09MiB
278          webm       256x144    144p   46k , webm container, vp9, 6fps, video only, 11.36MiB
242          webm       426x240    240p   90k , vp9, 6fps, video only, 19.39MiB
160          mp4        256x144    144p  125k , avc1.4d400c, 6fps, video only, 15.18MiB
243          webm       640x360    360p  173k , vp9, 6fps, video only, 39.52MiB
134          mp4        640x360    360p  214k , avc1.4d4016, 6fps, video only, 47.51MiB
133          mp4        426x240    240p  255k , avc1.4d4015, 6fps, video only, 37.37MiB
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 (best)

opus @ 160 kbps的格式代码251。最后你可以使用(可选地用ffmpeg重新编码):

youtube-dl -f 251 https://www.youtube.com/watch?v=CSKewNVWD0Y -o - | ffmpeg -i - -b:a 160k my_fav_novel.mp3