AlenVelocity / wa-sticker-formatter

Sticker Creator for WhatsApp
https://alensaito1.github.io/wa-sticker-formatter/
MIT License
99 stars 45 forks source link

video to sticker giving error #36

Open chauhanshivam079 opened 2 years ago

chauhanshivam079 commented 2 years ago

not able to convert video to a sticker @AlenSaito1

handleExit(new Error('ffmpeg exited with code ' + code)); ^ Error: ffmpeg exited with code 1 at ChildProcess. (D:\Giga\Java Script\I-BOT\node_modules\fluent-ffmpeg\lib\processor.js:182:22) at ChildProcess.emit (events.js:315:20) at ChildProcess.EventEmitter.emit (domain.js:486:12) at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12) error Command failed with exit code 1.

AlenVelocity commented 2 years ago

Could you share a relevant code snippet and the image/video which you were converting?

chauhanshivam079 commented 2 years ago

const stream = await downloadContentFromMessage( msg.videoMessage, "video" ); let buffer = Buffer.from([]); for await (const chunk of stream) { buffer = Buffer.concat([buffer, chunk]); } let randomName = (Math.random() + 1).toString(36).substring(7); fileName = Media/stickers/${randomName}.mp4; await writeFile(fileName, buffer); }

const sticker = new Sticker(fileName, {
  pack: "I-Bot Stickers", // The pack name
  author: "I-Bot", // The author name
  type: StickerTypes.CROP, // The sticker type
  categories: ["🤩", "🎉"], // The sticker category
  id: "12345", // The sticker id
  quality: 50, // The quality of the output file
});
await sock.sendMessage(chatId, await sticker.toMessage());

}

https://user-images.githubusercontent.com/72668899/162237383-453e2bda-b9cb-496f-8714-d28f78fd4994.mp4

AlenVelocity commented 2 years ago

Thanks, I'll get back to you in a while

AlenVelocity commented 2 years ago

It worked for me. Are you on the latest version of WSF?

adarsh-chakraborty commented 2 years ago

Thank you for the code. It worked for me.