Corey-M/NAudio.Lame

Xing header

Closed this issue · 2 comments

Can not insert a Xing header, is there any way to do it?

I am generating a .mp3 of 2: 00min ABR 128k and in windows it tells me that it has 1: 14min of duration because it does not have a Xing header

example
https://drive.google.com/open?id=1DJyOIseXx52pdfgLnSx3VSSA-1Px48Ts

Sorry for my English

Thanks for the feedback.

During the encoding process LAME emits data blocks for the ID3v2 block and VBR header frame before emitting any actual data blocks. At the end of the encoding process the VBR header frame is filled in with data. In order to do this the output stream must allow seek, read and write operations. This is fine for most types of streams - file stream, memory stream, etc - but will fail on streams that do not allow seeks or updates, like network streams.

After a bit of investigation in the LAME source I've found the method used by LAME to write the VBR header. I've added some code to do this when the encoding is completed and have uploaded v1.0.7 to NuGet.

I tested your file and transcoding it with the new code produces a correctly-formed output that accurately shows the file length in VLC during playback, as well as in the file information from Windows Explorer. Download the new package and give it a try, and please let me know how it goes.

Thank you!
It works excellent

I tried it on my projects and the problem was corrected, it works fine.

Thank you!