ffmpeg-python icon indicating copy to clipboard operation
ffmpeg-python copied to clipboard

Can ffmpeg-Python make a mosaic with direct output

Open Wessiez opened this issue 1 year ago • 0 comments

My Project: A camera makes a 15 second video and puts them in a directory. I want to take the video's and make a mosaic of them to show the people beeing filmed. The code used is:

ffmpeg \
   -i videos/01.mp4 \
   -i videos/02.mp4 \
   -i videos/03.mp4 \
   -i videos/04.mp4 \
   -i videos/05.mp4 \
   -i videos/06.mp4 \
   -i videos/07.mp4 \
   -i videos/08.mp4 \
   -i videos/09.mp4 \
  -filter_complex " \
      [0:v] setpts=PTS-STARTPTS, scale=qvga [a0]; \
      [1:v] setpts=PTS-STARTPTS, scale=qvga [a1]; \
      [2:v] setpts=PTS-STARTPTS, scale=qvga [a2]; \
      [3:v] setpts=PTS-STARTPTS, scale=qvga [a3]; \
      [4:v] setpts=PTS-STARTPTS, scale=qvga [a4]; \
      [5:v] setpts=PTS-STARTPTS, scale=qvga [a5]; \
      [6:v] setpts=PTS-STARTPTS, scale=qvga [a6]; \
      [7:v] setpts=PTS-STARTPTS, scale=qvga [a7]; \
      [8:v] setpts=PTS-STARTPTS, scale=qvga [a8]; \
      [a0][a1][a2][a3][a4][a5][a6][a7][a8]xstack=inputs=9:layout=0_0|w0_0|w0+w1_0|0_h0|w0_h0|w0+w1_h0|0_h0+h1|w0_h0+h1|w0+w1_h0+h1[out]"
-preset ultrafast -f matroska - | ffplay -fs -

But how to get this in a python script?

Wessiez avatar Nov 07 '24 20:11 Wessiez