For the railway wireless monitoring system, energy efficiency is important for prolonging the system lifetime and ensuring the successful transmission of the inspection data. In general, decreasing the size of the data packet is conductive to declining the transmission energy consumption. Hence, the inspection data packets should be processed before being transmitted. However, the energy consumption of data processing may also be considerable, especially for the vision-based monitoring system. Therefore, we propose an optimization methodology to address the trade-off of the energy usage between data processing and transmission in railway wireless monitoring systems. In addition, the various data types and transmission distances of the sensors may cause the unbalanced energy consumption, and it will shorten the system lifetime due to the failure of some sensors. To address this challenge, in our proposed optimization framework, we adopt customized compression ratios for each sensor to balance its energy consumption. On this basis, the system lifetime can be extended by minimizing and balancing the energy consumption simultaneously. Finally, we use several generalized numerical examples to demonstrate the superiority and practicality of the proposed strategy. Compared to previous methods in the literature, our proposed approach can increase service lifetime of wireless monitoring systems using equal and less energy.