[英]Deploying on google App Engine : An error occurred: ffmpeg was killed with signal SIGABRT Error: ffmpeg was killed with signal SIGABRT
I wrote a node-js api, with node-js and fluent-ffmpeg :我用 node-js 和 fluent-ffmpeg 写了一个 node-js api:
'use strict';
require('babel-register');
const path = require('path');
const ffmpeg = require('fluent-ffmpeg');
[...] [...]
var infs = new ffmpeg
infs.addInput(doc.data().url).outputOptions([
'-preset slow', '-g 48', '-sc_threshold 0',
'-map 0:0', '-map 0:1', '-map 0:0', '-map 0:1',
'-s:v:0 1280x720', '-c:v:0 libx264', '-b:v:0 2000k',
// "-var_stream_map", "'v:0,a:0 v:1,a:1'",
'-master_pl_name ./' + req.params.id + '/master' + req.params.id + '.m3u8',
'-f hls', '-hls_time 6', '-hls_list_size 0',
'-hls_segment_filename ./' + req.params.id + '/fileSequence|' + req.params.id + '|%d|v%v.ts',
'-max_muxing_queue_size 1024',
]).output('./' + req.params.id + '/video' + req.params.id + '.m3u8')
.on('start', function (commandLine) {
console.log('Spawned Ffmpeg with command: ' + commandLine);
})
.on('error', function (err, stdout, stderr) {
console.log('An error occurred: ' + err.message, err, stderr);
})
.on('progress', function (progress) {
console.log('Processing: ' + progress.percent + '% done')
})
.on('end', function (err, stdout, stderr) {
console.log('Finished processing!' /*, err, stdout, stderr*/)
})
.run()
res.status(200).send('GG').end();
}
});
[...] [...]
That work with与
node app.js节点应用程序.js
on my macbook pro, but when i do在我的 macbook pro 上,但是当我这样做时
gcloud app deploy gcloud 应用部署
and I call the public url, I have this logs :我打电话给公共网址,我有这个日志:
Processing: undefined% done
An error occurred: ffmpeg was killed with signal SIGABRT Error: ffmpeg was killed with signal SIGABRT
Here is my app.yaml :这是我的 app.yaml :
# Copyright 2017, Google, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# [START gae_flex_quickstart_yaml]
runtime: nodejs
env: flex
# This sample incurs costs to run on the App Engine flexible environment.
# The settings below are to reduce costs during testing and are not appropriate
# for production use. For more information, see:
# https://cloud.google.com/appengine/docs/flexible/nodejs/configuring-your-app-with-app-yaml
manual_scaling:
instances: 1
resources:
cpu: 1
memory_gb: 6
disk_size_gb: 30
# [END gae_flex_quickstart_yaml]
How can I do to deploy correctly my node-js api on google app engine ?如何在谷歌应用引擎上正确部署我的 node-js api?
Thank's in advance.提前致谢。
Jérémy.杰瑞米。
We do not have information about what exactly is doc.data().url
, however this will be something you are getting from db document.我们没有关于doc.data().url
究竟是什么的信息,但是这将是您从 db 文档中获得的信息。 So looking into addInput
documentation , I guess, it has to be some local file name.所以查看addInput
文档,我猜,它必须是一些本地文件名。 Local file name is, as well, argument of output
method.本地文件名也是output
方法的参数。
This will work on your local environment, however when you deal with files in App Engine you have to use some storage services which is described here .这将适用于您的本地环境,但是当您在 App Engine 中处理文件时,您必须使用此处描述的一些存储服务。
According to the library documentation :根据图书馆文件:
In order to be able to use this module, make sure you have ffmpeg installed on your system (including all necessary encoding libraries like libmp3lame or libx264).为了能够使用此模块,请确保您的系统上安装了 ffmpeg(包括所有必要的编码库,如 libmp3lame 或 libx264)。
Checking the default node container (that you're using, according to the app.yaml
), I'm not sure the right dependencies come pre-installed.检查默认节点容器(您正在使用,根据app.yaml
),我不确定是否预先安装了正确的依赖项。
You can check by going to a deployed instance, enable debugging, and SSHing into it.您可以通过转至已部署的实例、启用调试并通过 SSH 连接到该实例来进行检查。 You can follow the process detailed in the docs .您可以按照文档中详细说明的流程进行操作。
If all the required dependencies are not pre-installed, you'll have to build a custom container for GAE flex.如果未预安装所有必需的依赖项,则必须为 GAE flex 构建自定义容器。
Since the node library fluent-ffmpeg
is just running the local command ( you can check in the code of the library ), it can be that your local computer has everything installed, but it's missing components in the built image.由于节点库fluent-ffmpeg
只是运行本地命令( 您可以检查库的代码),因此您的本地计算机可能已安装所有内容,但构建的映像中缺少组件。
The fact that you're testing with node app.js
(ie not in a build container, but with the local node), gives more credit to this idea.您正在使用node app.js
进行测试(即不在构建容器中,而是使用本地节点进行测试)这一事实更能说明这个想法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.