When Loading Ogg files through the content pipeline into Xnb they are at least 4 times as large

Hi there, I’m trying to reduce the file size of my project by using .ogg as my audio file of choice. (Previously .wav)

(I’m building my Content.mgcb file automatically with some node.js)

I can just transfer the files as is without converting them to .xnb files but that makes implementation more complicated.

Example line in Content.mgcb

#begin Assets/Music/Snow.ogg

Final music directory output


Converting them to .xnb works just fine, but as you can see they’re way bigger for some reason.

Example line in Content.mgcb

#begin Assets/Music/Snow.ogg

Final music directory output


I’m just building the game with this command

dotnet publish -c Release -r win-x64 /p:PublishReadyToRun=false /p:TieredCompilation=false --self-contained

Is there something I’m doing wrong that’s causing these XNB files to be so big?


Are you using desktop windows (dx) or cross platform (opengl)? Iirc the dx version don’t support ogg so they convert it to other format during the build, so the built files you’re seeing are not actually ogg anymore.

I didn’t find the source article where I read about it, so maybe someone else here can confirm or deny it.

i’m using the cross platform version. so maybe that means i messed something else up?

Don’t know, sorry. I just remembered that the content tool convert song assets to a different format and its probably related, but I don’t know the details.

Btw not sure if its something you want to do, but you can also use Song.FromUri to load ogg directly, and just copy instead of building them. Haven’t tried it myself though.

1 Like

I think GeonBit’s right - I recall something about that where it may be making wma’s under the hood if MGCB is not set the right way - so maybe even if you are building for cross-platform - it be that MGCB settings might be off.
I would try:
Go into MGCB
Click on Content so it’s highlighted and a Properties box will be shown below it.
Look for “Platform” and make sure it’s set to DesktopGL
(it might be set to “Windows” by default if you’re on Windows platform I suspect, but I could be wrong)

You can try to reduce the quality. The last time I tried it, it didn’t work for a DX project if the quality wasn’t the “Best”, but it worked for a GL project. Anyway, the large file size of xnb has always been a problem.

1 Like

it seems like it’s already set to DesktopGL. that’s good to know about though.

setting the quality to “Medium” seemed to cut down on the size by quite a bit. thanks, i’ll keep that in mind.