[FFmpeg-user] Is there a reason the default vsync for the mp4 muxer is not 2?
andre at webkr.de
Wed May 23 16:39:00 EEST 2018
I was re-encoding a video with:
ffmpeg -i in.mp4 -c:v libx264 -movflags faststart -crf 30 out.mp4
and surprisingly the output file was much larger (9 MB) than the input file
(3 MB). I examined the files with:
ffprobe -show_entries frame=pict_type,pkt_size -of csv in.mp4
and I noticed that the output file just had many more frames. This is
confirmed by the fact that it says "dup=140" in the encoding log.
So I checked the presentation timestamps (pkt_pts_time) in the output file.
As you can see, they are completely off. I added -vsync 2 to the command
line options and I got a file that has roughly the same number of frames as
the input. I think this would make much more sense as a default. The
documentation says about the default for vsync:
> Chooses between 1 and 2 depending on muxer capabilities.
So first question: Is there a reason why the mp4 muxer cannot choose vsync
However, even with vsync 2 the timestamps were still slightly off, in fact
they looked somehow quantized:
I was finally able to fix this with -enc_time_base -1. So same question: Any
reason to not have this as the default?
By the way, I tried one more thing. I thought maybe it will choose vsync 2
automatically *if* enc_time_base is -1 (because otherwise it works with
timestamps quantized to some arbitrary constant frame rate anyway and the
value of vsync doesn't matter much). So I tried *only* giving -enc_time_base
-1 and no -vsync. This led to:
[mp4 @ 0000000003ecd040] Frame rate very high for a muxer not efficiently
Please consider specifying a lower framerate, a different muxer or -vsync 2
More than 1000 frames duplicated
Thank you FFmpeg, I will consider it. Why not make it the default. :)
More information about the ffmpeg-user