Updated camera initialization
Added encoding functionality
Moved encoding to another thread