Answer the question
In order to leave comments, you need to log in
Why is fluent-ffmpeg picking up wrong length videos?
I have a video, I split it into photos, process the photos and want to reassemble exactly the same video.
Until the last point, everything is going fine, but my video assembly is not going correctly
Let's say I have a video for 10 seconds. After building this video is already 14 seconds and when you turn it on, it feels like fluent-ffmpeg slows it down.
I tried to do the same, but not through NodeJS, but just from the console and everything went fine. The video was assembled in length the same as the original
const buildVideo: Promise<void> = new Promise((resolve, reject) => {
const command = ffmpeg()
.output(`${videoTmp.path}.mp4`)
.input(`${tmpDir.path}/frame-%d.jpeg`)
.input(`${audioTmp.path}.mp3`)
.videoCodec('libx264')
.inputFPS(30)
.outputFPS(30)
.on('error', (error) => {
this.logger.error(`FFMPEG ERROR: ${error}`);
reject(error);
})
.on('end', function () {
resolve();
})
.run();
});
await buildVideo;
Answer the question
In order to leave comments, you need to log in
it's in the order of options:
in the NodeJS variant it -r 30
comes after -i имяфайла
and therefore does not apply to it. The default frequency of 25 is applied to the input as a result.
From the Fluent documentation :
The following methods enable passing input-related options to ffmpeg. Each of these methods apply on the last input added (including the one passed to the constructor, if any). You must add an input before calling those, or an error will be thrown.
.inputFPS(30)
immediately after.input(`${tmpDir.path}/frame-%d.jpeg`)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question