1 | initial version |
To use ffmpeg-static to cut and combine audio and video files that experience freezing at the start of the video, you can follow these steps:
npm install ffmpeg-static
const ffmpegPath = require('ffmpeg-static').path;
const ffmpeg = require('fluent-ffmpeg');
ffmpeg.setFfmpegPath(ffmpegPath);
ffmpeg
object to cut and combine the audio and video files. For example, to cut a video from a specific start time and combine it with an audio file, you can use the following code:ffmpeg()
.input('video.mp4')
.setStartTime('00:00:10') // start time of the video
.input('audio.mp3')
.output('output.mp4')
.run();
noaccurate_seek
option to skip the initial freezing of the video:ffmpeg()
.input('video.mp4')
.inputOptions('-noaccurate_seek')
.setStartTime('00:00:10') // start time of the video
.input('audio.mp3')
.output('output.mp4')
.run();
Note: Depending on the size and complexity of your files, the process may take some time to complete.