It is well know that (in the sense having the same image not parametrization) the extremal curves of the energy functional on a Riemanian manifold $(M,g)$: $E[\gamma(t)] = \int g_{\gamma(t)}(\dot{\gamma}(t), \dot{\gamma}(t)) dt$ are the same as the length functional: $L[\gamma(t)] = \int \sqrt{g_{\gamma(t)}(\dot{\gamma}(t), \dot{\gamma}(t))}dt$.
Is there a more general way to see which functions $F: \mathbb{R} \rightarrow \mathbb{R}$ preserve the extremal curves of a Lagrangian on $M$. I.e. $\mathcal{L} \in C^{\infty}(TM)$? I mean $F$ such that: $S[\gamma(t)] = \int \mathcal{L}(\gamma(t), \dot{\gamma}(t)) dt$ has the same extremal curves as: $\hat{S}[\gamma(t)] = \int F(\mathcal{L}(\gamma(t), \dot{\gamma}(t))) dt$.
Is it known which $F$ would preserve the geodesics of a Finsler metric specifically?