Move video writer in another thread
Some improvements for video writing