The German student visa has an initial validity of 3 months, during which you will be required to convert it to a residence permit. With a residence permit, you can reside and study in Germany for up to 1-2 years, which can be extended based on the study program.