Evaluating the elliptic integral $\int_{-\pi}^\pi\frac{dx}{\sqrt{(t-2\cos x)^2-4}}$
I have the following integral,
$$I(t)=\int_{-\pi}^\pi\frac{dx}{\sqrt{(t-2\cos x)^2-4}},$$
where $t>4$ is a real parameter. I know from messing around numerically and playing with Mathematica that
$$I(t)=\frac{4}{t}K\left(\frac{16}{t^2}\right),$$
where $K$ is the complete elliptic integral of the first kind with parameter $m=k^2=16/t^2$. However, I seek proof of that fact. I have tried a handful of changes of variables which didn't get the job done, and I've searched tables of integrals without finding this integrand or similar. Any suggestions or hints would be appreciated.
Here is a rather circuitous route. Maybe there is a more compact way to do this:
$$\require{cancel}\begin{align*} \int_{-\pi}^\pi \frac{\mathrm dx}{\sqrt{(t-2\cos x)^2-4}}&=2\int_0^\pi \frac{\mathrm dx}{\sqrt{(t-2\cos x)^2-4}}\\ &=4\int_0^\infty \frac{\mathrm du}{\sqrt{((t+4)u^2+t)(tu^2+t-4)}} \qquad \small{\left(u=\tan\frac{x}{2}\right)}\\ &=\frac4{\sqrt{t(t+4)}}\int_0^\infty \frac{\mathrm du}{\sqrt{\left(u^2+\frac{t}{t+4}\right)\left(u^2+\frac{t-4}{t}\right)}}\\ &=\frac{4\cancel{\sqrt{t(t+4)}}}{\cancel{\sqrt{t(t+4)}}}\int_0^{\pi/2} \frac{\mathrm dv}{\sqrt{t^2-16+16\sin^2 v}} \quad \small{\left(u=\sqrt{\frac{t}{t+4}}\tan\,v\right)}\\ &=4\int_0^{\pi/2} \frac{\mathrm dv}{\sqrt{t^2-16+16\sin^2 v}}\\ &=4\int_{-\pi/2}^0 \frac{\mathrm dv}{\sqrt{t^2-16+16\sin^2 v}}\qquad\text{(symmetry)}\\ &=4\int_0^{\pi/2} \frac{\mathrm dv}{\sqrt{t^2-16+16\cos^2 v}}=4\int_0^{\pi/2} \frac{\mathrm dv}{\sqrt{t^2-16\sin^2 v}}\\ &=\frac4{t}K\left(\frac{16}{t^2}\right) \end{align*}$$
Since $\cos(-x) = \cos(x)$ we can reduce the integration range to $(0,\pi)$, and then do the change of variable $u = \cos(x)$: $$ \int\limits_{-\pi}^\pi \frac{\mathrm{d} x}{\sqrt{(t-2 \cos(x))^2-4}} = \int_0^\pi \frac{\mathrm{d} x}{\sqrt{\left(\frac{t}{2} - \cos(x)\right)^2 -1}} = \int_{-1}^1 \frac{2 \mathrm{d} u}{\sqrt{1-u^2} \sqrt{4 u^2 + 4 u t + t^2-4}} $$ Now perform a change of variables: $$ u = \frac{v-z}{1- v z}, \qquad \text{where} \quad v = \frac{t - \sqrt{t^2-16}}{4} $$ that maps $-1<u<1$ into $-1<z<1$, that leads to $$ \int_{-1}^1 \frac{ v \, \mathrm{d} z}{\sqrt{1-z^2} \sqrt{1-v^4 z^2}} = 2 v \cdot \mathrm{K}\left( v^4\right) $$ This is not exactly what the OP asked for, but quite elegant nonetheless.
Here is a confirmation of the equivalence in Mathematica:
Added:
The equivalence of the above answer to the one conjectured by OP and established by @J.M. is through the quadratic transformation: $$ \mathrm{K}(z) = \frac{2}{1+\sqrt{1-z}} \mathrm{K} \left( \left(\frac{1-\sqrt{1-z}}{1+\sqrt{1-z}} \right)^2 \right) $$ where $z = \frac{16}{t^2}$. Indeed: $$ \frac{2}{1+\sqrt{1-\frac{16}{t^2}}} = \frac{2t}{t + \sqrt{t^2-16}} = \frac{2t}{t + \sqrt{t^2-16}} \cdot \frac{t - \sqrt{t^2-16}}{t - \sqrt{t^2-16}} = \frac{t}{4} \cdot \frac{t-\sqrt{t^2-16}}{2} $$ and similarly: $$ \left(\frac{1-\sqrt{1-\frac{16}{t^2}}}{1+\sqrt{1-\frac{16}{t^2}}} \right)^2 = \left(\frac{t-\sqrt{t^2-16}}{t+\sqrt{t^2-16}} \cdot \color\green{ \frac{t-\sqrt{t^2-16}}{t-\sqrt{t^2-16}} } \right)^2 = \left(\frac{\left(t-\sqrt{t^2-16}\right)^2}{16} \right)^2 $$ Combining, we arrive at the equality: $$ \frac{4}{t} \mathrm{K}\left(\frac{16}{t^2}\right) = \frac{t-\sqrt{t^2-16}}{2} \mathrm{K}\left(\left( \frac{t-\sqrt{t^2-16}}{4} \right)^4\right) $$