Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

video to sticker giving error #36

Open
chauhanshivam079 opened this issue Apr 6, 2022 · 5 comments
Open

video to sticker giving error #36

chauhanshivam079 opened this issue Apr 6, 2022 · 5 comments

Comments

@chauhanshivam079
Copy link

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
Copy link
Owner

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

@chauhanshivam079
Copy link
Author

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());

}

WhatsApp.Video.2022-04-07.at.9.01.30.PM.mp4

@AlenVelocity
Copy link
Owner

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

@AlenVelocity
Copy link
Owner

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

@adarsh-chakraborty
Copy link

Thank you for the code.
It worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants