Open windschaser opened 2 years ago
Can you provide code example, what do you mean by error filter? I'll look at this as soon as I can.
.on('stderr', console.error)
- this'll show all errors ffmpeg
would've shown.
Have the same problem - errors that occuring during ffmpeg work are not catchable by catch blocks. Example:
compressVideo(filePath: string, passThroughStream: PassThrough) {
try {
const ffmpeg = this.ffmpegService.create();
ffmpeg
.input(filePath)
.videoCodec("libx264")
...
.on("error", (error) => {
throw new InternalServerErrorException(error);
})
.pipe(passThroughStream, { end: true });
} catch (error) {
console.log("CATCHED - VideoCompressService - compressVideo", error);
}
}
FfmpegService to be clear:
import ffmpeg from "fluent-ffmpeg";
import ffmpegStatic from "ffmpeg-static";
@Injectable()
export class FfmpegService {
private ffmpeg: typeof ffmpeg;
constructor() {
this.ffmpeg = ffmpeg;
this.ffmpeg.setFfmpegPath(ffmpegStatic);
}
create(
input?: string | stream.Readable,
options?: ffmpeg.FfmpegCommandOptions,
) {
return this.ffmpeg(input, options);
}
}
As a result - when error occuring its not catched by any catch block and crashes the whole node js process. Tried to do without .on("error")
event - same result.
Is there any possible to show error throw by filter? Some times I may need more detail when error occurs.