The Prime Minister unveiled a pilot scheme involving YouTube and Vevo as he gave details of his own struggle to prevent his son and two daughters watching inappropriate material.
Concerns have been growing for years about the kind of footage freely available to young children online. Examples of videos that have caused alarm include Miley Cyrus's Wrecking Ball, which shows her suggestively licking a sledgehammer, and sexual images in Robin Thicke's Blurred Lines.
Under the arrangements being tested from October, record labels will submit videos thought likely to attract a 12 rating or above to the British Board of Film Classification (BBFC). Sites such as YouTube will then display the ratings, and they could potentially be used by filtering software to enable parents to block unsuitable clips.
Delivering a speech in central London, Mr Cameron said: "From October, we're going to help parents protect their children from some of the graphic content in online music videos by working with the BBFC, Vevo and YouTube to pilot the age rating of these videos. In as far as possible we should try to make sure that the rules that exist offline should exist online. So if you want to go and buy a music video offline there are age restrictions on it. We should try to recreate that system on the internet."
Asked about his own experiences with Nancy, 10, Elwen, eight, and three-year-old Florence, Mr Cameron said: "As for my own children, I am sure there are times when they have been disappointed because they haven't been able to do something or see something.
"But that is part of what being a parent is about, is being able to deploy the use of the word 'no' and even sometimes to deploy the use of the off switch on the television, as unpopular as that might be, and sometimes ineffectual because they find another screen somewhere that is switched on."