[FFmpeg-user] mosaic video 2x2, 3x3 etc
Schui1024
ffmpeg at mattball.co.uk
Tue Dec 8 23:33:37 CET 2015
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
More information about the ffmpeg-user
mailing list