You speak of an equation. So is the exact shape of the waves important to match with that equation, or will almost any curve do?
I do not believe that the exact shape of the curve is important (by the way, this is an effect of momentum, not gravity). I didn't bother trying to set up any equations, but used a simple visualization to understand the results.
First, simplify the curvy path to a single curve. Second, replace the flat path with the inverse curve. Think of taking a square of wood and using a jigsaw to cut out a deep, concave curve from corner to opposite corner. Flip over the remaining piece to have a convex corner piece.
Draw a pencil line at the midpoint of each curve and compare what happens to the marble in each path. For the falling part, the first half of the concave path and the second half of the convex path, the time to traverse can be considered approximately equal. For the flatter section, however, on the convex curve, the marble starts at zero velocity and only slowly accelerates to the midpoint. For the concave path, the marble is traveling at a fast velocity at the midpoint and carries that velocity through the flatter portion. Thus, the second half of the concave path is traveled more swiftly than the first half of the convex path.
The quick extrapolation to the flat path in the video is to view the flat path as the transition point between convex and concave. If that doesn't quite work, instead, visualize cutting shallower and shallower curves. As the curve gets closer to the flat path, the velocity at the midpoint is reduced and the overall end-to-end time increases.
To restore the multiple curves in the original, simply divide the path creating a series of concave paths racing a series of flat paths. In isolation, each concave path is faster than each flat path. When put together, the concave paths have the advantage of carrying higher velocity into the start of each section.