In high-speed rail networks, trains are operated with high speeds and high frequencies, which can satisfy passenger demand with different expected departure times. Given time-dependent demand, this paper proposes a line planning approach with capacity constraints for high-speed rail networks. In this paper, a bilevel optimization model is formulated and the constraints include track section capacity per unit time, train seat capacity, and the gap between the number of starting trains and that of ending trains at a station. In the upper level, the objective is to minimize train operational cost and passenger travel cost, and the decision variables include the line of each train, carriage composition of each train, train stop patterns, train start times, and train arrival and departure times at stops in the line plan. In the lower level, a schedule-based passenger assignment method, which assigns time-varying demand on trains with seat capacity constraints by simulating the ticket-booking process, is used to evaluate the line plan obtained in the upper level. A simulated annealing algorithm is developed to solve the model in which some strategies are designed to search for neighborhood solutions, including reducing train carriages, deleting trains, adding trains, increasing train carriages, and adjusting train start times. Finally, an application to the Chinese high-speed rail network is presented. The numerical results show that (i) the average time deviations between the expected departure times and the actual boarding times of passengers are within 30 min, (ii) the unserved passengers are less than 200, and (iii) the average load factors of trains are about 70%. Hence, line plan solutions meet time-dependent demand well and satisfy the capacity constraints for high-speed rail networks.