[英]Node puppeteer stream not recording audio
我正在嘗試使用 puppeteer stream 錄制視頻和音頻,但它只將視頻寫入 output 文件:
async function videoRecorder() {
require("puppeteer-stream");
const puppeteer = require("puppeteer");
const fs = require("fs");
const filename = `./recordings/test.mp4`;
const file = fs.createWriteStream(filename);
const browser = await puppeteer.launch({
executablePath:
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
headless: true,
defaultViewport: null,
devtools: false,
args: [
"--window-size=1920,1080",
"--window-position=1921,0",
"--autoplay-policy=no-user-gesture-required",
],
ignoreDefaultArgs: ["--mute-audio"],
});
const page = await browser.newPage();
await page.goto(pathToPageWithVideo, {
waitUntil: "load",
});
const stream = await page.getStream({
audio: true,
video: true,
});
stream.pipe(file);
setTimeout(async () => {
await stream.destroy();
file.close();
console.log("finished");
}, 10000);
}
我嘗試了許多其他錄制視頻和音頻的方法,但這是我更接近的一種,因為我的主要目的是只獲取音頻,我願意接受更多建議。
謝謝
通過另存為.webm 而不是.mp4 解決。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.