Improved video files handling. Moved from C to C++ video handling.