pedroslopez / whatsapp-web.js

A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app
https://wwebjs.dev
Apache License 2.0
15.21k stars 3.63k forks source link

Update fluent-ffmpeg dependency to fix compatibility issues with ffmpeg v7 #3151

Open totallynotdavid opened 3 months ago

totallynotdavid commented 3 months ago

Is there an existing issue for this?

Describe the bug

The current version of whatsapp-web.js (1.23.1-alpha.5 from webpack-exodus branch & 1.24.0) uses fluent-ffmpeg version 2.1.2, which has regex compatibility issues with ffmpeg versions 7 and above. This affects media file transformations (conversions from videos or GIFs to stickers) that rely on ffmpeg.

The error message received is:

Error: Output format <format> is not available

Expected behavior

An animated sticker is being sent when the user send the message '#sticker' with a GIF or video.

Steps to Reproduce the Bug or Issue

I have created a sample repository that demonstrates the issue: https://github.com/totallynotdavid/ffmpeg-issue-whatsapp-web.js

  1. Clone https://github.com/totallynotdavid/ffmpeg-issue-whatsapp-web.js
  2. Update the Chrome path to your own, change this line: https://github.com/totallynotdavid/ffmpeg-issue-whatsapp-web.js/blob/5553154bcc12a063148527f240bad3e4d526073b/index.js#L8
  3. Run npm run start
  4. Send a GIF and include the #sticker message body or answer to a message containing a GIF or a video. You'll find the issue described above.

Relevant Code

This issue is due to a regex compatibility problem between fluent-ffmpeg 2.1.2 and the latest versions of ffmpeg. The problem has been fixed in fluent-ffmpeg version 2.1.3, see this pull request. The changes introduced in this PR are minor and are unlikely to break things in the whatsapp-web.js project.

Browser Type

Google Chrome

WhatsApp Account Type

Standard

Does your WhatsApp account have multidevice enabled?

Yes, I am using Multi Device

Environment

OS: Windows 11 24H2 PhoneOS: Android 12 whatsapp-web.js version: 1.23.1-alpha.5 WhatsApp Web version: 2.3000.1014583617 Node.js Version: v20.12.2

Additional context

No response

totallynotdavid commented 3 months ago

This issue was also showed here #2914 and #2912 by @MikeyA-yo but both issues where closed.

I can confirm that using v2.1.3 fixes this issue.

MikeyA-yo commented 3 months ago

This issue was also showed here #2914 and #2912 by @MikeyA-yo but both issues where closed.

I can confirm that using v2.1.3 fixes this issue.

Well nice thank you unfortunately the guy keeps closing issues without reviewing them such a meanie, i'd advice you talk to them on discord