gpt4 book ai didi

ffmpeg - 如何在 fluent-ffmpeg 中使用 -stream_loop 音频?

转载 作者:行者123 更新时间:2023-12-04 23:13:12 24 4
gpt4 key购买 nike

我正在尝试循环播放音频以适应视频的大小。我使用 VIDEOSHOW 创建 VIDEO,videoshow 使用 fluent-ffmpeg。
我已经在命令行上有这段代码可以完美运行:

    `ffmpeg -y -r 1 -loop 1 -i image.png -stream_loop -1 -i audio.mp3 -c:a copy -r 1 
-shortest -c:v libx264 -t 60 -vf scale=1280:720 video.mp4

但我不知道如何将它与 node-fluent-ffmpeg 一起使用,这是我使用的代码:
 async function nodeFluentFfmpeg() {
let image = [image.png]

return new Promise((resolve, reject) => {

const videoOptions = {
fps: 30,
loop: segundoVideo, // seconds
transition: true,
transitionDuration: 1, // seconds
videoBitrate: 1024,
videoCodec: "libx264",
size: "1280x720",
audioBitrate: "128k",
audioChannels: 2,
format: "mp4",
pixelFormat: "yuv420p"
}

videoshow(image, videoOptions)
.audio("audio.mp3","**-stream_loop -1 -c:a copy -r 1**")// **ERROR IS HERE**
.save("video.mp4")
.on("start", function(command) {
console.log("Rendering : ", command);
})
.on("error", function(err, stdout, stderr) {
console.error("Error:", err);
console.error("ffmpeg stderr:", stderr);
})
.on("end", function(output) {
console.error("Video created in:", output);
resolve()
});

})

最佳答案

您可以通过 .inputOption( 解决-stream_loop -1 ); .

关于ffmpeg - 如何在 fluent-ffmpeg 中使用 -stream_loop 音频?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59445920/

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