ffmpegwasm / ffmpeg.wasm

FFmpeg for browser, powered by WebAssembly
https://ffmpegwasm.netlify.app
MIT License
13.49k stars 775 forks source link

can't decode webm video with alpha channel #621

Open nbutmickey opened 8 months ago

nbutmickey commented 8 months ago

Describe the bug i have two materials,one is a webm video with alpha channel,and another is a png image,i need to generate a video with background,the background is png image,and ensure alpha channel are preserved

To Reproduce here is code:

await ffmpeg.writeFile('input.webm', await fetchFile('video/output_idle.webm'));
        await ffmpeg.writeFile('bg.png', await fetchFile('bg-vertical.png'));
        await ffmpeg.exec(
            [
                '-i',
                'input.webm',
                '-c:v',
                'libvpx',
                '-i',
                'bg.png',
                '-filter_complex',
                '[0:v][1:v]overlay=(W-w)/2:(H-h)/2',
                '-vcodec',
                'libx264',
                'output.mp4'
            ]
        );

i use libvpx to decode the input webm video, but the console reports the following error:

image

Expected behavior

I hope ffmpeg.wasm can decode webm format based video with transparent channel for easy operation

Screenshots I use native ffmpeg to execute the same command, and it shows that the video input stream format output by ffmpeg is yuva420p, but the input stream format output using ffmpeg.wasm is yuv420p, and it feels like the transparent channel is lost.

image

native ffmpeg

image

ffmpeg.wasm

Desktop (please complete the following information):

Additional context png: bg-vertical