Stacking videos with ffmpeg via MATLAB not working as expected

50 views Asked by At

I am stacking 4 video inputs in a 2x2 grid and running into a conversion failure.

Basically, at least one of the videos is just a filler black video that I generated with this line (MATLAB, hence the eval):

eval(['!ffmpeg -framerate 1/3600 -i black_frame.JPG -c:v libx264 -t 3600 -pix_fmt yuv420p -vf scale=320:240 black_frame.mp4']);

The other video inputs are 4 hr long videos with identical specs. I've concatenated them with this line:

eval(['!ffmpeg -i "' v1 '" -i "' v3 '" -i "' v2 '" -i "' v4 '" -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];  [a0][a1][a2][a3]xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0[out] "  -map "[out]" -c:v libx264 "' output '"'])  

When I input v1-v4 with normal videos (not the filler black video), it outputs very quickly and everything is good. The line to generate the filler black video is very fast too. But when I sub one of the video inputs with the file path for the filler black video, the speed tanks exponentially, stalls, and conversion fails.

Any pointers for me? I also tried just subbing one of the inputs with a black image file instead of generating a whole video and inputting that. But it does the same thing :/ Does it have to do with frame rate? Should I try a different approach? Thanks.

0

There are 0 answers