最佳音频和视频的 youtube-dl 格式选项在直播中不起作用

youtube-dl format option for best audio and video does not working in live streams

我使用 youtube-dl 从 youtube 流式传输视频。我将此格式用于 stream/download 质量低于 720p 的 youtube 非实时视频,效果很好。

youtube-dl -f 'bestvideo[height<=?720]+bestaudio'  https://www.youtube.com/watch?v=ubk3dvOdYzg

但对于直播的 YouTube 视频

youtube-dl -f 'bestvideo[height<=?720]+bestaudio' https://www.youtube.com/watch?v=Ij2rYpNxXgM

显示此错误

ERROR: requested format not available

您的格式要求将 720p 以下的最佳纯视频流与最佳音频流混合在一起。但是,在这种情况下,有问题的直播似乎没有单独的流,只有一个带有图片 音频的流。

要支持这些类型的视频,请将该格式(在您的情况下为 best[height<=?720]')添加到您的格式规范中:

youtube-dl -f 'bestvideo[height<=?720]+bestaudio/best[height<=?720]' Ij2rYpNxXgM

如果您总是想要 720p 或更低的视频,您也可以将 -f 'bestvideo[height<=?720]+bestaudio/best[height<=?720]' 写入 configuration file,这样您就不必一直输入它了。