Skip to content

Commit

Permalink
fix(AiDataProcessor): last ayah extra second
Browse files Browse the repository at this point in the history
  • Loading branch information
51L3N7-X committed Apr 9, 2024
1 parent b42c707 commit ad8af30
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ async function AIChose() {
const surah = await processAiData(
surahData,
JSON.parse(fs.readFileSync("./data/data.json")),
"./video.mp3",
"./audio/audio.webm",
);

const generator = new VideosGenerator(
imagesGenerator,
{
x264Preset: "ultrafast",
},
answers.highlightWords || settings.video.highlightWords,
answers.highlightWords,
);

console.log(gradient.morning("Video processing"));
Expand Down Expand Up @@ -173,7 +173,7 @@ async function APIChose() {
{
x264Preset: "ultrafast",
},
answers.highlightWords || settings.video.highlightWords,
answers.highlightWords,
);

console.log(gradient.morning("Video processing"));
Expand Down
4 changes: 2 additions & 2 deletions src/modules/videosGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default class VideosGenerator {
useTransitions: false,
},
imageOptions: {
lastImageExtraDuration: 0,
lastImageExtraDuration: 1000,
},
});

Expand All @@ -126,7 +126,7 @@ function trimAudio(buffer, start, end) {
ffmpeg({ source: stream.Readable.from(buffer, { objectMode: false }) })
.format("mp3")
.seek(start / 1000)
.duration((end - start) / 1000)
.duration((end + 1000 - start) / 1000)
.writeToStream(outputBufferStream);
});
}

0 comments on commit ad8af30

Please sign in to comment.