Basic integration of libavcodec and many other improvements