patched for FFMPEG 1.0 and support for duration < 0