wa-sticker-formatter icon indicating copy to clipboard operation
wa-sticker-formatter copied to clipboard

video to sticker giving error

Open chauhanshivam079 opened this issue 2 years ago • 5 comments

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.

chauhanshivam079 avatar Apr 06 '22 16:04 chauhanshivam079

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

AlenVelocity avatar Apr 07 '22 08:04 AlenVelocity

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

chauhanshivam079 avatar Apr 07 '22 15:04 chauhanshivam079

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

AlenVelocity avatar Apr 07 '22 15:04 AlenVelocity

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

AlenVelocity avatar Apr 07 '22 15:04 AlenVelocity

Thank you for the code. It worked for me.

adarsh-chakraborty avatar Apr 16 '22 07:04 adarsh-chakraborty