This is an animated film (fairy tale or fantasy).
I vaguely remember two scenes. And I’m not even sure if they are part of the same movie.
The first scene is at the beginning of the film.
It tells about a family living in the forest. They starve, and when they have no food left, the father and mother go into the forest, leaving the last food for their children. One or two children, I don’t remember exactly.
A little later, the children leave the house and meet magical creatures and get a job.
The second scene is towards the end of the film.
One of the main characters works as a scientist in some island city. For some reason, a catastrophe has to happen (it seems like a big explosion). And this character somehow saves everyone, sacrificing himself.