The valve mechanism has a camshaft (11) which is rotated in dependence on the rotary force provided by the engine crankshaft. A shaft bearing element (14) around the outside of the camshaft and a second parallel shaft (12), with operating cams (6) are provided for inlet and outlet valves (2). An intermediate rotary element (16) with a variable rotation rate is provided between the two shaft elements and is supported by the shaft bearing element. An eccentric bearing for the rotation axis of the camshaft is provided, with an operating element controlled in dependence on the engine revs, for adjusting the position of the bearing section (15) for the intermediate rotary element.