read and use index (based on a patch by John Donaghy on the 23-03-2006 '[Ffmpeg-devel...