
複雑なフィルターを使用していますが、少し変更すると結果の品質が悪くなります。このバージョンは問題なく動作するようです:
[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
これはビデオを撮影し、右側に 2 つのサブスクリーン オーバーレイを配置して、ビデオを時間的に進めた状態を表示します。キャプションの時間を早めるには、setpts=PTS-STARTPTS-n/TB を使用します。ここで、n は時間をシフトする秒数です。これは機能しますが、正直言って理解できません。
いずれにしても、これは n=1 のときに機能します。ビデオをさらに前方にシフトすると、結果として得られるビデオの品質は低下します。たとえば、以下の 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
ffmpegの完全なパラメータは
'-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
オーバーレイ ビデオを遅延させるために setpts を使用しませんでした。代わりに、同じファイルから複数の入力を取得し、一部は -itsoffset で時間シフトしました。パラメータ:
'-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'