gpt4 book ai didi

windows - 使用 puppeteer、windows 在 chromium 中播放 mp4

转载 作者:可可西里 更新时间:2023-11-01 10:02:58 28 4
gpt4 key购买 nike

我正在 Windows 10 上的节点中使用 puppeteer 进行开发。问题是当我打开一个播放 mp4 文件的网站时,浏览器告诉我它不受支持。

我找到了这个包:chromium-codecs-ffmpeg-nonfree ;但它适用于 Linux!

如何在 Windows 上使用 puppeteer 在 Chromium 中播放 .mp4?

最佳答案

Puppeteer Documentation对此有一个答案:

Q: What features does Puppeteer not support?

You may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, video playback/screenshots is likely to fail.) There are two reasons for this:

  • Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of Chromium's media-related limitations. This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the executablePath option to puppeteer.launch. You should only use this configuration if you need an official release of Chrome that supports these media formats.)
  • Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer does not support HTTP Live Streaming (HLS).

因此,为了在 Puppeteer 中截取视频播放,您需要将 executablePath 设置为单独安装的 Chrome 可执行文件:

const browser = await puppeteer.launch({
executablePath: '/path/to/Chrome',
});

关于windows - 使用 puppeteer、windows 在 chromium 中播放 mp4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47976790/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com