In case anyone cares about the context - these patches were previously a part of the muxer-threading set, but I've decided to factor them out and reshuffle them. do_video_stats() is now kept close to the encoder rather than being moved to the muxing code. -- Anton Khirnov