0

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'

1 Answer 1

0

I ended up not using setpts to delay the overlay videos. Instead I am taking multiple inputs from the same file, some time-shifted with -itsoffset. Parameters:

'-i',
'2c15d5be-2b61-4c0d-b394-7f3d45f6ca7f.mpeg',
'-itsoffset',
-6,
'-i',
'2c15d5be-2b61-4c0d-b394-7f3d45f6ca7f.mpeg',
'-itsoffset',
-3,
'-i',
'2c15d5be-2b61-4c0d-b394-7f3d45f6ca7f.mpeg',
'-filter_complex',
'[0:v] scale=640:480 [temp0];[1:v] scale=128x96 [firsthistory];[2:v] scale=128x96 [secondhistory];[temp0][firsthistory] overlay=x=480:y=28  [temp1];[temp1][secondhistory] overlay=x=480:y=144',
'-c:v',
'libvpx',
'-b:v',
'1M',
'-c:a',
'libvorbis',
'-vf',
'scale=960:-1',
'50649689680c6e5976d1d7fb3fd603259c2ab6e0.webm'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .