Skip to content

Evaluation failed error while trying to upload audio file (audio/ogg; codecs=opus) #3695

Description

@NovelProfessor

Is there an existing issue for this?

  • I have searched the existing issues.

Is this a problem caused by your code, or is it specifically because of the library?

  • I have double-checked my code carefully.

Describe the bug.

I'm getting the error Evaluation failed when trying to upload audio file in "audio/ogg; codecs=opus" format. I am using NodeJS FFMPEG library to convert the MP3 file to OGG and sending the OGG file. I know that MP3 uses ACC and since AAC is a licensed format, It is not supported by Chromium, that's why I am converting to OGG but even OGG format is not working with your library.

Error returned:

0|server | Error: Evaluation failed: b
0|server | at ExecutionContext._ExecutionContext_evaluate (/home/admin/whatsapp-server/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js:229:15)
0|server | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
0|server | at async ExecutionContext.evaluate (/home/admin/whatsapp-server/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js:107:16)
0|server | at async Client.sendMessage (/home/admin/whatsapp-server/node_modules/whatsapp-web.js/src/Client.js:951:25)
0|server | at async FfmpegCommand. (/home/admin/whatsapp-server/server.js:399:21)

Audio_files.zip

Expected Behavior

It should send the audio file successfully as an audio message

Steps to Reproduce the Bug or Issue

I have pasted my NodeJS code below. The "sourceMediaFilename" points to the source MP3 and "targetMediaFilename" points to the converted OGG. I have attached both files here for reference. Also you can browse my full server code in my Github repository: https://github.com/NovelProfessor/whatsapp-server
You can check from line 386 in my "server.js" file.

        ffmpeg()
            .input(`${sourceMediaFilename}`)
            .outputOptions([
            '-c:a libopus',
            '-b:a 128k'
            ])
            .output(`${targetMediaFilename}`)
            .on("end", async () => {
                console.log("Conversion finished");
                const mediaObject = MessageMedia.fromFilePath (targetMediaFilename);

                await client.sendMessage(req.body.receiver, mediaObject);
                res.status(200).json({statusCode: '000', statusDesc: 'media uploaded successfully'});
            })
            .on("error", (err) => {
                console.error("Error:", err);
                res.status(500).json({statusCode: '003', statusDesc: err.message});
            })
            .run();

WhatsApp Account Type

Standard

Browser Type

Chromium

Operation System Type

Ubuntu

Phone OS Type

iOS

WhatsApp-Web.js Version

1.30.0

WhatsApp Web Version

1.30.0

Node.js Version

v22.17.0

Authentication Strategy

LocalAuth

Additional Context

Please resolve this issue, I am the developer of the famous Novel Messenger client for BlackBerry and its based on your WWebJS library, the users are loving my app, only thing missing is the ability to send audio messages because of this bug in your libary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions