1

I have three videos that I am trying to sync so I can setup a multi-camera editing project (I'm using Vegas Pro)

Two are at 29.97fps and one is at 30fps. If I manually sync them all at the start, by the end of the clip, the 30fps video has drifted slightly out of sync.

I've tried a few different things (manually dropping the odd frame and resyncing the clips, compressing the time of the clip so it syncs up at the end). These work, but they require quite a bit of work when editing lots of clips, so I'm looking for a way to streamline my workflow.

I've been fiddling with ffmpeg to find a simple command to convert the 30fps footage to 29.97 (I was hoping it would be possible without re-encoding it).

I've tried a few things including:

ffmpeg -i <input> -filter:v fps=29.97 <output>

But that doesn't change the audio or overall time of the video, so the audio still drifts out of sync.

Is someone able to help me identify what the correct ffmpeg command would be to convert the video so that it syncs with my other tracks?

(As an aside, the reason I've ended up in this mess is that I'm using iPads and iPhones for the footage. Every iOS device I've used produces video at 29.97 fps, except for one of the iPads which always produces video at 30fps. I have no idea why as it's the same model and running the same version of iOS, but for some reason, it's different from every other device and no amount of fiddling with the settings seems to change it)

1 Answer 1

0

I always prefer to use more precise framerate values in my calculations: 29.97 is 30000/1001.

Your command (ffmpeg -i <input> -filter:v fps=29.97 <output>) changes the amount of frames per second but the presentation time stamps (PTS) remain the same and that is the reason why duration of the video does not change. You need to change PTS as well:

-vf "setpts=PTS*((30000/1001)/30),fps=30000/1001"

Audio needs a separate filter:

-af "atempo=(30/(30000/1001))"

The command to change your video framerate from 30 to 29.97 should look like this:

ffmpeg -i input.mp4 -vf "setpts=PTS*((30000/1001)/30),fps=30000/1001" -af "atempo=(30/(30000/1001))" output.mp4
3
  • Thanks so much! This has got me on the right lines. It still doesn't quite line up, but it is shorter. I need to do a bit of fiddling to work out why this hasn't worked for my videos, but it looks like it's got me on the right tracks
    – Simon
    Commented Feb 16, 2022 at 13:00
  • @Simon "It still doesn't quite line up" - maybe your hardware use some other value than 30000/1001 for 29.97? You can try to re-encode your videos to make them all use some natural number as the framerate (instead of the fraction) to see if that helps.
    – Lex
    Commented Feb 16, 2022 at 13:19
  • Yeah, that's what I thought. I'll do some experiments and figure it out - but those commands were the ones I was missing! Thanks very much.
    – Simon
    Commented Feb 16, 2022 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.