do the M-JPEG magic ourselves
now with more locks
removed extra newline