Firebase 云函数:ffmpeg 版本
Firebase cloud functions: ffmpeg version
我在使用 ffmpeg 的 node12 运行时有 firebase 功能。安装的ffmpeg版本是3.4.8,相比4.*版本有一些小怪癖
有人知道,如果更高的节点版本带有更新的 ffmpeg 二进制文件吗?
如果你还没有,你可以尝试添加 ffmpeg 的包版本,如 official documentation says. You just need to specify which version to install using the normal npm install <package>@<version>
syntax, or also specify it in the package.json
file as suggested in this post:
您还可以检查此过程是否适用于命令 ffmpeg --version
{
"name": "sample-http",
"version": "0.0.1",
"dependencies": {
"ffmpeg": "0.0.4"
}
}
*我使用了 git 存储库中包含的版本。
**非常感谢您的反馈。
使用 ffmpeg-static 你选择了你需要的二进制文件。
而且它不需要建造。它会在安装依赖项时下载二进制文件。
package.json
{
"name": "ffmpeg-fb",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"@types/ffmpeg-static": "^3.0.1",
"ffmpeg-static": "^4.4.1",
"firebase-admin": "^10.0.2",
"firebase-functions": "^3.18.1"
}
}
然后是 index.ts
import * as functions from "firebase-functions";
import * as pathToFFMPEG from 'ffmpeg-static'
import * as child_process from 'child_process';
export const ffmpegTest = functions.https.onRequest(async (request, response) => {
functions.logger.info("FFMPEG Path " + pathToFFMPEG, {structuredData: true});
await new Promise((resolve) => {
const cmd = child_process.spawn(pathToFFMPEG, ['-version'], { shell: true });
cmd.stdout.on('data', (data) => {
functions.logger.info(`stdout: ${data}`);
});
cmd.on('error', (error) => {
functions.logger.info(`error: ${error}`);
});
cmd.on('close', (code) => {
resolve(undefined);
});
});
response.send("Hello from Firebase!");
});
我在使用 ffmpeg 的 node12 运行时有 firebase 功能。安装的ffmpeg版本是3.4.8,相比4.*版本有一些小怪癖
有人知道,如果更高的节点版本带有更新的 ffmpeg 二进制文件吗?
如果你还没有,你可以尝试添加 ffmpeg 的包版本,如 official documentation says. You just need to specify which version to install using the normal npm install <package>@<version>
syntax, or also specify it in the package.json
file as suggested in this post:
您还可以检查此过程是否适用于命令 ffmpeg --version
{
"name": "sample-http",
"version": "0.0.1",
"dependencies": {
"ffmpeg": "0.0.4"
}
}
*我使用了 git 存储库中包含的版本。
**非常感谢您的反馈。
使用 ffmpeg-static 你选择了你需要的二进制文件。 而且它不需要建造。它会在安装依赖项时下载二进制文件。
package.json
{
"name": "ffmpeg-fb",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"@types/ffmpeg-static": "^3.0.1",
"ffmpeg-static": "^4.4.1",
"firebase-admin": "^10.0.2",
"firebase-functions": "^3.18.1"
}
}
然后是 index.ts
import * as functions from "firebase-functions";
import * as pathToFFMPEG from 'ffmpeg-static'
import * as child_process from 'child_process';
export const ffmpegTest = functions.https.onRequest(async (request, response) => {
functions.logger.info("FFMPEG Path " + pathToFFMPEG, {structuredData: true});
await new Promise((resolve) => {
const cmd = child_process.spawn(pathToFFMPEG, ['-version'], { shell: true });
cmd.stdout.on('data', (data) => {
functions.logger.info(`stdout: ${data}`);
});
cmd.on('error', (error) => {
functions.logger.info(`error: ${error}`);
});
cmd.on('close', (code) => {
resolve(undefined);
});
});
response.send("Hello from Firebase!");
});