car shakes when idle and accelerating

My car shakes occasionally (when idle and accelerating). Every once in a while when I turn my car on it starts shaking and when I start driving, it is as if the car lost half of its acceleration power. Sometimes the idling starts in the middle of the highway at high speeds and other times its right when I start my car.

It accelerates really slow (while slightly shaking). Sometimes I pull the car aside and turn off and start the car 3-4 times and the engine somehow works itself out. I think there is a problem with one of the pistons. A few times the shaking did not stop itself so the car start

– car shakes when idle and accelerating