The apparatus includes a driving shaft (21) with a first gear wheel (22), a frame (23) able to rotate within limits about the driving shaft, a servo mechanism or similar means for controlling the angular position of the frame, a valve-lifting crankshaft (25) with a second gear wheel (24) supported by the frame, a rocker cam assembly (29), a connecting rod (27) pivotally connected to the valve-lifting crankshaft and the rocker cam assembly, a cam follower (32) operatively connected to a charge exchange valve (35), and a spring or similar means (33) for urging the cam follower against a cam lobe. The engine rotates the driving shaft. The first gear wheel rotates the second gearwheel and the valve-lifting crankshaft. The connecting rod transmits motion from the valve-lifting crankshaft to the rocker cam assembly. Stroke, lifting duration, and phase can be controlled by the angular position of the frame.