Reputation: 33
I'm fairly new to ffmpeg so apologies if this is a simple problem.
I'm trying to tile four 60 fps videos using the script below. It works, but the output is at 25 fps. When I try to use -r
to force it back to 60, it looks like 25 fps upsampled to 60, counting duplicated frames when rendering.
How can I preserve the original files?
ffmpeg -i vln1.mp4 -i vln2.mp4 -i vla.mp4 -i cello.mp4 -filter_complex \
"nullsrc=size=2800x2400 [base]; \
[0:v] setpts=PTS-STARTPTS, scale=2800x600 [A]; \
[1:v] setpts=PTS-STARTPTS, scale=2800x600 [B]; \
[2:v] setpts=PTS-STARTPTS, scale=2800x600 [C]; \
[3:v] setpts=PTS-STARTPTS, scale=2800x600 [D]; \
[base] [A] overlay=shortest=0 [tmp1]; \
[tmp1][B] overlay=shortest=0:y=600 [tmp2]; \
[tmp2][C] overlay=shortest=0:y=1200 [tmp3]; \
[tmp3][D] overlay=shortest=0:y=1800" \
-c:v libx264 quartetscore.mp4
Upvotes: 3
Views: 3314
Reputation: 134003
Set the frame rate for the nullsrc filter (default is 25 fps):
ffmpeg -i vln1.mp4 -i vln2.mp4 -i vla.mp4 -i cello.mp4 -filter_complex \
"nullsrc=size=2800x2400:rate=60 [base]; \
[0:v] setpts=PTS-STARTPTS, scale=2800x600 [A]; \
[1:v] setpts=PTS-STARTPTS, scale=2800x600 [B]; \
[2:v] setpts=PTS-STARTPTS, scale=2800x600 [C]; \
[3:v] setpts=PTS-STARTPTS, scale=2800x600 [D]; \
[base] [A] overlay=shortest=0 [tmp1]; \
[tmp1][B] overlay=shortest=0:y=600 [tmp2]; \
[tmp2][C] overlay=shortest=0:y=1200 [tmp3]; \
[tmp3][D] overlay=shortest=0:y=1800" \
-c:v libx264 quartetscore.mp4
Or if you want to stack just use the hstack filter instead of nullsrc and multiple overlay:
ffmpeg -i vln1.mp4 -i vln2.mp4 -i vla.mp4 -i cello.mp4 -filter_complex \
"[0:v] setpts=PTS-STARTPTS, scale=2800x600 [A]; \
[1:v] setpts=PTS-STARTPTS, scale=2800x600 [B]; \
[2:v] setpts=PTS-STARTPTS, scale=2800x600 [C]; \
[3:v] setpts=PTS-STARTPTS, scale=2800x600 [D]; \
[A][B][C][D]hstack=inputs=4" \
-c:v libx264 quartetscore.mp4
See Vertically or horizontally stack (mosaic) several videos using ffmpeg? for many more examples.
Upvotes: 1