A Venezuelan opposition leader, Leopoldo Lopez, has handed himself over to the National Guard after holding a speech to thousands of his supporters.