private void InitVideoCapture()
 {
     try {
         cam = new VideoCapture(
             config.Video.CaptureDeviceNumber,
             config.Video.InputFrameRate,
             config.Video.InputWidth,
             config.Video.InputHeight);
     } catch (Exception ex) {
         throw new Exception("Video capture settings don't work (if you don't want video, remember to set the video capture to (none) in the config tool)", ex);
     }
 }
 public void Dispose()
 {
     if (mic != null) {
         mic.Pause();
         mic.Dispose();
         mic = null;
     }
     if (cam != null) {
         cam.Pause();
         cam.Dispose();
         cam = null;
     }
     if (EncoderRunning) Stop();
     if (coreloops != null) {
         foreach (var loop in coreloops) {
             if (loop == null) continue;
             loop.Join();
         }
         coreloops.Clear();
     }
 }