complex_filter를 사용하여 비디오를 타임시프트할 때 비디오 품질이 좋지 않음

complex_filter를 사용하여 비디오를 타임시프트할 때 비디오 품질이 좋지 않음

작동하는 복잡한 필터를 사용하고 있는데 조금만 변경하면 결과 품질이 나빠집니다. 이 버전은 잘 작동하는 것 같습니다.

[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

이는 비디오를 촬영한 다음 오른쪽에 두 개의 하위 화면 오버레이를 배치하여 비디오가 시간에 따라 앞으로 이동하는 것을 보여줍니다. 캡션의 시간을 앞으로 설정하려면 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'

관련 정보