Juvi
Juvi

Reputation: 1338

FFMpeg multiple actions with the same filter_complex

I'm working with 2 videos and I want to make 3 different operations at same execution with FFmpeg. Each command works separate but it'll much more efficient to make them all run at the same execution.

So for example I have:

Video 1

Video 2

First I want to cut both videos from starting point to end point:

cmd = -i video1Path -ss 00:00:30.0 -c copy -t 00:00:10.0 video1Output
cmd = -i video2Path -ss 00:00:30.0 -c copy -t 00:00:10.0 video2Output

Than resizing Video 1:

cmd = "-i " + video1Output+ " -vf scale=240:360" + resizedVideo1;

Now overlaying the resizedVideo1 on top of Video 2:

cmd = "-i " + video2Output + " -i " + resizedVideo1 + " -filter_complex [0:v][1:v]" + overlayCmd + " " + finalVideoPath;

I'm wondering if it's possible to achieve all this actions at the same FFMpeg executions using 1 filter_complex...

Upvotes: 0

Views: 896

Answers (1)

Gyan
Gyan

Reputation: 93241

The combined command will be

ffmpeg -ss 30 -t 10 -i video2 -ss 30 -t 10 -i video1
  -filter_complex
        "[1]scale=240:360[v1];[0][v1]overlay"
  output.mp4

Upvotes: 1

Related Questions