[FFmpeg-user] mosaic video 2x2, 3x3 etc

Ryan Williams rwilliams at busivid.com
Wed Dec 9 08:25:29 CET 2015


Instead of using nullsrc as your base use color as your base. I suspect the syntax is "color='color=black:size=2560x720' [base]; "

As for doing a dynamic number of videos you'll need to write a script a language of your choice (perhaps powershell or C#) to generate the syntax for you.
Alternatively just make 25 different scripts which can handle from 1 - 25 videos each then simply execute the correct one.

-----Original Message-----
From: ffmpeg-user [mailto:ffmpeg-user-bounces at ffmpeg.org] On Behalf Of Schui1024
Sent: Wednesday, 9 December 2015 09:34
To: ffmpeg-user at ffmpeg.org
Subject: [FFmpeg-user] mosaic video 2x2, 3x3 etc

Hi there all

 

So I'm a newbie when it comes to ffmpeg, though I've got a script doing various things.

 

Video feed comes in with 10 second clips from multiple cameras.

(ie 4 cameras, 6 x 10 second clips for each camera) resulting in 24  h264 files.

 

I have scripted the automatic conversion from h264 to mp4 (client can only deal with mp4's), watermarking and such like,

and the subsequent joining of these mp4s, giving me the final result of 4 x
60 second mp4 files.

Resolutions of these files are 1280 x 720. No audio.

System is running Windows 2012 - I'm using cli and it's all running in an automated bat file.

 

I've found an article to mosaic these files into a single mp4 file, which is
2560x720

(command is : ffmpeg -i 1.mp4 -i 2.mp4 -i 3.mp4 -i 4.mp4 -filter_complex
"nullsrc=size=2560x1440 [base]; [0:v] setpts=PTS-STARTPTS, scale=1280x720 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=1280x720 [upperright]; [2:v] setpts=PTS-STARTPTS, scale=1280x720 [lowerleft]; [3:v] setpts=PTS-STARTPTS,
scale=1280x720 [lowerright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=1280 [tmp2]; [tmp2][lowerleft]
overlay=shortest=1:y=720 [tmp3]; [tmp3][lowerright] overlay=shortest=1:x=1280:y=720" -c:v libx264 quadview.mp4)

 

This works fine when it comes to 4 feeds, 

My question now is.. how do I do it for more than 4? (or indeed less than 4)

 

ie

[ ] [ ] [ ]

[ ] [ ] [ ]

 

Or

[ ] [ ] [ ]

[ ] [ ] [ ]

[ ] [ ] [ ]

 

Also if there are only 3, or 5 total feeds, how do I "blank" the remaining spare or is that automatic? Can I use a black jpg to fill any gaps?

My first attempt was to create a Quad view from 4 of the files, then use that resulting file to create another but miss out the lowerleft and shift over all the x/y points but couldn't get that to work (it'd be easy if I
could)

Else is there another application (cli) that I can use to do this?  I don't see it ever being more than 9 in total.

 

So apologies for asking what may seem to be a simple question, however it's above and beyond my current skillset!

 

Thank you in advance.. 

 

Schui1024

_______________________________________________
ffmpeg-user mailing list
ffmpeg-user at ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user



More information about the ffmpeg-user mailing list