I'm an Iranian student who did his Bachelor's in Italy in cinema. Now I want to do my Master's in another country in Europe, like Germany. Does anyone know if I would need to go back to Iran and ask for a German student visa? Or, considering that right now I'm in Europe (holding a permit of stay), can I go straight to the university to apply?
Applying to the university to accept you as a student and applying for a visa are different things. You can use your Italian permit to travel to Germany and apply for admission. If the university accepts you, you will need to apply for a German residence permit, which may require a visa beforehand. If it does, you may be able to apply in Italy, but I am not certain.
You should be able to apply for a visa wherever you live, even if you're not its citizen. The German consulate would likely not reject your application just because you are not an Italian citizen. You're still an Italian resident anyways. Though you'd better check with the consulate to make sure of this, e.g. no special restrictions apply for your nationality etc.