Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Why do WMA lossless spectrograms look different from other lossless codecs? (Read 1437 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Why do WMA lossless spectrograms look different from other lossless codecs?

The general rule is that lossless formats are usually all bit perfect, contain exactly the same audio, and as such all display the same spectrogram data, correct?
If that is the case, then why does WMA lossless always appear to have a different one from all the others? Additionally, why does it seem to cut off some parts of the end of a track whenever it's put in Audacity or Foobar2000 where it displays slightly less samples?
It's the only lossless format to do this and still be considered bit-perfect even by bit compare processes. Is there some kind of explanation behind this pattern?

EDIT: BTW, this is purely out of curiosity, since I was introduced to other lossless formats and how to ascertain that they're lossless, I always wondered what exactly the deal was with this particular lossless format (especially being that it's a company-made alternative). I don't use WMAL or keep anything that I value in that format, it's always for testing only or to figure out exactly why it's different.

Re: Why do WMA lossless spectrograms look different from other lossless codecs?

Reply #1
Nobody decodes it consistently. Windows 10 decodes it badly, especially 24 bit files. FFmpeg produces less output than the original source file. It is a doomed format best left forgotten.

Re: Why do WMA lossless spectrograms look different from other lossless codecs?

Reply #2
I'm not sure what everyone here is talking about.

WMA lossless is a lossless bitperfect format. There's no way on earth it can be decoded differently by different decoders.

I used to have a number of WMA lossless files and I decoded them using ffmpeg and EZ CD Audio Converter (which uses WMA SDK) - in the end I got the exact same WAV files I encoded them from. Granted it was 16bit 44.1KHz audio but it doesn't sound plausible that e.g. 24bit 96KHz audio would suddenly become lossy.

Would be nice if you simply shared your file(s).

Re: Why do WMA lossless spectrograms look different from other lossless codecs?

Reply #3
Certain Windows versions broke WMAL: https://hydrogenaud.io/index.php?topic=117275.0

Microsoft's encoder has had issues before: https://forum.dbpoweramp.com/showthread.php?39459-WMA-Lossless-Encoder-is-BROKEN!

ffmpeg did not decode 24-bit WMAL correctly back in the day: https://trac.ffmpeg.org/ticket/4134


But I have no idea whether this is related to what OP experiences.
High Voltage socket-nose-avatar

Re: Why do WMA lossless spectrograms look different from other lossless codecs?

