First more or less working version to sync video and data