I got around this problem by switching from mplayer to gmplayer. I don't know what the difference is, or why the php class that handles the video duration functions seems to handle it differently.

From the command line the mplayer binary is executed directly, from the php script via a browser, it seems to be executed as a shell script.