[FFmpeg-devel] Specifying MOV_TIMESCALE from a command-line switch

Kaplan, John jkaplan2 at pandora.com
Thu May 21 03:41:46 EEST 2020


Hi Guys,

I've just finished a bunch of research on encoding audio .flac files into MP4/AAC using ffmpeg, and we're seeing a detail in the header data that is keeping some audio players from correctly interpreting the metadata in the MP4 elst box.

Long story short, the issue is that MOV_TIMESCALE is hard-coded to 1000, which sets the mvhd box timescale to 1000. The trouble is that in an audio file context, the expected default for that value is the same as the track timescale, which is the sample rate, i.e. usually 44100. That 1000 value seems valid according to the MP4 spec as far as I can tell, but some commercial audio players, including the latest Apple player, don't interpret it correctly and play audio with gaps between those files rather than gapless playback as expected.

We've experimented with setting that variable to 44100 in a local ffmpeg build, and that change is all it takes to change the mvhd box timescale value, and ffmpeg reacts to that by putting the expected values into the elist metadata.

So....
Has anybody proposed a patch to allow people to set that MOV_TIMESCALE variable from the command line?
It seems that would be an easy patch to do and could be used to fix this and numerous other requests for different movie timescales.
I looked for discussion on this and didn't find mention in bugs, but found this thread:
http://www.ffmpeg-archive.org/Quicktime-Specify-a-Movie-Header-timescale-of-24000-tt4683020.html#none
..not sure if this has been discussed elsewhere and I missed it.
I'd be willing to do the work if the team agrees this is a good idea, or if there is another proposal that would have the same result.

Any comments?
Thanks,
John



More information about the ffmpeg-devel mailing list