1

I have a video with variable framerate that I decode into single frames using -vsync passthrough to avoid duplicate/lost frames. After processing those frames with another application I want to encode them again into an mp4 video that has the exact same timestamps as the original video.

My idea is to input the frames plus the original video and use the timecodes of the latter. Is this possible?

This is my current approach:

ffmpeg -i input/%d.jpg -vsync 0 -i input.mov  \
    -filter_complex '[0]setpts=PTS[vid1];[vid1]pad=iw*2:ih[vid2];[vid2][1:v]overlay=W/2:0[vid3]' \
    -map [vid3] -map 1:a \
    -y result.mp4

I do a concatenation of both videos side-by-side to see if they are in sync which they are not...

setpts=PTS uses the timecodes of the frames so this can not work. However, is there a way of using PTS from the second video? Something like [0]setpts=PTS{1:v:0}?

Tuxa
  • 71
  • 2
  • 1
    You can do this in two steps. For step 1, see https://superuser.com/q/1126667/ for step 2, see https://stackoverflow.com/q/28086775/ – Gyan Aug 20 '20 at 18:30
  • Works like charm. Thank you very much!!! – Tuxa Aug 21 '20 at 08:31

0 Answers0