Prepare output frame correctly