My son's legs shake like this during sleep (which I discovered during a sleepless night when I shared a small tent with him on a boy scout camp out when he was about 13). At the time, I thought he was being hyper in his sleep, because he has ADHD. Later, at age 20, he was diagnosed with restless legs syndrome during a sleep study medical test.
He frequently shakes one of his legs while awake, to the point that we'll ask him to stop, because he's shaking the table, church pew, etc. (either leg, but usually just one at a time). He doesn't even realize he's doing it until we point it out, and then he can only stop while he's thinking about it, and resume shaking when his mind drifts. Before he got the restless legs diagnosis, I thought this was due to him channeling his hyperactivity into a smaller area of his body, instead of bouncing all over the room like he did as a young boy., kind of like a pinball. ;)
It would be good to have it checked by a neurologist to rule out more serious causes and to see if anything might help the situation. It might be affecting the quality of his sleep, which could be exacerbating the hyperactivity. It seems that being tired would slow these kids down, but instead, it seems to make them lose what little impulse control that have.