Timeline to BPM ? (23.08.4)


Is there a way to make the timeline show BPM bars, instead of frames or time?

Example: Let’s say I have a song with 120 BPM tempo, so I set via some sort of dialog box the tempo being “120.0” and all the bars in the timeline are reset to match the new tempo set.

The point of this is that I can synchronize a video to a given tempo, thus it will look more like a music video, because let’s say I have 10 video clips, which will change in full sync with the song beat. Currently I am doing this manually, but it is not 100% in sync.

I am using Kdenlive 23.08.4 on Lubuntu.


This is an interesting idea. So far everything is connected to video frame-rate as the shortest possible time slice.

If we would change it to make audio BPM or audio sample rate as the leading time slice, yes then the video could be adjusted more precisely to the audio.

I don’t know if this is technically possible as the whole work chain is aligned to video frame-rate as time slice.

Maybe an audio software in which you could adjust the video to the audio would be more suitable for this task. But I don’t know if such audio software could render out the video …

Hm. I thought it would be just a matter of re-drawing the bars differently on the timeline as a quick solution. No need to modify the rest of the code. I mean - it appears just a visual cosmetic change to me - or is it more complex?

Because honestly, if you just give me visual marks, I could manually adjust the video. No need to snap the audio to the new bars (which normally would be a nice idea).

There’s two separate but related issues you need Solved for this.

One is putting ticks on the timeline at arbitrary BPM (or whatever else) intervals.
The current “workaround” method for getting something like that is to create a CSV file with the timestamps of where you want marks, then import them as guides. It’s a bit messy if you’re only using a few of them, but things will snap to them :slight_smile: This will work so long as your beat interval is a multiple of the frame duration. There’s some discussion on that here: Beat detection, change video on audio beat

The other one is aligning the actual beats in your audio file to those marks - since you can only align the start of your audio clip to a frame boundary. (For 30fps video, having your beats hit with an error of up to 15ms off cue is going to be notably jarring). There’s some discussion about that here: Feedback from a beginner, climbing the learning curve

And there’s a third issue where if the beats in your audio are generated by a human playing rather than a sequencer, then over a long enough interval even a tight player is going to deviate from your perfectly marked timing … so now we need a beat detection filter, and arbitrarily spaced marks, too :slight_smile:

But all of these would be lovely things to have on the roadmap and to have someone with the right combination of itch and skill working on. But it might also need work in mlt to make all of it possible.

1 Like

Oh no no! Absolutely - when a human plays it is never 100% accurate so I was talking about a mathematically generated BPM marks, based on a certain BPM value. Just like a metronome will automatically tick, based on what BPM we chose.

Thanks. I will take a look at the workarounds now.

Hi there!

I’m a vtuber musician, and I think I could add a bit of insight to this.

My workflow generally is that I’ll produce my music in Ardour, and then I’ll bring it into either Kdenlive or OpenShot to edit the video to match the music. Neither video editor has this feature, so what I tend to have to do is find the exact timestamp of the beat in Ardour, and then go into the video editor and align the clip (in my case, usually just a still image) to that exact timestamp. Needless to say, this is very tedious, and any improvement would be greatly appreciated.

One thing that was brought up was implementing beat detection. From what I understand, this is very difficult to implement properly, though you would know better than I would on that matter. However, in my experience, even when implemented properly, beat detection is very unreliable, especially when strong transients land on weak beats such as is the case with syncopated rhythms or tuplets, or when the note played on the beat doesn’t have a strong transient, such as a synth pad with a longer attack.

However, Ardour doesn’t solve the problem of wavering natural BPM with beat detection, but with Tempo markers: The Ardour Manual - Tempo
Essentially, the tempo can by manually warped to match the beat of the audio.

Still, most of the music I make is done by setting the tempo in Ardour to a particular set tempo and leaving it there for the entirely. From what I’ve noticed, a lot of music is made this way, and I would posit that for a single, straightforward, simple tempo setting would be good enough for most use cases. Certainly far better than what’s available at the moment.

And yes, the audio being 15ms off cue could probably be a problem, but I just mute the audio of the clip and rely on editing the audio in Ardour anyways.

Thanks, and I hope this helps!

Hi NiiCola, these are all great points, thanks for sharing them!

I totally agree that for anything more subtle than your poster-child doof, and even then, which beat (or transient, or hole) to sync a video transition to, very much depends on Feeling the mood of both the music and the video content. And not just when to start a transition, but exactly how long that transition should be, because a hard cut isn’t always what’s wanted either.

I like the idea of having something like Ardour’s tempo markers - and that could fairly easily be implemented with a “guide wizard” that creates guides between some start and end time, with either a fixed or transitioning spacing.

What I’ve been doing in practice so far is even cruder and blurrier than all this - I find the Right Point in the music for a transition in the window I have for making one by listening to it. Then I try to find the center of that point by zooming in on the audio waveform in the timeline, and listening again (sometimes repeatedly!) to find the frame boundary closest to it. Sometimes there is a visual peak at that point, sometimes there isn’t. Then I align around that, watch it, and tweak until I Like It.

For me it’s a multi-dimensional fuzz, because usually I’m not just changing some picture in time with the music, I’m aligning the music to the action in the video (which isn’t always a video transition either) - so occasionally it also means gentle time remapping of the video to move something a couple of frames earlier or later to get it all to align how I’d like it. And that’s before I start on How To Decide whether some visual transition or action will be most pleasing if it leads the beat, or lags it …

The off-cue problem can be even worse in practice though - because unless you have total control of the player software too, all your hard work to link something in the video to the perfect point in the music can go straight out the window, when the audio pipeline on the machine playing it adds a 200ms delay to when the decoder said that track should be played …

1 Like