diff --git a/s/context/controllers/video-export/controller.ts b/s/context/controllers/video-export/controller.ts index 3e88d69..d21eb36 100644 --- a/s/context/controllers/video-export/controller.ts +++ b/s/context/controllers/video-export/controller.ts @@ -97,7 +97,7 @@ export class VideoExport { async #extract_frames_from_video(effect: VideoEffect) { const file_result = await fetchFile(effect.file) await this.ffmpeg.ffmpeg.writeFile(effect.file.name, file_result) - await this.ffmpeg.ffmpeg.exec(["-i", effect.file.name, `out${effect.id}_%d.png`]) + await this.ffmpeg.ffmpeg.exec(["-threads", "4","-i", effect.file.name, `out${effect.id}_%d.png`]) this.decoded_effects.set(effect.id, effect.id) } diff --git a/s/context/controllers/video-export/helpers/FFmpegHelper/helper.ts b/s/context/controllers/video-export/helpers/FFmpegHelper/helper.ts index 3334825..816e152 100644 --- a/s/context/controllers/video-export/helpers/FFmpegHelper/helper.ts +++ b/s/context/controllers/video-export/helpers/FFmpegHelper/helper.ts @@ -46,15 +46,13 @@ export class FFmpegHelper { await this.ffmpeg.createDir("/thumbnails") await this.ffmpeg.createDir("/segments") await this.ffmpeg.writeFile(file.name, result) - // remux to mkv container, which supports more variety of codecs - await this.ffmpeg.exec(["-i", file.name, "-c", "copy", "container.mkv"]) // split into 5 second segments, so user can get new filmstrips every 5 seconds - await this.ffmpeg.exec(["-i", "container.mkv", "-c", "copy", "-map", "0", "-reset_timestamps", "1", "-f", "segment", "-segment_time", "5", "segments/out%d.mkv"]) + await this.ffmpeg.exec(["-threads", "4","-i", file.name, "-c", "copy", "-map", "0", "-reset_timestamps", "1", "-f", "segment", "-segment_time", "5", "segments/out%d.mp4"]) const segments = await this.ffmpeg.listDir("/segments") for(const segment of segments) { if(!segment.isDir) { - await this.ffmpeg.exec(["-i", `segments/${segment.name}`, "-filter_complex", `select='not(mod(n\,1))',scale=100:50`, "-an", "-c:v", "libwebp", `thumbnails/${segment_number}_out%d.webp`]) + await this.ffmpeg.exec(["-threads", "4","-i", `segments/${segment.name}`, "-filter_complex", `scale=100:50`, "-an", "-c:v", "libwebp", "-preset","icon" ,`thumbnails/${segment_number}_out%d.webp`]) const frames = await this.ffmpeg.listDir("/thumbnails") for(const frame of frames) { if(!frame.isDir) {