0

I am trying to overlay a subclip from one video (Ov) onto another main video (M) using FFmpeg.

The overlay pipeline is:

Extract a subclip from Ov

Scale it

Overlay it onto M between timestamps t1 and t2 using filter_complex

Video properties Overlay video (Ov)

25 fps

H.264 + AAC

Subclip starts at non-zero timestamps:

audio: 0.056s

video: 0.080s

Main video (M)

29.97 fps

H.264 + AAC

The problem

The exact duration I need from Ov is 13.028s, but FFmpeg always extracts 13.06s instead.

When I overlay this subclip onto the main video:

The overlay video does not play

Only the last frame from Ov appears for the full duration

When testing with another main video (23.97 fps):

The main video freezes on its first frame during the overlay period

The overlay video never appears

What I have already tried

Using

gte(t, t1)

instead of between(t, t1, t2)

Re-transcoding both M and Ov

Forcing timestamps:

-fflags +genpts

-avoid_negative_ts make_zero

-reset_timestamps 1

Testing both:

-ss before -i (fast seek)

-ss after -i (accurate seek)

None of these fix the frozen-frame behavior.

My suspicion

Either:

The FPS mismatch (25 → 29.97), or

The non-zero starting timestamps (0.056s audio / 0.080s video)

is causing FFmpeg to misalign timestamps when doing the overlay, resulting in the frozen frame.

Question

What is the correct way to extract a subclip and overlay it onto a main video without getting frozen frames when the input videos have different FPS and non-zero starting timestamps?

How can I ensure:

the subclip duration is frame-accurate, and

the overlay plays smoothly for the whole overlay interval?

1
  • Rerun the command with -report and share report. Commented Nov 21 at 4:26

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.