我试图提出一种方法,可以使用例如VLC播放器播放实时流的仅音频部分。有问题的流来自ChilledCow,24x7流的URL为https://www.youtube.com/watch?v=DWcJFNfaw9c。使用youtube-dl -F
,我可以看到没有“仅音频”流;
[youtube] DWcJFNfaw9c: Downloading webpage
[youtube] DWcJFNfaw9c: Downloading m3u8 information
[youtube] DWcJFNfaw9c: Downloading MPD manifest
[info] Available formats for DWcJFNfaw9c:
format code extension resolution note
91 mp4 256x144 HLS 197k , avc1.42c00b, 30.0fps, mp4a.40.5@ 48k
92 mp4 426x240 HLS 338k , avc1.4d4015, 30.0fps, mp4a.40.5@ 48k
93 mp4 640x360 HLS 829k , avc1.4d401e, 30.0fps, mp4a.40.2@128k
94 mp4 854x480 HLS 1380k , avc1.4d401f, 30.0fps, mp4a.40.2@128k
95 mp4 1280x720 HLS 2593k , avc1.4d401f, 30.0fps, mp4a.40.2@256k
96 mp4 1920x1080 HLS 4715k , avc1.640028, 30.0fps, mp4a.40.2@256k (best)
如果我随后使用youtube-dl -g -f 96
命令,则能够检索M3U8网址(现已过期);
https://manifest.googlevideo.com/api/manifest/hls_playlist/expire/1586086956/ei/zG-JXobzGP3B1AbawoHgBw/ip/202.153.210.144/id/DWcJFNfaw9c.2/itag/96/source/yt_live_broadcast/requiressl/yes/ratebypass/yes/live/1/goi/160/sgoap/gir%3Dyes%3Bitag%3D140/sgovp/gir%3Dyes%3Bitag%3D137/hls_chunk_host/r1---sn-fpqxc5oq-hxal.googlevideo.com/vprv/1/playlist_type/DVR/initcwndbps/14720/mh/Ms/mm/44/mn/sn-fpqxc5oq-hxal/ms/lva/mv/m/mvi/0/pcm2cms/yes/pl/24/dover/11/keepalive/yes/fexp/23882514/mt/1586065238/disable_polymer/true/sparams/expire,ei,ip,id,itag,source,requiressl,ratebypass,live,goi,sgoap,sgovp,vprv,playlist_type/sig/AJpPlLswRQIgQ4q-AaeGe9RuORutXufPJpq2jV5qvvYSf8L46jrnOpcCIQDLiqxM-r8EVp8EUby0D8gzWblW56-4NjCpasYtABNGxw%3D%3D/lsparams/hls_chunk_host,initcwndbps,mh,mm,mn,ms,mv,mvi,pcm2cms,pl/lsig/ALrAebAwRgIhAPXST2zJ7NWF6SF7iv1JeiJxIQM9wnuYXlgEipQS1nxRAiEAsE9Vlj1mpqE3t72DvI7JXu0ILWajrQsEjqMNzy5spjQ%3D/playlist/index.m3u8
我可以用VLC打开它,音频和视频流也可以。检查“编解码器详细信息”时,我看到有2个流; ADTS音频@ 48000 Hz和H.264视频。打开M3U8文件,我看到有关如何下载单个ts段的说明;
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:5
#EXT-X-MEDIA-SEQUENCE:261917
#EXT-X-DISCONTINUITY-SEQUENCE:105
#EXT-X-PROGRAM-DATE-TIME:2020-04-05T01:52:00.024+00:00
#EXTINF:5.0,
https://r1---sn-fpqxc5oq-hxal.googlevideo.com/videoplayback/id/DWcJFNfaw9c.2/itag/96/source/yt_live_broadcast/expire/1586087365/ei/ZXGJXsX2Bc-zvATAg5LQCA/ip/202.153.210.144/requiressl/yes/ratebypass/yes/live/1/goi/160/sgoap/gir%3Dyes%3Bitag%3D140/sgovp/gir%3Dyes%3Bitag%3D137/hls_chunk_host/r1---sn-fpqxc5oq-hxal.googlevideo.com/vprv/1/playlist_type/DVR/initcwndbps/13910/mh/Ms/mm/44/mn/sn-fpqxc5oq-hxal/ms/lva/mv/m/mvi/0/pl/24/keepalive/yes/fexp/23882513/mt/1586065639/disable_polymer/true/sparams/expire,ei,ip,id,itag,source,requiressl,ratebypass,live,goi,sgoap,sgovp,vprv,playlist_type/sig/AJpPlLswRQIhAPZgf7DINxcGTvbH4B_0f-viQhiTpYT1jJuUsvmDCzJaAiB1GcPc2tvTx2wbYDgG5qb5PkSQ7pPS5A5yhlh782GdlQ%3D%3D/lsparams/hls_chunk_host,initcwndbps,mh,mm,mn,ms,mv,mvi,pl/lsig/ALrAebAwRAIgdV-i58zrYviyY4Zin9w6Gu9WVvqv5y99lq4XOsyRH4wCIEohlTMmwYrHgF8YvXWFRWZvYQP7e6NiE7w42YmwUzOM/playlist/index.m3u8/sq/261917/goap/clen%3D81159%3Blmt%3D1585977854061325/govp/clen%3D265668%3Blmt%3D1585977854061323/dur/5.000/file/seg.ts
#EXTINF:5.0,
https://r1---sn-fpqxc5oq-hxal.googlevideo.com/videoplayback/id/DWcJFNfaw9c.2/itag/96/source/yt_live_broadcast/expire/1586087365/ei/ZXGJXsX2Bc-zvATAg5LQCA/ip/202.153.210.144/requiressl/yes/ratebypass/yes/live/1/goi/160/sgoap/gir%3Dyes%3Bitag%3D140/sgovp/gir%3Dyes%3Bitag%3D137/hls_chunk_host/r1---sn-fpqxc5oq-hxal.googlevideo.com/vprv/1/playlist_type/DVR/initcwndbps/13910/mh/Ms/mm/44/mn/sn-fpqxc5oq-hxal/ms/lva/mv/m/mvi/0/pl/24/keepalive/yes/fexp/23882513/mt/1586065639/disable_polymer/true/sparams/expire,ei,ip,id,itag,source,requiressl,ratebypass,live,goi,sgoap,sgovp,vprv,playlist_type/sig/AJpPlLswRQIhAPZgf7DINxcGTvbH4B_0f-viQhiTpYT1jJuUsvmDCzJaAiB1GcPc2tvTx2wbYDgG5qb5PkSQ7pPS5A5yhlh782GdlQ%3D%3D/lsparams/hls_chunk_host,initcwndbps,mh,mm,mn,ms,mv,mvi,pl/lsig/ALrAebAwRAIgdV-i58zrYviyY4Zin9w6Gu9WVvqv5y99lq4XOsyRH4wCIEohlTMmwYrHgF8YvXWFRWZvYQP7e6NiE7w42YmwUzOM/playlist/index.m3u8/sq/261918/goap/clen%3D81404%3Blmt%3D1585977854061335/govp/clen%3D236301%3Blmt%3D1585977854061333/dur/5.000/file/seg.ts
我不确定是否有一种方法只能流音频部分,我的目标是让无头的树莓派(无视频输出,仅音频)可以播放音频流。
答案 0 :(得分:0)
我想出了一个相对简单的解决方案。我最终使用了带有—no-video
选项和YouTube URL的命令行播放器mpv。我可以确认音频只能解码。