I am using a complex filter that works, but when I change it a little I get bad result quality. This version seems to work fine:
[0:v]scale=640:480 [temp0];
[0:v] setpts=PTS-STARTPTS-1/TB, scale=128x96 [firsthistory];
[0:v] setpts=PTS-STARTPTS-1/TB, scale=128x96 [secondhistory];
[temp0][firsthistory] overlay=shortest=1:x=480:y=28 [temp1];
[temp1][secondhistory] overlay=shortest=1:x=480:y=139
This is taking a video, and then putting two subscreen overlays on the right which show the video shifted forward in time. To set the time forward for the captions, I use setpts=PTS-STARTPTS-n/TB where n is the number of seconds to shift time. This works but honestly I don't understand it.
Anyhow, this works when n=1. If I shift the videos further forward, the resulting video quality is poor. The video output is jerky, for example using the below n=2,4:
[0:v]scale=640:480 [temp0];
[0:v] setpts=PTS-STARTPTS-2/TB, scale=128x96 [firsthistory];
[0:v] setpts=PTS-STARTPTS-4/TB, scale=128x96 [secondhistory];
[temp0][firsthistory] overlay=shortest=1:x=480:y=28 [temp1];
[temp1][secondhistory] overlay=shortest=1:x=480:y=139
The full ffmpeg parameters are
'-i',
'b77b24e5-27a6-459b-aa11-8f79e0162659.mpeg',
'-filter_complex',
'[0:v]scale=640:480 [temp0];[0:v] setpts=PTS-STARTPTS-2/TB, scale=128x96 [firsthistory];[0:v] setpts=PTS-STARTPTS-4/TB, scale=128x96 [secondhistory];[temp0][firsthistory] overlay=shortest=1:x=480:y=28 [temp1];[temp1][secondhistory] overlay=shortest=1:x=480:y=139',
'-c:v',
'libvpx',
'-b:v',
'1M',
'-c:a',
'libvorbis',
'-vf',
'scale=960:-1',
'50649689680c6e5976d1d7fb3fd603259c2ab6e0.webm'