Clean up capture_enc(), export it, and use it in the capture window.