问题标签 [fluent-ffmpeg]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
2221 浏览

javascript - 如何使用 node.js 和 fluent-ffmpeg 检查损坏的 webm 视频?

我想检查编码的 webm 视频是否有错误。到目前为止,我已经设法使用以下方法捕获错误:

输出:

我想使用 node.js 和fluent-ffmpeg实现相同的输出,但我不知道要传递-v error-f null -使用 js 包装器语法。

我的天真尝试如下所示:

但我马上得到了一个错误:ffmpeg exited with code 1: Unrecognized option '-f null -'.

关于如何ffmpeg -v error -i ../broken.webm -f null -使用 fluent-ffmpeg 从 node.js 调用的任何想法?

0 投票
1 回答
7256 浏览

node.js - 使用 node fluent-ffmpeg 将图像转换为视频

我为此找到了很多样本​​,但没有一个对我正常工作。

我有几个图像。URL、Base64 或缓冲区。

我需要将它们转换为视频,而不改变质量。

我最接近的是这个命令:
ffmpeg -framerate 1 pattern_type glob -i 'images/*.jpg' -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4

但它每秒显示 1 张图像。我需要视频为 30fps,而不是 1 张 30 帧的图像,而是每秒 30 张图像。

有人可以帮我弄这个吗?

0 投票
2 回答
4628 浏览

javascript - Cloud Functions for Firebase:在不触及最大超时的情况下完成长流程

当它们上传到 Firebase 存储时,我必须将视频从 webm 转码为 mp4。我这里有一个可以运行的代码演示,但是如果上传的视频太大,在转换完成之前,firebase 函数会在我身上超时。我知道可以增加函数的超时限制,但这似乎很混乱,因为我无法确认该过程所花费的时间会少于超时限制。

有没有办法阻止firebase超时而不只是增加最大超时限制?

如果没有,有没有办法完成耗时的过程(如视频转换),同时仍然让每个过程开始使用 firebase 函数触发器?

如果甚至使用 firebase 函数完成耗时的过程并不是真正存在的东西,有没有办法在不影响质量的情况下加快 fluent-ffmpeg 的转换?(我意识到这部分有很多问题。如果绝对必要,我计划降低质量,因为 webms 转换为 mp4 的原因是用于 IOS 设备)

作为参考,这是我提到的演示的主要部分。正如我之前所说,完整的代码可以在这里看到,但是复制过来的这部分代码是创建确保转码完成的 Promise 的部分。完整的代码只有 70 多行,所以如果需要的话应该比较容易通过。

(这里有一堆文本解析代码,后面是 onChange 事件中的下一段代码)

0 投票
2 回答
2826 浏览

firebase - 错误:ffprobe 以代码 1 退出

我正在尝试在 firebase 函数中使用 fluent-ffmpeg 来截取上传的视频,但不断收到此错误:

错误:

这是我的代码

谁能帮助我做错了什么?

0 投票
1 回答
311 浏览

ffmpeg - ffmpeg 将转码输出的大小限制为 <104857600 字节

我正在使用以下选项将 video.webm 转换为 .wav 文件。但是输出文件非常大!

我需要减小它的大小,实际上将输出大小限制为 104857600 字节并让 ffmpeg 库处理其余部分(比如自动调整质量)真的很酷 知道怎么做吗?

如果那是不可能的,我怎么能降低质量,比如 50% ?

0 投票
1 回答
549 浏览

ffmpeg - How to use codec type properly in NPM

Trying to use '-acodec libopus' in my npm project as I use in the command line like in the following format;

This works perfectly! But I would like to make it possible in my NPM project.

How can I set the parameters? This is what I have , but not working. The output file is broken in a way that some of the frames of the audio file are missing. It is like there is sound and then there is not. And vice versa.

The purpose is to take audio file from the video file seamlessly.

Without the codec libopus, I get the following errors in the command prompt, so I assume I should handle the same issue in my NPM project as well.

My library is up to date, I just need to use the codec libopus properly. Any suggestions?

0 投票
1 回答
1421 浏览

ffmpeg - FFmpeg fontcolor_expr to dynamically change fontcolor over time

I'm using Fluent-FFmpeg with Node.JS to create videos with text overlaid on them and I'm wanting to change the color of the text as the video progresses.

My filters follow this pattern:

And it prints out this stuff:

In particular this annoying bit:

However, it would be really nice to do something like this:

Which prints out this error:

There aren't a lot of examples of fontcolor_expr, so I wanted to see if anyone had experience with this. Any tips on changing fonrcolors dynamically without creating multiple filters?

Please note that fontcolor_expr=white and fontcolor_expr=888888 are valid and create videos with a fixed font color.

0 投票
1 回答
1295 浏览

node.js - 将 Webm 转码为音频文件 (fluent-ffmpeg)

我有一个视频文件,当我通过 ffprobe 命令检查时,它的属性如下;我的目的是仅获取音频文件,其大小不应> 100mb。在 NPM 项目中是否有任何正确的方法?

0 投票
1 回答
2529 浏览

ffmpeg - Fluent-ffmpeg 如何在不丢失任何声音的情况下减小输出文件的大小

是否有任何最佳做法可以将转码后的输出文件的大小保持在特定大小?

我需要将其保持在 <100 MB 以下,但不知何故我最终得到了大输出文件。问题是我的(测试)视频文件为 600kb,而生成的 output.wav 为 4MB。这与我的预期相去甚远。

这就是我将参数提供给 ffmpeg 库的方式。我应该在这里更改哪些参数以减小尺寸并保持最大值。质量?

0 投票
0 回答
1291 浏览

node.js - 视频 - 使用 ffmpeg 从 DASH m4s 文件中提取图像

我正在尝试从破折号流 m4s 文件创建缩略图。

我有 mpd、init.mp4 文件和 m4s 文件。

我有使用从 mp4 文件中提取图像的 nodeJS ffmpeg 包的代码:

但是因为我正在从破折号流中读取我的文件,所以我得到了一个 m4s 文件。

我尝试将 m4s 格式转换为 mp4,然后使用上面的代码,但是 ffmpeg(准确地说是 fluent-ffmpeg)返回错误消息

发生错误:ffmpeg exited with code 1: C:\files\nodejs\testFiles\000000.m4s: Invalid data found when processing input

我用来转换的代码是:

是否可以将单个 m4s 文件转换为 mp4?

如果没有,使用 ffmpeg 和 nodejs 将 m4s 转换为 mp4 的正确方法是什么?

我找不到任何参考,但如果可以直接从 m4s 文件中提取图像,我认为它会更快地解决问题。

可以使用此站点使用网络部分(Chrome 浏览器中的 f12)下载所有 *.m4s 文件、mpd 和 init.mp4 文件并检查代码。