Is doing this in another thread absolutely required? It adds complications and requires exclusive access to shared data to protect against race conditions. e.g. FfmpegCamera::Capture() starts the ffmpeg reopen thread and returns because reading packet failed. In the meanwhile, the new thread is reopening ffmpeg. What happens if zm's main thread is calling Ffmpeg::Capture() while the other thread is busy reopening ffmpeg? It can happen if reopening ffmpeg takes too long. Without proper care, race conditions can occur and they are difficult to debug.