This is caused by some computer monitors which select DVI mode even if an HDMI cable is connected. This fix may be necessary even if other HDMI devices work perfectly on the same monitor (or TV)!

Edit the configuration file (located in /boot/config.txt) - see the instructions at R-Pi_ConfigurationFile for how to edit the configuration file.

Add the following line to the configuration file /boot/config.txt:

hdmi_drive=2

This will force it to select HDMI mode.

You might need as well:

hdmi_force_hotplug=1
hdmi_force_edid_audio=1