Changes between Version 1 and Version 2 of Create a mosaic out of several input videos using xstack
- Timestamp:
- Oct 8, 2019, 5:15:40 PM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Create a mosaic out of several input videos using xstack
v1 v2 6 6 FFmpeg provides more than one mechanism to create a video mosaic. In addition to using the ''overlay'' filter shown in [[Create a mosaic out of several input videos]], you can use the [http://ffmpeg.org/ffmpeg-all.html#xstack xstack] filter. [http://ffmpeg.org/ffmpeg-all.html#xstack xstack] takes the individual inputs along with a custom layout that you create, and positions the videos according to the layout. Here's an example: 7 7 8 [[Image(col_2x2.png, title=Figure 1 )]]8 [[Image(col_2x2.png, title=Figure 1, width=320, height=240)]] 9 9 10 10 … … 58 58 When there are more than two images in a sequence (either vertical or horizontal), it becomes necessary to add widths or heights together. So for example, for a single vertical sequence of three videos in '''Column Major Order''': 59 59 60 [[Image(col_1x3.png, title=Figure 3 )]]60 [[Image(col_1x3.png, title=Figure 3, width=180, height=320)]] 61 61 62 62 the layout would be '''layout=0_0|0_h0|0_h0+h1'''. The X coordinate for all videos is the same - '''0''', whereas the Y coordinate changes. For the first stream it is '''0''', then '''h0''', then '''h0+h1''' - the addition of height h0 and h1. For a horizontal sequence it would be similar with identical Y coordinates and X coordinates of '''0''', '''w0''', and '''w0+w1'''. … … 64 64 '''Row Major Order''' is similar, with values juxtaposed to appropriate points of origin. Figure 4 shows a 3x3 matrix (nine video streams), and Figure 5 shows a 6x6 matrix (36 video streams). Note how in these examples the output is now piped directly to '''ffplay'''. (Be aware that higher video counts can result in higher than normal CPU load.) 65 65 66 [[Image(row_3x3.png, title=Figure 4 )]]66 [[Image(row_3x3.png, title=Figure 4, width=320, height=240)]] 67 67 68 68 The complete command for this example ('''Row Major Order''') is … … 95 95 96 96 97 [[Image(row_6x6.png, title=Figure 5 )]]97 [[Image(row_6x6.png, title=Figure 5, width=640, height=480)]] 98 98 99 99 For higher density mosaics, you should probably scale down all inputs. This example scaled each video to qqvga (160x120). … … 194 194 = Matrix Madness! = 195 195 196 [[Image(row_12x12.png )]]197 198 199 200 196 [[Image(row_12x12.png, width=1024, height=640)]] 197 198 199 200
