Implemented AVI encoding