[FFmpeg-user] Reading Tempo/BPM information from audio files

Moritz Barsnick barsnick at gmx.net
Tue Sep 18 15:50:43 EEST 2018


On Tue, Sep 18, 2018 at 09:59:03 +0200, Moritz Barsnick wrote:
> On Mon, Sep 17, 2018 at 15:19:50 +0100, Adam Harries wrote:
> > After some more digging, it seems that I need to set some options while
> > decoding a mov file - at least from reading
> > https://ffmpeg.org/doxygen/trunk/mov_8c_source.html
> > 
> > How would I go about doing this? I'm happy to build a new application based
> > on libavformat, but I'm not sure how to interface with it cleanly.
> 
> As far as I can tell from a quick glance, MP4/M4A stores the BPM number
> in the "tmpo" atom. libavformat/movenc.c has the capability to *write*
> this atom (I'm not sure ffmpeg makes any effort to convert "BPM" to
> "tmpo" anywhere though), but I don't see any code for *reading* the
> atom. I may misunderstand the way the MOV demuxer works though...
> 
> With some code fiddling, I managed to make libavformat/mov.c recognize
> the atom (mov_read_udta_string()), but didn't manage to decode it (with
> the very little effort I put into it).

Actually, I was able to modify ffmpeg (or rather libavformat) to be
able to understand the "tmpo" atom, but I'm not sure to which "key" to
map it ("tmpo", "bpm", "BPM", "TBPM", and whether its key needs to be
remapped when conveying the metadata to another output format.

Moritz

P.S.: 2 BPM seems quite slow for Count Basie's music! What do other
tool report the tag as containing?


More information about the ffmpeg-user mailing list