Reply To: Transcoding and file size in svn-1463

#8172
rpedde
Participant

@xaviour wrote:

Firefly reports to my Soundbridge that the file is 6.5MB (ogg total data length / (1024*1024)) when it should be 45.2MB (Playback length * Sample Rate * Channels * Sample Size + size of wav header).
This real file size could be used for the calculation of “real_len” in function “pi_stream” in case of a server side conversion.

Except I don’t do that much introspection into the file at scan time, since I don’t know how the transcoder will convert it. Might convert it to 44100/16/2, or maybe leave it at 48k. Dunno, that’s up to the transcoder to write the write wav header.

So I don’t really know the size of the file when I send it.

I do send wav headers that are pretty close (as close as I can estimate based on song duration, since I don’t know sample count either) when I stream the wav, and the http headers don’t include a response length.

That seems to work okay for all the players I’ve seen, although it does have the issue of showing wrong metadata.

I’ve got fields in the database right now for sample count and stuff, and I hope to get all that in the metadata scanners, so eventually that might be more correct, but it’s pretty much a long-term issue right now, as it seems to mostly work. :-/

But yeah, I’d like that to work as well. Getting there. Flac has all that data from the metadata scanner, fwiw.

— Ron