Extragalactic globular clusters in the near infrared - I. A comparison between M87 and NGC 4478