Replace buffer by AVPacket and avoid a memcpy() for video when the number