Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't see Sampling frequency change when analyze with MKVToolNix #287

Closed
Malyasse opened this issue Feb 18, 2024 · 1 comment
Closed
Labels

Comments

@Malyasse
Copy link

Package Version
5.0.4

Environment

  • OS: [e.g. iOS/Windows/...]
  • Browser [e.g. Chrome, Safari]
  • Version 121.0.6167.185 (Official Build) (64 bits)

Bug Description
I initiate this with:

await _audioRecorder.start(RecordConfig(
            bitRate: 1152000,///128000
            encoder: AudioEncoder.opus,
            numChannels: 1,
            sampleRate: 41000,
        ), path: '');

I modify the sampling rate and bit rate, but the changes are not reflected in the Matroska format fields:
0xb5 (sampling frequency) = 48000
0x6265 (bit depth) = 32 bits

Configuration: bitRate 128000, sampleRate 44100
image
Here, it's observed that what's displayed doesn't align, and we're at position 16667 to reach 1.02 seconds.

16386 if we keep only the pure size data
17368 if we include the last

Configuration: bitRate 128000, sampleRate 48000
image
The issue here is that we need exactly the same number of hexadecimals to reach 1.02 seconds, which is 16667.
Same as for the previous test: 16386 if we keep only the pure size data, 17368 if we include the last.

Shouldn't these be different? Or is it just the bitRate that is considered? It's not clear.

44100 Hz or 44100 measurements per second equate to one measurement every 0.023 ms.
48000 Hz or 48000 measurements per second equate to one measurement every 0.021 ms.

If the number of samples per second is supposed to be different, why do we seemingly have the same thing? And why 16667 (I don't understand this)?

Test by changing only the bitRate

BitRate:11523000, SamplingRate: 44100
image

BitRate:11523000, SamplingRate: 48000
image

In both cases, the sampling rate isn't updated, but we have different positions for 00:00:01.02 seconds.

Expected Behavior

-Change the sample rate and test the output content in the container
-Simply request Sample Rate and Bit Depth to determine our Bit Rate. (Bit Rate = Sample Rate * Bit Depth)
-Or add the explanation when we hover over the constructor that we choose only one parameter (sampleRate or bitRate) and that there is a bit depth chosen which does not change

Additional Context

I'm attempting to figure out how many hexadecimals correspond to 1 sample.
I'm not entirely sure I comprehend how the relationships work to determine how many hexadecimals correspond to 1 sample.

I'm not 100% sure about what I mentioned above in terms of relationships; that's what I understood.If I really didn't understand I would be happy if my errors were clarified :)

But if someone would like to explain to me—especially how we find out how many hexadecimals make 1 sample (so, 0.020 ms in the context of 48000 and 32-bit depth)—what I don't understand is that "32-bit" is supposed to represent a sample of 0.020 ms, but 4 bits = 1 Hexa. So, you need 8 hexadecimal digits to have a sample. But here, there is much less (a position is a couple of two-digit Hexa (4F, E7...), with 16386 of data it gives 32772 hexadecimals for one second).
48000 samples/s * 32 bits = 1536000 Bit Rate
1536000/4 bits = 384,000 hexa/s
384,000/2 (because we have a couple of hexa in position) = 192,000 positions to have 1 second.

BUT (I just realized) if we have just 128000 Bit Rate:
128000/4 = 32000 hexadecimal
32000/2 = 16000 positions (which is therefore consistent with the 16386 before)

But, what is the use of the sampling frequency and bit depth? 8000Hz and 16bits/s ? I really don't understand anything at this point. ^^'

@llfbandit llfbandit added the web label Mar 7, 2024
@llfbandit
Copy link
Owner

Browsers take OS parameters for compressed recording.
This only works for pcm and wave at this moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants