1

I am new to ffmpeg, and I need some help:

I am writing an App that merges multiple videos to a single split-screen video. The user can set the size and position of each video. I implemented the merging by using a video.js stream merger. This works great on my notebook, but it won't work on older devices, so I decided to do the merging server-side with ffmpeg. I am struggling to achieve this. I tried it using the xstack, but how can I set the position of each video?`And how can i tell ffmpeg to enable the audio of each video? Is it possible to use the xstack in ffmpeg.js? It would be nice, because it is easier for me to deploy(as a firebase function) By now i tried it with a fixed amount of input files :

.\ffmpeg -i .\input0.webm -i input1.webm -i .\input2.webm -i .\input3.webm -filte
r_complex "[0:v][1:v][2:v][3:v]xstack=inputs=4:layout=0_0|w0_0|0_h0|w0_h0[v]" -map "[v]"   -map 0:a -map 1:a  -map 2:a -
map 3:a output2.webm

But I need to automate the call based on the user input. This works, but there is no audio, and I can't set the position of each video like I want to.

Update:

This is a snapshot of a possible user input I just don't know how/If I can use the layout option to make something like this.

finnk
  • 123
  • 1
  • 1
  • 12
  • What is wrong with the placement of the video from your command? Mixing all of the audio streams needs the amerge or amix filters. – llogan May 22 '20 at 19:40
  • @llogan Thank you for your reply. I will try the amerge or amix filter. I updated my question and added a snapshot of possible user input. I just don't get how and if I can use the layout option. – finnk May 22 '20 at 22:43
  • From your snapshot it appears you want to scale some of the inputs, so add the scale filter before xstack. – llogan May 23 '20 at 20:55

0 Answers0