Closed jeffstjean closed 4 years ago
Appears this issue only occurs when used the integrated terminal in VS Code. Really can't do much more debugging beyond that but maybe it's a VS issue and not Node. Thoughts?
It's ffmpeg that's aborting, not node. An abort trap is usually a tripped assert so my guess is that ffmpeg doesn't like something about the environment it's executed in.
You can try turning on core dumps with ulimit -c unlimited
, then checking the core dump afterwards with lldb. Its bt
command prints the stack trace leading up to the abort.
I'm moving this to nodejs/help but I can move it back if it turns out it's a Node.js issue after all.
Just did a bit more testing to try and isolate the issue. I was originally running the script through the integrated command line in VS Code and turns out that was the variable that was causing the issue. Opening a Terminal process is a workaround.
Closing this issue as it is not node related. Hopefully this helps someone if they ever come across it.
Hello, I have the same problem I think with node js spawn and ffmpeg. I have an .sh file that when run in a bash terminal works fine, but when run by chil_process.spawn will give me an error. (i'm not using any built in bash in a code editor)
index.js
const { promisify } = require('util');
const child_process = require('child_process');
const ffmpegProcess = spawn("./toto.sh");
toto.sh
#!/bin/bash
ffmpeg -report -i /pathtovideo/video.mp4 -i /pathtoaudio/video.mp3 -y -acodec aac -filter:a atempo=1.35 -map 0:v -map 1:a -vf "subtitles=/pathtosubtitles.srt:force_style='Alignment=10,FontName=/pathToFont.ttf,Fontsize=14'" -t 4 /pathtooutput.mp4
[Parsed_subtitles_0 @ 0x77c3180] libass API version: 0x1502002
[Parsed_subtitles_0 @ 0x77c3180] libass source: commit: 0.15.2-71-gcbeea94fc70a6322ecce4c4ff30bef2a9028c18a
[Parsed_subtitles_0 @ 0x77c3180] Shaper: FriBidi 1.0.11 (SIMPLE) HarfBuzz-ng 3.1.1 (COMPLEX)
[Parsed_subtitles_0 @ 0x77c3180] Using font provider fontconfig
[Parsed_subtitles_0 @ 0x77c3180] fontselect: (/pathtofont.ttf, 400, 0) -> /usr/share/fonts/urw-base35/NimbusSans-Regular.otf, 0, NimbusSans-Regular
[libx264 @ 0x67bd900] using SAR=1/1
[libx264 @ 0x67bd900] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!
Child process exited with code 1
What steps will reproduce the bug?
I think I have isolated this to being a node issue but could be a lack of understanding of ffmpeg or child processes. On MacOS, I am using ffmpeg to on-the-fly encode a webcam into an hls format. I created a bash file that simply executes the command with the required options. When I execute it through Terminal, everything works as expected and I get a continuous stream of ts files. However, when I execute the bash file through a spawned child process. I continually get
SIGABRT
/Abort Trap 6
error.server.js:
record:
I have also tried executing this without the use of a bash file and it has the same result.
How often does it reproduce? Is there a required condition?
100% of the time. It does not occur when the input is a file and not a streamable device (camera, etc.).
What is the expected behaviour?
NodeJS maintains an open child_process with the ffmpeg command that will continue until process termination:
What do you see instead?