No errors when filter_complex is invalid
Closed this issue · 3 comments
Hi. First thank you - great little library!
I'm using it to make some video clips from a wav file + a couple of static images that transition.
My code looks roughly like this.
converter.createInputFromFile(...);
converter.createInputFromFile(...);
converter
.createOutputStream({
f: "mp4",
t: 30,
movflags: "frag_keyframe+empty_moov",
filter_complex: "xfade=transition="+transition+":duration=4:offset=5[v1];
xfade=transition="+transition+":duration=4:offset=5[v1]"
converter.pipe(uploadStream, {end: true})
.on("error", (e) => {
console.log("ERROR", e);
/* do things on error */
})
.on("data", frameData => {
console.log("DATA", frameData);
/* do things with frame data (instance of Buffer) */
})
try {
await converter.run();
} catch(e) {
console.log("FFmpeg convert Failed",e);
}
For certain problems like input files missing, the on('error') triggers and I get ERROR console.log
But if I have invalid filter_complex, I don't get any error - I just end up with a 0 length output.
I tried with an exception handler around run() which didnt catch anything.
I also tried tracking the frameData but it doesnt print anything in either good or bad case. So I may misunderstand the purpose of that.
Is there a way to detect such an error?
Thanks, Tom
You can run with DEBUG=ffmpeg-stream
to see the ffmpeg logs and exit code. If it exits with 0 or 255 then it's considered a success. Otherwise it throws with last line of output as error message.
I don't remember why 255 is a success too. Maybe it's wrong. 255 means it was cancelled
Just saw this. Thanks, i'll give that a go.
Btw is there likelihood of on('progress') being added?
Do you know if it would be complex or relatively trivial to add?
Thanks!
I guess everything here is working as intended