[FFmpeg-devel] [PATCH] Increase MOV_TIMESCALE for higher precision

Jan Ekström jeebjp at gmail.com
Wed Mar 24 12:15:11 EET 2021


On Wed, Mar 24, 2021 at 7:30 AM Gyan Doshi <ffmpeg at gyani.pro> wrote:
>
>
>
> On 2021-03-24 03:38, Andrey Rikunov wrote:
> > ---
> >   libavformat/movenc.h | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavformat/movenc.h b/libavformat/movenc.h
> > index cdbc407..8a152c0 100644
> > --- a/libavformat/movenc.h
> > +++ b/libavformat/movenc.h
> > @@ -29,7 +29,7 @@
> >
> >   #define MOV_FRAG_INFO_ALLOC_INCREMENT 64
> >   #define MOV_INDEX_CLUSTER_SIZE 1024
> > -#define MOV_TIMESCALE 1000
> > +#define MOV_TIMESCALE 60000
>
> Instead of hardcoding it, add an option to allow the user to set it.

I think if the "Mov requires timescale 1000" assumption is no longer
correct, it should be removed and the generic time base based
timescale generation utilized instead, which is utilized for
MP4-likes. That way by setting time base one can affect it with the
standard option.

For the general logic (for MP4- likes), I am planning on getting rid
of the video time scale option in the following steps:
1. Figure out what the historical reasons for having a video time
scale of over 10k are (I think it was mostly to adjust A/V sync with
more granularity than frame rate - but we have edit lists for that
now?).
2. If those still hold, make a "auto_adjust_timescale" boolean, which
would first be on by default.
3. Make video_timescale disable the auto-adjustment of video
timescale, and set the time base earlier in the muxer logic (since
muxers are allowed to override the AVStreams' time base).
4. Deprecate video_timescale and point people towards
-auto_adjust_timescale false/0 -time_base:v "1:NUMBER"

I have seen people add various timescale related options to movenc in
their trees for audio/subtitles just because it's not clear that we
already have time_base :s . Thus this just needs to be cleaned up. And
if MOV still needs its timescale override of 1:1000 for some
compatibility reasons (?) then "auto_adjust_timescale" can also poke
at that.

Jan


More information about the ffmpeg-devel mailing list