[Error] Can't load song! Could not determine container type!

Hello my dear friends!

I have a little problem regarding the loading of a Song.
Every time I try to load the song I get this exception:
System.IO.InvalidDataException: 'Could not determine container type!'

Following code produces this error:

manager.Load<Song>("MVPTune");

while manager is the ContentManager
I created the xnb file with the pipeline tool and located it correctly in the content folder.
The by the pipeline converted .wma file is playable and in the right position too.

Importer: MP3 Importer - Monogame
Processor: Song - Monogame
Quality: Best
Platform: Win10 x64
Monogame Tool: 3.6.0.1625

Thanks for any help.

MrTroble

I just finished the implementation of my music playing functionality not too long ago and I didn’t encounter this issue. Do you think it might be the actual file you’re trying to load? I’m encountering similar issues working on the sound effect portion of my audio engine. It seems MonoGame is picky about what file types it loads… for instance, it can’t handle a 32-bit file and it needs the sample rate to be a specific set. I was able to load these up into Audacity and convert to a format that was compatible.

If you like, I can try your file and see if I get the same issue. Maybe just upload it somewhere and provide a link?

First of all I would like to thank you for your fast answer!

I have tried any files I have. I even recorded one my self in Audiacity. And it’s crashing all the time. TBH I have no issues regarding the sound effects. Still I provide a link to my self recorded audio file (it was just a test tho)

https://drive.google.com/file/d/1hOCBHwWk6_6caHnS2jVy_HH10xCtIG8a/view?usp=sharing

I am also sorry for the late reply but I was on vacation

Thanks
MrTroble

Ok never mind it has nothing to do with the original problem

OK I found the issue.

The system is trying to load an ogg file but the pipeline tool converts it into an wma!

Does any one has a clue how to fix that?

In your .mgbc content file, what’s the importer used for that file? There’s a setting to use an Ogg Importer for the file.

As I mentioned before

Importer: MP3 Importer - Monogame
Processor: Song - Monogame
Quality: Best

and the problem is not the importer it’s the processor I think.
More detailed:

If I invoke Load<Song>() the SongReader tries to read an ogg file but the xnb content file refers to an wma

Thanks for taking time
MrTroble

Hey, sorry I couldn’t respond, I too was on vacation! :smiley:

Looks like you’ve gotten things sorted out though, nice job!

@MrTroble @Trinith Do you guys discovery any solutions?
I have the same problem, but I don’t know how to make Media.song not try to load file with OggStream.Open().
My file is a mp3 file.
Can you help me?

System.IO.InvalidDataException: Could not determine container type! at NVorbis.VorbisReader..ctor (System.IO.Stream stream, System.Boolean closeStreamOnDispose) [0x00035] in <0e67766603aa4628bb7aefee84bb62c4>:0 at NVorbis.VorbisReader..ctor (System.String fileName) [0x0000a] in <0e67766603aa4628bb7aefee84bb62c4>:0 at Microsoft.Xna.Framework.Audio.OggStream.Open (System.Boolean precache) [0x00000] in <0e67766603aa4628bb7aefee84bb62c4>:0 at Microsoft.Xna.Framework.Audio.OggStream.Prepare () [0x00088] in <0e67766603aa4628bb7aefee84bb62c4>:0 at Microsoft.Xna.Framework.Media.Song.PlatformInitialize (System.String fileName) [0x00019] in <0e67766603aa4628bb7aefee84bb62c4>:0 at Microsoft.Xna.Framework.Media.Song..ctor (System.String fileName) [0x00023] in <0e67766603aa4628bb7aefee84bb62c4>:0 at Microsoft.Xna.Framework.Media.Song..ctor (System.String fileName, System.Int32 durationMS) [0x00000] in <0e67766603aa4628bb7aefee84bb62c4>:0

If I invoke Load<Song>() the SongReader tries to read an ogg file but the xnb content file refers to an wma

I just converted the song file as OGG and then used that. That fixed the issue for me.

Hope that helps!

Cheers
~MrTroble

@MrTroble thank you for your fast answer!
I’m starting realise that my problem is little different…
That is my Content.mgcb on MacOS:
`
/outputDir:bin/$(Platform)
/intermediateDir:obj/$(Platform)
/platform:MacOSX
/config:
/profile:Reach
/compress:False

#-------------------------------- References --------------------------------#

#---------------------------------- Content ---------------------------------#
#begin menu_music.ogg
/importer:OggImporter
/processor:SongProcessor
/processorParam:Quality=Best
/build:menu_music.ogg
`

What is happening is when I build pipeline on MacOS, it create a .m4a and a .xnb files, as you can see:

Not a .ogg file.

When I build with DesktopGL it create a .ogg file and everything get fine.
But I need create a app MacOs result, not a .exe Mono result.

With the m4a file I have the same error that us discuss before. Because SongReader try load ogg file.
I’d really appreciate any help or direction that I should follow.

Thank you!

I managed with using /platform:DesktopGL for Linux and OSX, but a don’t know if it is a best solution.

Hello again,

if I remember correct I did not fix the issue at all, I just replaced the generated files with the ogg files.
So I am very sorry but I can’t help you more with this.

Cheers
~MrTroble

1 Like

Meanwhile I go on with this “solution”.
Thank you again!