Ramanujan's continued fraction for ratio of gamma values

Ramanujan mentioned the following continued fraction formula in his famous letter to G. H. Hardy in 1913:

$$\cfrac{4}{x +}\cfrac{1^{2}}{2x +}\cfrac{3^{2}}{2x +}\cdots = \left(\dfrac{\Gamma\left(\dfrac{x + 1}{4}\right)}{\Gamma\left(\dfrac{x + 3}{4}\right)}\right)^{2}\tag{1}$$ The form of the continued fraction is very familiar and I am aware of the standard result corresponding to $x = 1$ namely $$\pi = \cfrac{4}{1 +}\cfrac{1^{2}}{2 +}\cfrac{3^{2}}{2 +}\cdots\tag{2}$$ How do we generalize $(2)$ to get $(1)$?


Just for clarity the notation $$\cfrac{a_{1}}{b_{1}+}\cfrac{a_{2}}{b_{2}+}\cfrac{a_{3}}{b_{3}+}\cdots$$ consumes less space in typing compared to the more cumbersome but easier to understand continued fraction $$\cfrac{a_{1}}{b_{1} + \cfrac{a_{2}}{b_{2} + \cfrac{a_{3}}{b_{3} + \cdots}}}$$


A fairly straightforward approach, that generalizes to $${\raise{-1ex}\mathop{\huge\mathrm{K}}_{n=0}^\infty}\frac{a_2 n^2+a_1 n+a_0}{b_1 n+b_0}$$ (using Gauss' notation), is to consider exponential generating functions of the convergents.

The value of the above CF (if it exists) is $\lim\limits_{n\to\infty}(P_n/Q_n)$, where the vectors $R_n=(P_n,Q_n)$ satisfy $$R_0=(1,0),\quad R_1=(0,1),\quad R_{n+2}=(b_1 n+b_0)R_{n+1}+(a_2 n^2+a_1 n+a_0)R_n,\quad(n\geqslant 0)$$ and we find that the EGF $R(z)=\sum_{n=0}^\infty R_n z^n/n!$ satisfies $$(1-b_1 z-a_2 z^2)R''(z)-\big(b_0+(a_1+a_2)z\big)R'(z)-a_0 R(z)=0,$$ an ODE of hypergeometric $_2F_1$ type (after a linear change of variable).

In our case, $b_0=2x$, $b_1=0$, $a_0=1$, and $a_1=a_2=4$; we suppose $x>0$ is real (for simplicity). Then $$R(z)=C_1\times{}_2F_1\left(\frac12,\frac12;1+\frac{x}{2};\frac12-z\right)+C_2\times\ldots,$$ where "$\ldots$" stands for the second solution of the ODE, which is unbounded at $z\to 1/2$, and $C_1,C_2$ are some constants (which of course depend on $x$, and determined by $R(0)=R_0$ and $R'(0)=R_1$).

Writing $R(z)=\big(P(z),Q(z)\big)$ [recall that $R_n$ are vectors] and assuming that our CF converges (in fact it's not hard to prove) to $f(x)$, we know that $$f(x)=\lim_{z\to 1/2^-}\frac{P(z)}{Q(z)}.$$

This is equal to $A/B$, where $(A,B)=C_2$ is our second "constant". Computing it, we find $$f(x)=\frac{F'(1/2)}{F(1/2)},\qquad F(z)={}_2F_1\left(\frac12,\frac12;1+\frac{x}{2};z\right).$$

The value of $F(1/2)=\Gamma\big((x+1)/4\big)/\Gamma\big((x+3)/4\big)$ can be computed using the integral representation of $_2F_1$ (the substitution $t=x(2-x)$ helps; there is also a known formula). The value of $F'(1/2)$ is obtained similarly, after integration by parts.

Finally, we obtain the CF $(1)$ in the OP as $4/\big(x+f(x)\big)$. This gives the expected result.

An equivalent (and a bit easier) approach is to use the corresponding recurrence for $_2F_1$ instead of the ODE.