FFMPEG无法读取Heroku上/ tmp /中的文件

时间:2021-08-28 08:59:33

I created a nodejs application hosted on heroku which uses imagemagick. I am doing this operation:

我在heroku上创建了一个使用imagemagick的nodejs应用程序。我正在做这个操作:

require('child_process').exec(`convert -quiet -delay 1 output.avi ${gif}`);

This should convert output.avi (which is present) to a gif file. In this case, gif is "/app/temp/gifs/xstrycatdq.gif". This command works perfectly on my local windows machine. As I use the path module to get a variable with path.joinand __dirname.

这应该将output.avi(存在)转换为gif文件。在这种情况下,gif是“/app/temp/gifs/xstrycatdq.gif”。此命令在我的本地Windows机器上完美运行。当我使用path模块获取带有path.join和__dirname的变量时。

I have installed heroku buildpack:

我已经安装了heroku buildpack:

The error I am receiving is:

我收到的错误是:

Command failed: convert -quiet -delay 1 output.avi /app/temp/gifs/xstrycatdq.gif
convert: DelegateFailed `'ffmpeg' -nostdin -v -1 -vframes %S -i '%i' -vcodec pam -an -f rawvideo -y '%u.pam' 2> '%Z'' @ error/delegate.c/InvokeDelegate/1919.
convert: UnableToOpenBlob `magick-93R4VJcemPz0z1.pam': No such file or directory @ error/blob.c/OpenBlob/2705.
convert: NoImagesDefined `/app/temp/gifs/xstrycatdq.gif' @ error/convert.c/ConvertImageCommand/3257.

It seems that the /tmp/ directory can't be written to or anything. I also tried to mkdir /tmp/ but bash tells me that this dir already exists.

似乎无法写入/ tmp /目录或任何内容。我也尝试过mkdir / tmp /但是bash告诉我这个目录已经存在了。

I have also tried changing the imagemagick's temp directory with the environment variable by doing export MAGICK_TMPDIR="temp".

我还尝试通过导出MAGICK_TMPDIR =“temp”来更改imagemagick的临时目录和环境变量。

Any help?

有帮助吗?

Edit: The variables are now absolute.

编辑:变量现在是绝对的。

1 个解决方案

#1


1  

Are you sure it's not an issue of permissions? Can you write a simple text file to /app/temp? Is nothing is being read or written at all, it sounds like an issue of permissions. Maybe it's not necessarily a protection design of ImageMagick, but rather heroku or your programming environment?

您确定这不是权限问题吗?你能写一个简单的文本文件到/ app / temp吗?什么都没有被读或写,这听起来像是一个权限问题。也许它不一定是ImageMagick的保护设计,而是heroku或您的编程环境?

This directory you're trying to use, it's special in that it contains corrupt or incomplete files - it may have special protections or guards in place, when certain software is running. temp directories are typically designed (or assumed) to be protected from user interference, as they are only to be used and worked with, by the program itself - not the user's commands of the program.

您尝试使用此目录,它的特殊之处在于它包含损坏或不完整的文件 - 当某些软件运行时,它可能具有特殊保护或保护。临时目录通常被设计(或假设)以免受用户干扰,因为它们仅由程序本身使用和使用 - 而不是用户的程序命令。

This question is similar to yours, it might be able to help you.

这个问题与你的问题类似,它可能能够帮到你。

#1


1  

Are you sure it's not an issue of permissions? Can you write a simple text file to /app/temp? Is nothing is being read or written at all, it sounds like an issue of permissions. Maybe it's not necessarily a protection design of ImageMagick, but rather heroku or your programming environment?

您确定这不是权限问题吗?你能写一个简单的文本文件到/ app / temp吗?什么都没有被读或写,这听起来像是一个权限问题。也许它不一定是ImageMagick的保护设计,而是heroku或您的编程环境?

This directory you're trying to use, it's special in that it contains corrupt or incomplete files - it may have special protections or guards in place, when certain software is running. temp directories are typically designed (or assumed) to be protected from user interference, as they are only to be used and worked with, by the program itself - not the user's commands of the program.

您尝试使用此目录,它的特殊之处在于它包含损坏或不完整的文件 - 当某些软件运行时,它可能具有特殊保护或保护。临时目录通常被设计(或假设)以免受用户干扰,因为它们仅由程序本身使用和使用 - 而不是用户的程序命令。

This question is similar to yours, it might be able to help you.

这个问题与你的问题类似,它可能能够帮到你。