The structure and dehydration mechanism of the proton conducting oxide Ba$_{2}$In$_{2}$O$_{5}$(H$_{2}$O)$_{x}$ are investigated by means of variable temperature Raman spectroscopy together with inelastic neutron scattering. At room temperature, Ba$_{2}$In$_{2}$O$_{5}$(H$_{2}$O)$_{x}$ is found to be fully hydrated ($x=1$) and to have a perovskite-like structure, which dehydrates gradually with increasing temperature and at around 600 $^{circ}$C the material is essentially completely dehydrated ($x=0$). The dehydrated material exhibits a brownmillerite structure, which is featured by alternating layers of InO$_{6}$ octahedra and InO$_{4}$ tetrahedra. The transition from a perovskite-like to a brownmillerite-like structure is featured by a hydrated-to-intermediate phase transition at $ca.$ 370 {deg}C. The structure of the intermediate phase is similar to the structure of the fully dehydrated material, but with the difference that it exhibits a non-centrosymmetric distortion of the InO$_{6}$ octahedra not present in the latter. For temperatures below the hydrated-to-intermediate phase transition, dehydration is featured by the release of protons confined to the layers of InO$_{4}$ tetrahedra, whereas above the transition also protons bound to oxygens of the layers of InO$_{6}$ are released. Finally, we found that the O-H stretch region of the vibrational spectra is not consistent with a single-phase spectrum, but is in agreement with the superposition of spectra associated with two different proton configurations. The relative contributions of the two proton configurations depend on how the sample is hydrated.