fluent-ffmpeg / node-fluent-ffmpeg

A fluent API to FFMPEG (http://www.ffmpeg.org)
MIT License
7.63k stars 873 forks source link

Unknown encoder 'libwebp' #1188

Open niZmosis opened 1 year ago

niZmosis commented 1 year ago

I am currently on my local machine, but this will be ran on linux once on the server, if that matters.

I am wondering how I can add in the webp encoder. I've been searching around for a while and have come up short. I get this error in the console 'Error: ffmpeg exited with code 1: Unknown encoder 'libwebp'. Only thing I have found searching around is someone said that some encoders are not enabled by default for licensing reasons, which '-strict -2' was the command they added to enable it (They were going to AAC though). That didn't seem to do much. The plan here is to convert an mp4 to an animated webp (not webm) as they are short videos < 10s. I am using Sharp for converting images to webp which works, and I would think that it would use the libwebp as well which fluent isn't finding.

` export async function resizeFormatSave({ inputPath, outputPath, size, }) { return new Promise((resolve, reject) => { const options = [ // '-strict -2', '-vcodec libwebp', '-filter:v fps=fps=20', '-lossless 1', '-loop 0', '-preset default', '-an', '-vsync 0', ]

    if (size) {
        options.push(`-s ${size}:${size}`)
    }

    fluent(inputPath)
        .on('start', (cmd) => console.log({ cmd }))
        .on('end', () => resolve(outputPath))
        .on('error', (err) => reject(err))
        .outputOptions(options)
        .output(outputPath)
        .run()
})

}`

Azgaar commented 1 year ago

Hello @niZmosis, were you able to resolve the issue? I'm facing the same one. This article implies webp can be used, but not details how: https://xetera.dev/converting-webp/

niZmosis commented 1 year ago

@Azgaar Nope, what I ended up doing was use FFMpeg to convert video to a gif, then I convert the gif to webp using sharp. Not the route I wanted to take, as I have to write more things to disk and do an extra conversion. Ideally I'd like to keep everything in the buffer stream. If you ever find out how to do this, make sure you let me know lol.