From ce35884ef789c2b77cd73d5411cbc802bec33fcf Mon Sep 17 00:00:00 2001 From: a946547732 Date: Fri, 1 Dec 2023 10:52:57 +0800 Subject: [PATCH] Auto Commit --- index.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/index.js b/index.js index 24a7ace..5a6ee0f 100644 --- a/index.js +++ b/index.js @@ -22,3 +22,28 @@ function getDayOfMonth() { } const dayOfMonth = getDayOfMonth(); console.log(`今天是本月的第 ${dayOfMonth} 天`); + +const { spawn } = require('child_process'); + + +//生成一个 mp4 to wav 视频格式转化器 +// 执行 FFmpeg 命令行工具 +const ffmpeg = spawn('ffmpeg', ['-i', 'input.mp4', 'output.wav']); + +// 监听执行结果 +ffmpeg.on('close', (code) => { + console.log(`子进程退出,退出码 ${code}`); +}); + +ffmpeg.on('error', (err) => { + console.error(`出错了:${err}`); +}); + +ffmpeg.stdout.on('data', (data) => { + console.log(`输出:${data}`); +}); + +ffmpeg.stderr.on('data', (data) => { + console.error(`错误:${data}`); +}); + -- GitLab