#error unknown when trying to send stickers

18 messages · Page 1 of 1 (latest)

tidal moss
#

Hello there, I have this code for convert from video to a sticker this is my code:

const media = await quotedMsg.downloadMedia();
// Save video to a file
const videoPath = 'video.mp4';
const webpPath = 'output.webp';
fs.writeFileSync(videoPath, media.data, 'base64');
const maxDuration = 4;

                        ffmpeg(videoPath)
                            .setDuration(maxDuration)
                            .toFormat('webp')
                            .save(webpPath)
                            .on('end', async () => {
                                const webpData = fs.readFileSync(webpPath).toString('base64');
                                const media = new MessageMedia('image/webp', webpData);

                                try {
                                    await msg.reply(media, null, { sendMediaAsSticker: true });
                                    fs.unlinkSync(videoPath);
                                    fs.unlinkSync(webpPath);
                                } catch (error) {
                                    console.error('Error sending sticker ', error);
                                }
                            });

But i got the error :
Error sending sticker Error: Evaluation failed: a
at ExecutionContext._evaluateInternal (/home/hap/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async ExecutionContext.evaluate (/home/hap/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
at async Client.sendMessage (/home/hap/node_modules/whatsapp-web.js/src/Client.js:869:28)

What is the problem here? sometimes it works and sometimes not in most cases it doesnt work..

tidal moss
#

these codes in the ffmpeg solved my error:
.size('?x320')
.videoBitrate('500k')
.fps(10)
.outputOptions('-crf 28')
Max of animated stickers in whatsapp is 1MB so this is was the problem i just needed to downgrade the size of the webp sticker

rugged gyro
tidal moss
rugged gyro
#

I want to try this solution

tidal moss
#

Oh i thought which version lol

rugged gyro
tidal moss
rugged gyro
tidal moss
#

Yep fluent ffmpeg

rugged gyro
#

2.1.2?

tidal moss
#

Yes

rugged gyro
#

Thank you, im going to try

#

You helped a lot dude

tidal moss
#

Let me know if you need some help

rugged gyro
#

Okay