fluent-ffmpeg / node-fluent-ffmpeg

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

How do I put one video below another? #1297

Open ManucherKM opened 3 months ago

ManucherKM commented 3 months ago

Version information

Code to reproduce

ffmpeg()
        .input(inputFrame)
        .size("?x1920")
        .aspect("9:16")
        .duration(65)
        .input(inputOverlayVideo)
        .input(inputMainVideo)
        .complexFilter([
            {
                filter: 'overlay',
                options: {
                    x: overlayXPosition,
                    y: overlayYPosition
                },
                inputs: ['0:v', '1:v'],
                outputs: 'result'
            }
        ], 'result')
        .output(outputVideo)
        .run();

(note: if the problem only happens with some inputs, include a link to such an input file)

Expected results

I'm sorry, but the problem is related to the fact that due to the fact that I'm using FFmpeg and your package for the first time, I don't know how to realize my task, not to the fact that there is something wrong with your package.

So, I want to combine 2 videos. 1 at the top of the video, the other at the bottom. The first video should be without sound and the second with sound. The first video is 9:16 by default and the second video is 16:9. For better understanding, I made a mini template of how it should look like: image Here's a link to figma (https://www.figma.com/design/alIPXUn8eL28XajlpJ1lHR/Untitled?node-id=0-1&t=VZXDbzRF12otp2e6-1), you can read the template in detail there. I was also thinking about adding some filters for the video. How can I do all this? I make similar videos through CapCut, but considering it's very time consuming I decided to automate it.

Observed results

On output, one of the videos just stretches and covers the previous one, also missing sound and more.