Page 1 of 1

VLC displays wrong bit depth for A-Law encoded files

Posted: 08 Apr 2021 10:36
by Dm1
G.711 A-Law is always using bit depth of 8 bits, but VLC somehow displays it as 16 bit audio in it's "Codec information" window on Windows.
Image Image

Re: VLC displays wrong bit depth for A-Law encoded files

Posted: 08 Apr 2021 14:04
by Lotesdelere

Re: VLC displays wrong bit depth for A-Law encoded files

Posted: 08 Apr 2021 16:02
by Dm1
Thanks for help! Wow, so basically VLC lead developer is somehow unaware of meaning for the word "codec" while working on the most popular media player in the world. That's quite unexpected :D

Re: VLC displays wrong bit depth for A-Law encoded files

Posted: 08 Apr 2021 16:54
by Rémi Denis-Courmont
VLC shows the decoded bits per sample, and G.711 does decode to 16-bit PCM by design. Decoding it to 8-bit would lose precision.

Showing the encoded sample size for G.711 is anyway completely pointless since it's always 8-bit.

Re: VLC displays wrong bit depth for A-Law encoded files

Posted: 08 Apr 2021 21:12
by Dm1
Wrong. You can decode anything to anything if you need, but you will never recover data that was already lost before. Decoding to 16-bit PCM is not default and never was, it's the most common now, because 16-bit sound is most common now. On old mobile phones it was not decoded to 16-bit, because they were not operating with 16-bit sound in any way.

This tab says "Codec", but displayed information that has nothing to do with an encoded data, instead it displays pointless information of configured target output for decoder. Either tab should be called "Output", or it should display data that is truly there.

Re: VLC displays wrong bit depth for A-Law encoded files

Posted: 10 Apr 2021 07:52
by Rémi Denis-Courmont
No, you. Everybody in their right mind decodes G.711 to 16-bit. The two variants have respectively 13 and 14 bits depth, so 16-bit is the only reasonable decoded sample size. This has nothing to do with sound cards using 16-bit.

In fact, most modern OSes use single precision, not 16-bit PCM, internally.

Re: VLC displays wrong bit depth for A-Law encoded files

Posted: 10 Apr 2021 11:13
by Dm1
In fact, most modern OSes use single precision, not 16-bit PCM, internally.
Of course they are, because OS should not be a limiting factor. The point is not in max supported precision, but instead in lowest one. Today 16-bit PCM is usually the lowest supported, so decoding to 16-bit will cover the most cases. "Tomorrow" the same may happen to 24-bit or single precision and every decoder will prioritize the new common format. And VLC will display A-law as a single precision PCM with such a wierd logic. How nice!

Anyway, the main issue here is an incorrect information, that VLC shows in "Codec" tab, no matter the reason for that to happen. The windows says directly Stream -> PCM ALAW 8000Hz 16-bit. How can't you see this is incorrect? This is such an obvious misinformation. This data has nothing to do with a stream.
It could be:
Stream -> PCM ALAW 8000Hz 8-bit -> Output -> PCM 8000Hz 16-bit
or
Stream -> PCM ALAW -> Output -> PCM 8000Hz 16-bit

But NOT like it is now, currently it's a lie. VLC shows 8000Hz 16-bit mono for the stream, so it means that A-Law PCM stream has a bitrate of mono 128 kb/s? How nice again! Why words "Codec" and "Stream" are even exist in this tab?

Re: VLC displays wrong bit depth for A-Law encoded files

Posted: 10 Apr 2021 11:54
by Rémi Denis-Courmont
Whether you like it or not, there are three different bit depths involved here. The number of encoded bit per sample (8), the bit precision (13 or 14 depending on the G.711 law), and the decoded bit depth (typically 16). VLC explicitly shows the later. That does not make it a lie.

Re: VLC displays wrong bit depth for A-Law encoded files

Posted: 10 Apr 2021 12:54
by Dm1
This windows says directly PCM ALAW Stream, so it should show encoded bit depth, obviously. Decoded bit depth is completely independent from encoded stream, for now it always will be 16-bit for any other 16-bit or lower source anyway. It's pointless to display decoded bit depth, sample rate, etc. Because converting 8-bit sound to 16-bit will not have any additional data, this still will be the same 8-bit sound as it was encoded. Encoded bit depth and sample rate are much more useful, because they tell directly what stream quality we are working with.

Re: VLC displays wrong bit depth for A-Law encoded files

Posted: 10 Apr 2021 17:13
by Rémi Denis-Courmont
Yes, this is useless. And the encoded bit depth is even more useless, because it can be inferred from the codec, while the decoded bit depth cannot. In fact, the whole codec meta-data tab is useless.

Re: VLC displays wrong bit depth for A-Law encoded files

Posted: 10 Apr 2021 23:25
by Dm1
And the encoded bit depth is even more useless, because it can be inferred from the codec.

Not for every codec. In this case for A-Law everything can be guessed, but for some other formats this cannot be done so easily. For example FLAC technically supports 4-bit, 8-bit, 16-bit, 24-bit and single precision encoding, so displaying encoded bit depth is very useful for this format. Decoded bit depth is still useless though, I have no idea why this even exist in VLC. This window is living on its own planet, without seeing what other similar projects do and as a result most people expect to get from it.