On Youtube I have seen a lot of videos like this with car accidents in Russia recorded by in-car cameras (dashcams). Is it legal to use such a device in Germany? If an accident happens, can I use the video as a proof?
This device is legal as long as you do not publish the video. In case you want to, you need to pixelate license plates and faces. Also you are not allowed to have a specific person "in focus", meaning: You are not allowed to sit in the car and point it at specific people. Regarding your comment, having a camera in there that does not record is perfectly fine, no need to remove it.
You can present the camera in Germany in case there is an accident but the validity of the video as a proof has to be decided by the judge. So while there is no guarantee, the chances are high of course that this will help you a lot.
Be careful though: If the police takes the camera as a proof and finds you crossing red lights earlier in the video, they can take that as a proof to get you in return.
Owning a dashcam is legal in Germany. Operating a dashcam the way most are designed is highly problematic although prosecution may not be likely. The applicable rule is a general one that theoretically allows fines up to € 300,000. source (I guess this just means that in the worst case you may be charged close to € 1000, although even that would probably be considered wildly out of proportion by most courts - for ordinary cases, that is.) Similar problems hold for wildlife cameras in publicly accessible areas (even if it's your own property) unless you post warning signs. source (Most cam operators don't want to do this because of the increased theft risk.) The evidence from an illegally used dashcam will usually be thrown out in court, although admissibility rules in Germany are notoriously flexible and it will depend in part on the severity of what is recorded: If the recording proves that someone did or did not commit murder, it will likely be deemed admissible. If it just proves whose fault a minor traffic accident was, it will likely be excluded. source
The normal legal problem with dashcams and wildlife cams is the systematic, indiscriminate recording of everything, which may happen to include people going about their daily lives.
If you just turn the camera on manually to record a specific event (accident or beautiful view), you are essentially on safe ground. If this is automated by the camera (last seconds are written only when the camera detects a crash) you also have a good chance it will be considered legal and usable in court. source But note that even taking a photograph with an ordinary camera of someone illegally walking his dog to document this offence has been deemed illegal in one case. source
As the OP suspected, this legal situation is probably why there is plenty of dashcam footage on Youtube from the US, from Russia and from the UK, but next to none from Germany. It is not just that most footage can't be published because that would infringe on the rights of any person seen in it. The systematic production of such footage itself as in these other countries is generally considered illegal by the German courts.
Note: What I wrote is based on general knowledge and previous informal research. On request I added some sources (in German, for obvious reasons) that confirm the gist of what I wrote but not necessarily every detail.