fluent-ffmpeg / node-fluent-ffmpeg

A fluent API to FFMPEG (http://www.ffmpeg.org)
MIT License
7.9k stars 877 forks source link

Error: ffmpeg was killed with signal SIGSEGV #1299

Open hungnkb opened 1 month ago

hungnkb commented 1 month ago

Version information

Code to reproduce

ffmpeg()
          .setFfprobePath(ffprobe.path)
          .input(filePath)
          .screenshots({ folder: folderPath, filename: fileName + '.png', count: 1 })

Hi, im when i try in local machine it worked. But on development implement with Docker, i got error:

error Error: ffmpeg was killed with signal SIGSEGV
    at ChildProcess.<anonymous> (/app/node_modules/fluent-ffmpeg/lib/processor.js:178:22)
    at ChildProcess.emit (node:events:520:28)
    at ChildProcess._handle.onexit (node:internal/child_process:294:12)

Please help me to show some solution there. Thanks

gspinoza commented 3 days ago

I was dealing with a similar issue and everything points to resource limits issue. Some ffmpeg processes can use too much memory when dealing with large files. When this happens the container can quickly run out of memory so the kernel sends a signal to terminate the process immediately.

To confirm this I inspected the container and could see that the OOMkilled "out of memory" value was set to true:

    "State": {
        "OOMKilled": true,
    },

I tried running the container with unlimited host resources or increasing the memory limit, but the process was still getting killed by OOMKilled.

What solved the issue was increasing the "Resource Allocation" of docker (not the container). I increased the cpu limit, memory limit, and swap by editing the settings.json

If using docker desktop GUI it can be done through the settings menu: Settings > Resources > Advanced