eugeneware / ffmpeg-static

ffmpeg static binaries for Mac OSX and Linux and Windows
GNU General Public License v3.0
1.11k stars 182 forks source link

bug: Error: spawn /home/container/node_modules/ffmpeg-static/ffmpeg EAGAIN #125

Closed theredcmdcraft closed 1 year ago

theredcmdcraft commented 1 year ago

ffmpeg-static version

5.1.0

Node.js version

v18.17.0

operating system and/or environment

What happened?

i am running a Discord.JS Bot with Discord.JS Voice. After some time running the Bot ffmpeg will throw an EAGAIN-Error. I don´t know why, the audio files does exists and works fine. After a Bot reboot the exact same audio files does work without any problems with ffmepg. I don´t know what I can do to fix this error so I hope anyone here can help me.

If you need more Informations about the Bot or the environment ask me.

derhuerst commented 1 year ago

related: https://github.com/eugeneware/ffmpeg-static/issues/72

derhuerst commented 1 year ago

This is likely due to how you're interacting with the spawned ffmpeg process. Unfortunately, I cannot help you with ffmpeg-specific questions.

Please follow the instructions mentioned in #72 to make sure your ffmpeg binary is working as intended. (updated version of the instructions below)

  1. Make sure you're running a supported version of Node.js using node -v. ffmpeg-static requires at least version 16.
  2. Install ffmpeg-static in the Docker image you're using, and check that the install logs don't show errors. During the install process, ffmpeg-static attempts to download ffmpeg from a GitHub Release; If this fails for some reason, the respective error will show up in the install logs.
  3. Verify that the downloaded ffmpeg binary works by running $(node -p 'require("ffmpeg-static")') --help.
jeffersonveloso commented 1 year ago

I also cannot use ffmpeg-static in a docker image. Every time I call the lib, ffmpeg closes with code 1.

derhuerst commented 1 year ago

@jeffersonveloso Can you provide more details? I cannot reproduce the problem in the node:alpine (Node.js on top of Alpine Linux) image:

$ docker run --rm -it --entrypoint /bin/sh node:alpine

# inside the Docker container's shell

$ node -v
# v20.5.1

$ mkdir /app
$ cd /app
$ npm init --yes
# Wrote to /app/package.json:
#
# {
#   "name": "app",
#   "version": "1.0.0",
#   "description": "",
#   "main": "index.js",
#   "scripts": {
#     "test": "echo \"Error: no test specified\" && exit 1"
#   },
#   "keywords": [],
#   "author": "",
#   "license": "ISC"
# }

$ npm i ffmpeg-static
# 
# added 20 packages, and audited 21 packages in 15s
# 
# 1 package is looking for funding
#   run `npm fund` for details
# 
# found 0 vulnerabilities
$ $(node -p 'require("ffmpeg-static")')
# ffmpeg version 6.0-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2023 the FFmpeg developers
#   built with gcc 8 (Debian 8.3.0-6)
#   configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzimg
#   libavutil      58.  2.100 / 58.  2.100
#   libavcodec     60.  3.100 / 60.  3.100
#   libavformat    60.  3.100 / 60.  3.100
#   libavdevice    60.  1.100 / 60.  1.100
#   libavfilter     9.  3.100 /  9.  3.100
#   libswscale      7.  1.100 /  7.  1.100
#   libswresample   4. 10.100 /  4. 10.100
#   libpostproc    57.  1.100 / 57.  1.100
# Hyper fast Audio and Video encoder
# usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
# 
# Use -h to get full help or, even better, run 'man ffmpeg'
jeffersonveloso commented 1 year ago

@jeffersonveloso Can you provide more details? I cannot reproduce the problem in the node:alpine (Node.js on top of Alpine Linux) image:

$ docker run --rm -it --entrypoint /bin/sh node:alpine

# inside the Docker container's shell

$ node -v
# v20.5.1

$ mkdir /app
$ cd /app
$ npm init --yes
# Wrote to /app/package.json:
#
# {
#   "name": "app",
#   "version": "1.0.0",
#   "description": "",
#   "main": "index.js",
#   "scripts": {
#     "test": "echo \"Error: no test specified\" && exit 1"
#   },
#   "keywords": [],
#   "author": "",
#   "license": "ISC"
# }

$ npm i ffmpeg-static
# 
# added 20 packages, and audited 21 packages in 15s
# 
# 1 package is looking for funding
#   run `npm fund` for details
# 
# found 0 vulnerabilities
$ $(node -p 'require("ffmpeg-static")')
# ffmpeg version 6.0-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2023 the FFmpeg developers
#   built with gcc 8 (Debian 8.3.0-6)
#   configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzimg
#   libavutil      58.  2.100 / 58.  2.100
#   libavcodec     60.  3.100 / 60.  3.100
#   libavformat    60.  3.100 / 60.  3.100
#   libavdevice    60.  1.100 / 60.  1.100
#   libavfilter     9.  3.100 /  9.  3.100
#   libswscale      7.  1.100 /  7.  1.100
#   libswresample   4. 10.100 /  4. 10.100
#   libpostproc    57.  1.100 / 57.  1.100
# Hyper fast Audio and Video encoder
# usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
# 
# Use -h to get full help or, even better, run 'man ffmpeg'

I tried to use ffmpeg-static as a path for ffmpeg when I tried to use the lib fluent-ffmpeg but the lib ffmpeg close and exit with code: 1 or throw the erro Stream closed and restart my api.

derhuerst commented 1 year ago

I tried to use ffmpeg-static as a path for ffmpeg when I tried to use the lib fluent-ffmpeg but the lib ffmpeg close and exit with code: 1 or throw the erro Stream closed and restart my api.

Unfortunately, I cannot help you with this level of information. :/

Please check if the ffmpeg binary works as intended, as I demonstrated above.

Phyroks commented 1 year ago

@derhuerst I think they're using it in the pterodactyl system. With the node js docker image

theredcmdcraft commented 1 year ago

I have tried out something: 35 calls to ffmpeg are fine. The 36. call is not okay and ffmpeg will throw the error EAGAIN. Errno: -11.

derhuerst commented 1 year ago

Sorry, again, this does not seem to be related to ffmpeg-static, as ffmpeg-static does nothing more than distribute prebuilt ffmpeg binaries. Consider opening an Issue at the repos of the tools you're using to spawn/run ffmpeg with.