How can I manually pass a SoundCloud track duration to HTML5 audio?

I'm currently using a stripped-down version of Canvas.fm to convert SoundCloud mp3 streams into ogg streams using Node and ffmpeg, to support the audio element in ogg-playing browsers like Firefox. My problem is: while the duration is correctly set for SoundCloud's mp3 streams, the ogg stream gives an indefinite duration in the player; I want the actual duration to show up.

I noticed when requesting a SoundCloud mp3 stream, I get a canceled request, a pending one, and then a 206 Partial Content response. My Node app does similar redirects, without as many headers, since I'm sending them myself.

Should I be trying to calculate/forge the Content-Length or Content-Range headers? Or does HTML5 audio get the duration from mp3 metadata/ID3 information? If I can get the duration from SoundCloud's API (which I can), how can I pass this to the client in my ogg stream?