change code to not duplicate video bytes and save memory