4

A very annoying situation...
I have an MPG2 video that is at the framerate of 29.97, yet when converting to MP4 frames are duplicated.

That command (straight conversion, no options):
ffmpeg -i ~/Desktop/file.mpg ~/Desktop/file.mp4
causes duplicated frames...

While setting the framerate with:
ffmpeg -i ~/Desktop/file.mpg -framerate 29.97 ~/Desktop/file.mp4
Doesn't work either!

Leading me to try:
ffmpeg -i ~/Desktop/file.mpg -r 29.97 ~/Desktop/file.mp4
Still with duplicated frames!

Finally I tried ffmpeg's 3rd framerate option!:
ffmpeg -i ~/Desktop/file.mpg -vf fps=fps=29.97 ~/Desktop/file.mp4

Except, when it outputted, the audio/video was out of sync!

Which FPS option should I use?

2 Answers2

2

Use

ffmpeg -i ~/Desktop/file.mpg -vsync 0 ~/Desktop/file.mp4

This skips duplication.

-vsync passthrough is synonymous with -vsync 0.

Gyan
  • 38,955
1

-vsync is deprecated now, so you should use -fps_mode instead.

By default, the fps_mode is auto, so it may change your fps automatically. For example, the original source is variable frame rate, but ffmpeg may decide to change it to constant frame rate automatically, which may result in duplicated and dropped frames.

To prevent any fps change, set -fps_mode passthrough. (It's the same as -vsync 0 or -vsync passthrough).

For more info, see ffmpeg documentation.

ffmpeg -i ~/Desktop/file.mpg -fps_mode passthrough ~/Desktop/file.mp4
wisbucky
  • 3,346