@SuppressWarnings("unchecked")
	public void init() throws Exception {
		RecorderServlet.recording = Boolean.parseBoolean(server.prop
				.getProperty("homecam.Capturer.recording"));
		RecorderServlet.maxRecord = Integer.parseInt(server.prop
				.getProperty("homecam.Capturer.maxRecord"));
		RecorderServlet.recordedDirectory = server.prop
				.getProperty("homecam.Capturer.recordedDirectory");
		RecorderServlet.houseKeepDay = Integer.parseInt(server.prop
				.getProperty("homecam.Capturer.houseKeepDay"));
		Capturer.capturerTimeout = Integer.parseInt(server.prop
				.getProperty("homecam.Capturer.capturerTimeout"));
		Capturer.capturerSoftTimeout = Integer.parseInt(server.prop
				.getProperty("homecam.Capturer.capturerSoftTimeout"));
		CapturerImage.outputFormat = server.prop
				.getProperty("homecam.Capturer.outputFormat");
		Capturer.resolutions = new LinkedList<Resolution>();
		String[] strRess = server.prop.getProperty(
				"homecam.Capturer.outputResolution").split(",");
		for (String strRes : strRess) {
			Capturer.resolutions.add(new Resolution(strRes));
		}
		outputMime = server.prop.getProperty("homecam.Capturer.outputMime");
		String[] excludedCaptureDevice = server.prop.getProperty(
				"homecam.Capturer.excludedCaptureDevice").split(",");
		excludedCaptureDevices = new HashSet<String>();
		for (String ecd : excludedCaptureDevice) {
			excludedCaptureDevices.add(ecd);
		}
		preferredCaptureDevice = server.prop
				.getProperty("homecam.Capturer.preferredCaptureDevice");

		CaptureSystemFactory factory = DefaultCaptureSystemFactorySingleton
				.instance();
		log.trace("factory {}", factory);
		system = factory.createCaptureSystem();
		log.trace("system {}", system);
		system.init();
		List<CaptureDeviceInfo> list = (List<CaptureDeviceInfo>) system
				.getCaptureDeviceInfoList();
		capturers = new LinkedHashMap<String, Capturer>(list.size() * 2);
		for (CaptureDeviceInfo info : list) {
			String c = info.getDeviceID();
			if (excludedCaptureDevices.contains(c)) {
				log.info("{} exclude {}", c, info.getDescription());
				continue;
			}
			log.info("{} +++++++ {}", c, info.getDescription());
			try {
				CaptureStream captureStream = system.openCaptureDeviceStream(c);
				Capturer cap = new Capturer(info, captureStream);
				capturers.put(c, cap);
			} catch (CaptureException e) {
				log.error(c, e);
			}

			if (StringUtils.isEmpty(preferredCaptureDevice))
				preferredCaptureDevice = info.getDeviceID();
		}
		if (capturers.get(preferredCaptureDevice) == null) {
			preferredCaptureDevice = capturers.keySet().iterator().next();
		} else if (!StringUtils.equals(preferredCaptureDevice, capturers
				.keySet().iterator().next())) {
			Map<String, Capturer> newlist = new LinkedHashMap<String, Capturer>(
					list.size() * 2);
			Capturer first = capturers.remove(preferredCaptureDevice);
			newlist.put(preferredCaptureDevice, first);
			newlist.putAll(capturers);
			capturers = newlist;
		}
	}