Implemented lazy initialization for libav buffers so that output size can be infered from the first image