Reply #4
WMA lossless is a lossless bitperfect format.
I'm not saying it isn't (since I'm aware that it is), I'm just saying that it looks different for both its spectrograms as well as its track length even if it's just a tiny bit. I know that it sounds the same, but what makes it different in the way that it looks? Is there some kind of reason for this?
Also I just converted the files as a test so all I needed here was to show the spectrograms and how the track length looks compared to more standard lossless formats.

Agreed with kode54 BTW, the format can't even store proper DVD-Audio which is ridiculous so it's certainly the worst of lossless formats in addition to this spectrogram thing.

Re: Why do WMA lossless spectrograms look different from other lossless codecs?

Reply #5
If lengths differ, how were they generated? Ripped from CD with Windows Media Player? That application does strange things that are not related to WMA(L).
High Voltage socket-nose-avatar

Re: Why do WMA lossless spectrograms look different from other lossless codecs?

Reply #6
Nobody decodes it consistently. Windows 10 decodes it badly, especially 24 bit files. FFmpeg produces less output than the original source file. It is a doomed format best left forgotten.

Citations needed! FFmpeg have not bugs in WMAL decoder.

Re: Why do WMA lossless spectrograms look different from other lossless codecs?

Reply #7
If lengths differ, how were they generated? Ripped from CD with Windows Media Player? That application does strange things that are not related to WMA(L).

Oh no, absolutely nothing to do with WMP. I made WMAL conversions of a FLAC file I ripped with EAC from a CD, using both Fre:ac and Foobar2000 to show the effects on spectrogram as well as Audacity. So as we all know it's effectively from an accurate rip and not encoded using WMP.
But the format itself has always slightly reduced the length by a few frames if there's silence at the end. I wonder what it means for gapless playback files where the end of a track isn't silent.

Re: Why do WMA lossless spectrograms look different from other lossless codecs?

Reply #8
It looks like it also lost a block or two earlier in the file as well.

Re: Why do WMA lossless spectrograms look different from other lossless codecs?

Reply #9
Citations needed, and proofs with original wmal file(s) too. I can claim various insulting stuff too without any proofs.

Re: Why do WMA lossless spectrograms look different from other lossless codecs?

Reply #10
If lengths differ, how were they generated? Ripped from CD with Windows Media Player? That application does strange things that are not related to WMA(L).

Oh no, absolutely nothing to do with WMP. I made WMAL conversions of a FLAC file I ripped with EAC from a CD, using both Fre:ac and Foobar2000 to show the effects on spectrogram as well as Audacity. So as we all know it's effectively from an accurate rip and not encoded using WMP.
But the format itself has always slightly reduced the length by a few frames if there's silence at the end. I wonder what it means for gapless playback files where the end of a track isn't silent.

Do the WMALs show up with fewer samples in fb2k properties? And if you decode the WMALs (can you save as .wav with Audacity?) - are they then back to correct length and bit-identical to the FLAC you started at?

IOW: can we rule out that this is just a strange misbehaviour in the way the spectrograms are generated? It shouldn't be, but bugs shouldn't be, so ...


Edit: Oh, and: How does Audacity decode WMAL in the first place? A brief search indicates it doesn't encode WMAL other than if you point it at some external processor.
High Voltage socket-nose-avatar

Re: Why do WMA lossless spectrograms look different from other lossless codecs?

Reply #11
Confirmed by doing a round trip encoding to and from WMAL using Adobe Audition 1.5 and foobar2000 1.6.8
I don't have other software capable of saving as WMAL, so don't know if it is Audition's issue or not.
Code: [Select]
Differences found in compared tracks.

Comparing:
"H:\2448.flac"
"H:\2448.wma"
Compared 180674 samples.
Differences found: 180419 values, 0:00.000000 - 0:03.763979, peak: 0.000000 (-138.47 dBTP) at 0:00.000000, 1ch
Channel difference peaks: 0.000000 (-138.47 dBTP) 0.000000 (-138.47 dBTP)
File #1 peaks: 0.699770 (-3.10 dBTP) 0.699770 (-3.10 dBTP)
File #2 peaks: 0.699770 (-3.10 dBTP) 0.699770 (-3.10 dBTP)



Total duration processed: 0:03.764
Time elapsed: 0:00.268
14.07x realtime
X

Re: Why do WMA lossless spectrograms look different from other lossless codecs?

Reply #12
I took the liberty of encoding this FLAC (after decoding to WAV) with Windows Media Encoder on an old Windows XP machine. Decoding this with ffmpeg gives the same number of samples but still this conversion is not lossless.

I subtracted the WAV decoded by ffmpeg from the WMA lossless file from the FLAC file in Audacity, amplified the result by 90dB, and I got this screenshot:
X

Of course, I don't know whether this is a problem in WMA lossless, Windows Media Encoder or ffmpeg.
Music: sounds arranged such that they construct feelings.

Re: Why do WMA lossless spectrograms look different from other lossless codecs?

Reply #13
I took the liberty of encoding this FLAC (after decoding to WAV) with Windows Media Encoder on an old Windows XP machine. Decoding this with ffmpeg gives the same number of samples but still this conversion is not lossless.

I subtracted the WAV decoded by ffmpeg from the WMA lossless file from the FLAC file in Audacity, amplified the result by 90dB, and I got this screenshot:
[attach type=image]21411[/attach]

Of course, I don't know whether this is a problem in WMA lossless, Windows Media Encoder or ffmpeg.
I did a null test with your file against the original flac in Audition and got the same result the 24th bits are different, same as the foobar bit-compare result. I also found that Audition creates a different WMAL file every time I close and reopen the original flac file and save as WMAL. Looks like mandatory dithering but I can't find any option to change this behavior.
X

Re: Why do WMA lossless spectrograms look different from other lossless codecs?

Reply #14
I took the liberty of encoding this FLAC (after decoding to WAV) with Windows Media Encoder on an old Windows XP machine. Decoding this with ffmpeg gives the same number of samples but still this conversion is not lossless.
My apologies, I made a mistake here. I didn't notice ffmpeg decodes to 16 bit by default. When forced to 24-bit WAV, the file is lossless. So, the problem was with me.

Attached is another file, made with WMAEncode64.exe which also decodes losslessly with ffmpeg.

edit: also, a round-trip with dBpoweramp (which I presume uses the encoder and decoder built into Windows) is lossless. I'm using Windows 10 20H2.
Music: sounds arranged such that they construct feelings.

Re: Why do WMA lossless spectrograms look different from other lossless codecs?

Reply #15
Now foo_bitcompare shows both files are identical, but file properties still show different amount of samples.
X
But I am pretty sure that my Audition's WMAL encoder is broken, no way to stop it from changing the 24th bit.

Re: Why do WMA lossless spectrograms look different from other lossless codecs?

Reply #16
It seems that the file misreports its length and the spectrogram is then generated from the reported length?


Anyway, when I try to let ffmpeg 4.4.1 remux it into another wma, then it returns a file that fb2k reports to be much shorter, 0:02.517 (120 816 samples) - and throws Error: IWMSyncReader::GetNextSample failed : Unknown error code (0xC00D002F)
High Voltage socket-nose-avatar

Re: Why do WMA lossless spectrograms look different from other lossless codecs?

Reply #17
Now foo_bitcompare shows both files are identical, but file properties still show different amount of samples.
180 674 samples is 3.764041(6) seconds and 180 672 samples is exactly 3.764 seconds.

This is a limitation of the stream format used by WMA files, namely ASF. It appears to store packet play position timestamps and durations in milliseconds. Thus, Microsoft's own WMA handling code is limited to returning track lengths in milliseconds.

Re: Why do WMA lossless spectrograms look different from other lossless codecs?

Reply #18
Citations needed, and proofs with original wmal file(s) too. I can claim various insulting stuff too without any proofs.

Sure, how many files do you want? I can generate any number of them so long as it's fine to do so, because these are soundtrack CD rips and I'm not sure the site would be OK with posting even one file from that (even if they're JP).
The spectrograms are proof enough in themselves, the only thing I did was boost the range to 140db (as well as, of course, screenshot them). You can test this with any lossless files you have on hand, with any WMAL encoder of your choice and either Spek or Audacity.

Anyways, it looks like others have posted files as well as screenshots for you, don't think I need to do anything else.

And if you decode the WMALs (can you save as .wav with Audacity?) - are they then back to correct length and bit-identical to the FLAC you started at?
Yes, that's exactly what happens (though I use Foobar to convert rather than Audacity, perhaps I should try the latter. Thanks for pointing that out.

Quote
Edit: Oh, and: How does Audacity decode WMAL in the first place? A brief search indicates it doesn't encode WMAL other than if you point it at some external processor.

It just decodes using ffmpeg since for some reason it can't normally decode anything WMA.


Re: Why do WMA lossless spectrograms look different from other lossless codecs?

Reply #20
The decoder uses samples number as stored in bitstream for first and last packet audio frames.

Of course if another software trust container and not audio bitstream duration its their fault.

Re: Why do WMA lossless spectrograms look different from other lossless codecs?

Reply #21
Can anyone else check if ffmpeg -i  2448-WMAEncode64.wma -codec copy 2448-WMAEncode64.wma.wma produces malformed container?
High Voltage socket-nose-avatar

Re: Why do WMA lossless spectrograms look different from other lossless codecs?

Reply #22
Confirm, the resulting file cannot be decoded properly.

 

Re: Why do WMA lossless spectrograms look different from other lossless codecs?

Reply #23
Confirm, the resulting file cannot be decoded properly.

As another confirmation, Audacity doesn't encode WMAL properly to another format with the same length (not mentioning bits though as those will always be different no matter what), so it's best to avoid using it with that program. Foobar2000 however knows how to convert it in such a way that the short length difference won't affect the resulting bits even if you're doing a round trip from FLAC>WMAL>WavPack>TAK>WMAL>FLAC again.