VideoHelp Forum




+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 30 of 38
  1. Anonymous543
    Guest
    Image
    [Attachment 62718 - Click to enlarge]


    what is bit per sample in audio? any one explain??
    i know sample rate is just like frame rate in video
    like higher the frame rate ,smoother the video
    as like higher the sample rate ,smother the audio
    even now i understood about channels 3f2m/lfe stands for 3 front speakers 2 middle speakers and lfe means 1 subwoofer

    but what is bits per sample?
    Quote Quote  
  2. Bits per sample is the number of values able to be assigned to any given audio sample.

    For 8 bit audio it's 2 to the power of 8, which means an audio sample can be given 256 different values.
    For 16 bit audio (ie CDs) it's 2 to the power of 16, or 65536 different values.
    For 24 bit audio, it's 2 to the power of 24, or 16777216 different values.

    The above are referred to as 8, 16 or 24 bit "integer".
    The greater the bitdepth, the more accurate the value given to each audio sample can be, and the greater the dynamic range can be. Any deviation from the value assigned to a sample and the original analogue value is referred to as quantization error. See the picture here (I had to use code tags to stop the forum software messing up the link).
    In computer-land, lossy audio is usually decoded to a bitdepth of 32, however, it's generally 32 bit floating point rather than 32 bit integer, which is something different. You can read about that one here.
    https://en.wikipedia.org/wiki/Floating-point_arithmetic
    Computers can do floating point math on a very large range of numbers very quickly.

    The way I understand it, 32 bit float has roughly the same precision as 24 bit integer.

    For the record, the sample rate doesn't make the audio smoother as such. The sample rate needs to be twice the highest audio frequency being sampled. As humans can at best hear up to 20kHz, the sample rate needs to be double that, at least in a perfect world, but as it's not a perfect one, the sample rates used are a little more than double. CD audio is sampled at 44.1kHz. Most other audio formats use 48kHz.
    https://en.wikipedia.org/wiki/Sampling_(signal_processing)
    https://en.wikipedia.org/wiki/Nyquist_frequency
    Last edited by hello_hello; 3rd Jan 2022 at 03:26.
    Quote Quote  
  3. Anonymous543
    Guest
    Originally Posted by hello_hello View Post
    Bits per sample is the number of values able to be assigned to any given audio sample.

    For 8 bit audio it's 2 to the power of 8, which means an audio sample can be given 256 different values.
    For 16 bit audio (ie CDs) it's 2 to the power of 16, or 65536 different values.
    For 24 bit audio, it's 2 to the power of 24, or 16777216 different values.

    The above are referred to as 8, 16 or 24 bit "integer".
    The greater the bitdepth, the more accurate the value given to each audio sample can be.

    In computer-land, lossy audio is usually decoded to a bitdepth of 32, however, it's generally 32 bit floating point rather than 32 bit integer, which is something different. You can read about that one here.
    https://en.wikipedia.org/wiki/Floating-point_arithmetic
    It's because computers can do floating point math on very large numbers very quickly.

    The way I understand it, 32 bit float has roughly the same precision as 24 bit integer.

    For the record, the sample rate doesn't make the audio smoother as such. The sample rate needs to be twice the highest audio frequency being sampled. As humans can at best hear up to 20kHz, the sample rate needs to be double that, at least in a perfect world, but as it's not a perfect one, the sample rates used are a little higher. CDs are sampled at 44.1kHz. Most other audio formats use 48kHz.

    https://en.wikipedia.org/wiki/Sampling_(signal_processing)
    https://en.wikipedia.org/wiki/Nyquist_frequency

    So 8-bit 16-bit 24-bit 32-bit per sample is just like color sampling of audio?

    Higher the bit depth = high accuracy audio
    Am I right??

    And does this bit per sample value affects file size and quality of audio?
    Quote Quote  
  4. Originally Posted by kirito View Post
    So 8-bit 16-bit 24-bit 32-bit per sample is just like color sampling of audio?
    Yes.

    Originally Posted by kirito View Post
    Higher the bit depth = high accuracy audio
    Am I right??
    Yes. When working with digital audio (mixing or applying effects etc) it's better to do it in 24 bit so as not to compound any quantisation errors to much, but downsampling to 16 bit is usually considered fine for the end product (it's the bitdepth CDs use).

    Originally Posted by kirito View Post
    And does this bit per sample value affects file size and quality of audio?
    A lossless 24 bit audio file (wave file or flac etc) will be larger than a 16 bit version.
    A stereo 44.1k 16 bit wave file has a bitrate of 1411 kbps.
    A stereo 44.1k 24 bit wave file has a bitrate of 2117 kbps.
    At a sampling rate of 48k it's 1536 kbps for 16 bit and 2304 kbps for 24 bit.
    Last edited by hello_hello; 3rd Jan 2022 at 03:57.
    Quote Quote  
  5. Anonymous543
    Guest
    Thanks for explaining
    Quote Quote  
  6. https://en.wikipedia.org/wiki/Analog-to-digital_converter#Resolution

    If you are using bitrate based encoding the bitrate determines the size, not the sample depth.
    Quote Quote  
  7. Anonymous543
    Guest
    this is my raw ac3 mono track which has 32 bit per sample fltp
    https://files.videohelp.com/u/301063/input.ac3
    Image
    [Attachment 62723 - Click to enlarge]




    i converted this track using this code
    Code:
    ffmpeg -i input.ac3 -c:a pcm_u8 pcm_u8_output.wav
    https://files.videohelp.com/u/301063/pcm_u8_output.wav
    Image
    [Attachment 62724 - Click to enlarge]



    pcm_u8_output.wav this file's sound quality becames
    lil bit noisy may be because i reduced its bit per sample to 8.
    Quote Quote  
  8. Anonymous543
    Guest
    Why that happened?
    Quote Quote  
  9. The fewer bits you use the worse the sound quality. Though, most people don't hear a difference over 16 bits. Depths higher than that are more useful when you're doing extensive filtering and mixing.
    Last edited by jagabo; 6th Jan 2022 at 07:40.
    Quote Quote  
  10. Anonymous543
    Guest
    Originally Posted by jagabo View Post
    The fewer bits you use the worse the sound quality. Though, most people don't here a difference over 16 bits. Depths higher than that are more useful when you're doing extensive filtering and mixing.

    How much bit depth should I use for encoding movies?
    Suppose i have ac3 audio with 32 bit per sample
    And i wanna compress it so how much bit is recommended?
    Quote Quote  
  11. You don't have 32 bit audio - this is information returned from decoder - it may decode 8 bit as 32 bits and report this as is.
    In real life (depends on audio source and equipment) real audio may have somewhere between 10 and 22 bits - it is common to use higher bitdepth than real audio bitdepth - same rule as for video signal.
    From practical perspective most of consumer audio can be 16 bit during conversion from digital to analog domain - anything higher than 24 bit is overkill (but may be justified by for example CPU architecture - 24 bit audio may produce issues for 32 bit systems so commonly 24 bit may be extended to 32 bits to prevent unaligned memory access).

    And very simple rule for analog<>digital domain - every bit is equal to 6.02dB as such any system with 16 bits is capable for approx 96dB and 20 bits is over 120dB signal dynamics.

    For audio transcoding anything equal-higher than 16 bit integer is OK - more bits better and in AC3 signals are transformed from time/spatial domain to frequency domain so they are no longer under typica PCM rules.
    Quote Quote  
  12. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    Also, the OP needs to understand that bitrate is ONLY linear with bitdepth when dealing with uncompressed files. Compressed files, such as AC3 create their birate by their algorithm that they use to compress, and is (basically) independent of source bitdepth.

    So it is quite possible to have:
    16bit 2ch LPCM 48kHz WAV (@ 1,536kbps) --> AC3 2.0 48k @ 256kbps (reporting as "32bits")
    sitting right next to
    24bit 2ch LPCM 48kHz WAV (@ 2,304kbps) --> AC3 2.0 48k @ 192kbps (reporting as "32bits")

    Neither source is actually 32bits, and the 32bits says nothing about the quality of the AC3. ONLY the source's quality and the compressed bitrate of the AC3 (along with a few possible fine tune parameters) do.

    Which one is better? Impossible to tell unless you know more about the provenance of the source files. If, for example, BOTH are 1st gen exports using the same app, and both come from the same higher rez master (in this instance, let's say 64bit float 96kHz 2ch), only then could you say that the 24bit is likely better than the 16bit. But how much better?? Most people would not ever be able to the difference unless they were trained, and were using a top quality system in a top quality environment.
    Also, my example show the compressed ac3 of the 24bit file being lower than that of the compressed ac3 of the 16bit file, so it is very possible that despite a better source, the lower bitrate compressed version has more noticeable loss of quality.

    ************

    One more thing about that 32bit stuff...
    It might be referring to something completely different. For example, in lpcm, a sample is just one of a continuous series of linear sample points. In a compressed format, such as ac3, mp3, aac, etc. a sample might be equal to a range of lpcm samples, using that as the window with which to apply the compressed algorithm. Or, it could be a "frame" that it packetizes the encoded data into, for ease of decoding.
    So either way this kind of sample does not correllate at all to lpcm samples, nor to a linear determination of quality by assigning bitdepth to a sample.

    You are just going down the wrong path without a full understanding of the rules that make up the paths.


    Scott
    Last edited by Cornucopia; 3rd Jan 2022 at 20:41.
    Quote Quote  
  13. Originally Posted by kirito View Post
    How much bit depth should I use for encoding movies?
    Suppose i have ac3 audio with 32 bit per sample
    And i wanna compress it so how much bit is recommended?
    Lossy audio doesn't have a bit depth (32 bit would only tell you the bit depth it's being decoded to), so if you're encoding to another lossy format, there's no encoding bit depth to worry about. When encoding to a lossy format to reduce the file size, the encoded audio size is controlled by specifying a bitrate, not a bit depth. Either that, or many encoders have a variable bitrate mode, where you select a quality rather than a bitrate, but you have no control over the bitrate it'll use, aside from reducing the quality to output a smaller file.

    If you're using a GUI for encoding, these days it's fairly standard for any lossy audio to be decoded as 32 bit float by the GUI and sent to the encoder that way. There's virtually no point re-compression AC3 in a lossless format, because all you'll end up with is a larger file. The only way to reduce the file size (aside from downmixing multichannel audio to stereo while re-encoding) would be to re-encode as AC3 using a lower bitrate, or in a different format such as AAC, but still using a lower bitrate.
    The screenshot in your opening post doesn't say anything about the audio bitrate, although for multichannel AC3 it's usually 448kbps or greater.

    A quick example of the same CD audio track encoded at different bitrates and their corresponding file sizes.
    The first two are both 16 bit, while the others are in a lossy format and therefore have no bit depth.

    Image
    [Attachment 62750 - Click to enlarge]
    Last edited by hello_hello; 3rd Jan 2022 at 21:53.
    Quote Quote  
  14. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    Also, in general, I would recommend using Mediainfo over VLC when referencing stats.

    Scott
    Quote Quote  
  15. Anonymous543
    Guest
    Originally Posted by hello_hello View Post
    Originally Posted by kirito View Post
    How much bit depth should I use for encoding movies?
    Suppose i have ac3 audio with 32 bit per sample
    And i wanna compress it so how much bit is recommended?

    Lossy audio doesn't have a bit depth (32 bit would only tell you the bit depth it's being decoded to), so if you're encoding to another lossy format, there's no encoding bit depth to worry about. When encoding to a lossy format to reduce the file size, the encoded audio size is controlled by specifying a bitrate, not a bit depth. Either that, or many encoders have a variable bitrate mode, where you select a quality rather than a bitrate, but you have no control over the bitrate it'll use, aside from reducing the quality to output a smaller file.

    If you're using a GUI for encoding, these days it's fairly standard for any lossy audio to be decoded as 32 bit float by the GUI and sent to the encoder that way. There's virtually no point re-compression AC3 in a lossless format, because all you'll end up with is a larger file. The only way to reduce the file size (aside from downmixing multichannel audio to stereo while re-encoding) would be to re-encode as AC3 using a lower bitrate, or in a different format such as AAC, but still using a lower bitrate.
    The screenshot in your opening post doesn't say anything about the audio bitrate, although for multichannel AC3 it's usually 448kbps or greater.

    A quick example of the same CD audio track encoded at different bitrates and their corresponding file sizes.
    The first two are both 16 bit, while the others are in a lossy format and therefore have no bit depth.

    Image
    [Attachment 62750 - Click to enlarge]
    Duration of first track?
    Last edited by Anonymous543; 4th Jan 2022 at 01:59.
    Quote Quote  
  16. Three minutes.

    The AC3 version has a slightly longer duration than the others as the AC3 encoder doesn't support gapless playback. Lossy encoders generally add a little silence to the beginning and the end of the audio and the gapless information tells a decoder to skip it. I assume it's referred to as gapless playback as it means you can encode tracks individually that normally run into each other on an album without any silence in between. When you play the encoded tracks, the player can still play them one after the other as a continuous track because it knows to skip the added silence.

    So the AAC and MP3 versions show the same number of samples as the original audio, whereas for the AC3 version some extra silent samples are included.

    Image
    [Attachment 62753 - Click to enlarge]
    Last edited by hello_hello; 4th Jan 2022 at 02:48.
    Quote Quote  
  17. Anonymous543
    Guest
    Originally Posted by hello_hello View Post
    Three minutes.

    The AC3 version has a slightly longer duration than the others as the AC3 encoder doesn't support gapless playback. Lossy encoders generally add a little silence to the beginning and the end of the audio and the gapless information tells a decoder to skip it. I assume it's referred to as gapless playback as it means you can encode tracks individually that normally run into each other on an album without any silence in between. When you play the encoded tracks, the player can still play them one after the other as a continuous track because it knows to skip the added silence.

    So the AAC and MP3 versions show the same number of samples as the original audio, whereas for the AC3 version some extra silent samples are included.

    Image
    [Attachment 62753 - Click to enlarge]
    First track which is uncompressed i guess

    How it calculated file size??

    It has total 7978824 samples and it's 16 bit?
    So 7978824 × 16 = 127661184(total bits)

    Conversion of 127661184 bits to megabyte is around 15.9mb
    But your track is 30MB
    Quote Quote  
  18. Anonymous543
    Guest
    It's 16 bit depth or 16 kilobit?
    Quote Quote  
  19. Originally Posted by kirito View Post

    How it calculated file size??

    It has total 7978824 samples and it's 16 bit?
    So 7978824 × 16 = 127661184(total bits)

    Conversion of 127661184 bits to megabyte is around 15.9mb
    But your track is 30MB
    It's calculated however foobar2000 calculates it.

    File/Properties in XP says 30.4 MB (31,915,588 bytes) and Explorer says 31,168 KB.

    It's 7978824 samples per audio channel and there's two of them.

    For bitrate kilo usually means 1000, not 1024, so I think.....
    as it's a 16 bit stereo wave file at 1411 kbps

    1411 * 1000 * 181 sec / 8 = 31,923,875 bytes / 1024 / 1024 = 30.44 MB

    7978824 * 2 * 16 / 8 = 31,915,296 bytes / 1024 /1024 = 30.43 MB

    They're close anyway.....

    If you want to play around, there's a portable version of foobar2000 here.
    https://forum.videohelp.com/threads/396860-foobar2000-portable-(for-audio-encoding)

    I should update it at some stage as it's an older version now but it'll still work fine. As well as being a great audio player, foobar2000 is also a very useful audio converter. The portable version I linked to is still very similar to my current setup. It'll convert just about any audio format to any audio format, and you can add DSPs to the conversion chain. The only thing not included in the zip file is ffmpeg. It's needed to decode/encode some formats. There's a text file included with instructions for where to put ffmpeg and a few other things.

    There's a bunch of conversion presets ready to use, and you can modify them or you can create your own. Some of them downmix multichannel audio to stereo before it's re-encoded, or use ReplayGain to adjust the volume amongst other things. Selecting the Convert menu will bring up a list of conversion presets similar to this one. Selecting a preset will convert using that preset.

    Image
    [Attachment 62754 - Click to enlarge]


    At the bottom of the converter presets list you'll see three dots. Clicking on the three dots takes you into the converter setup. There you can click on Output Format to choose an encoder configuration, or create your own, and under processing you'll see the DSPs that can be used when re-encoding.
    Anyway, play around if you want to, and post back if you need any help.

    Image
    [Attachment 62755 - Click to enlarge]


    Oh and there's a font included. You don't have to install it, but the text area at the bottom right of the GUI needs a monospace font to display with the text lined up all nice. You can change it to use a standard Windows monospace font instead if you prefer, but if you install the font in the zip file foobar2000 is already configured to use it.
    Last edited by hello_hello; 4th Jan 2022 at 04:20.
    Quote Quote  
  20. Moved to previous post
    Last edited by hello_hello; 4th Jan 2022 at 04:06.
    Quote Quote  
  21. Anonymous543
    Guest
    Look how i calculated after knowing there's 2 channel in audio

    Image
    [Attachment 62756 - Click to enlarge]


    Image
    [Attachment 62757 - Click to enlarge]
    Quote Quote  
  22. Anonymous543
    Guest
    Originally Posted by hello_hello View Post
    Moved to previous post
    What happens when we compress them to ac3 ,aac ,opus like lossy compression methods?

    Bit depth remains same but they removes data from audio which is un noticable am i right?
    Quote Quote  
  23. That calculator assumes kilo = 1000 rather than 1024.

    255322368 / 8 / 1000 / 1000 = 31.915296 MB

    Do newer versions of Windows do the same? I have to use 1024 to get the file size that XP displays.

    255322368 / 8 / 1024 / 1024 = 30.436798095703125 MB

    Edit: That's right, a kilobyte used to be 1024 bytes, but it was changed to 1000, so for the old school definition, it's a kibibyte (KiB) = 1024 bytes
    https://en.wikipedia.org/wiki/Byte#Multiple-byte_units

    XP doesn't use kibibytes though. For XP a kilobyte = 1024 bytes.
    Last edited by hello_hello; 4th Jan 2022 at 05:16.
    Quote Quote  
  24. Originally Posted by kirito View Post
    Originally Posted by hello_hello View Post
    Moved to previous post
    What happens when we compress them to ac3 ,aac ,opus like lossy compression methods?

    Bit depth remains same but they removes data from audio which is un noticable am i right?
    Lossy audio has no bitdepth. It's something to do with the audio being converted from a time domain to a frequency domain and I barely understand it myself to be honest, but once the audio is in a lossy format as such AC3 or MP3 the bitdepth is gone. When it's decoded, it's effectively converted to a wave file, and then you get to choose the bitdepth it's decoded to. It could be 16 bit PCM to a lossy format, then to 24 bit PCM when it's decoded.
    Last edited by hello_hello; 4th Jan 2022 at 05:18.
    Quote Quote  
  25. Anonymous543
    Guest
    Ohh
    Quote Quote  
  26. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    Originally Posted by hello_hello View Post
    Originally Posted by kirito View Post
    Originally Posted by hello_hello View Post
    Moved to previous post
    What happens when we compress them to ac3 ,aac ,opus like lossy compression methods?

    Bit depth remains same but they removes data from audio which is un noticable am i right?
    Lossy audio has no bitdepth. It's something to do with the audio being converted from a time domain to a frequency domain and I barely understand it myself to be honest, but once the audio is in a lossy format as such AC3 or MP3 the bitdepth is gone. When it's decoded, it's effectively converted to a wave file, and then you get to choose the bitdepth it's decoded to. It could be 16 bit PCM to a lossy format, then to 24 bit PCM when it's decoded.
    While the app may get to "choose" the bit depth, its original bitdepth is still an intrinsic limiting factor. IOW, you cannot get back more real detail, dynamic range than what you put in.


    Scott
    Quote Quote  
  27. Lossy audio is more or less something like -1..+1 or it can be 0..+1 or -0.5..+0.5 after transformation to frequency domain (https://en.wikipedia.org/wiki/Discrete_cosine_transform) - internally it can be nonlineary scaled.

    And bitrate calculation may be affected by many factors - one of them are metadata and framing - usually audio before transformation is grouped in form of frames and frames can be fixed size thus audio will have sometimes more samples due of this (worst case scenario it can be where for example frame is something like 512 samples but signal will occupy first sample and remaining ones are stuffed with zeros - this is commonly case for last frame and sometimes for first where zeros are add before signal samples to minimize some effects) - error should be not so big but may introduce some confusion.
    Quote Quote  
  28. Originally Posted by Cornucopia View Post
    While the app may get to "choose" the bit depth, its original bitdepth is still an intrinsic limiting factor. IOW, you cannot get back more real detail, dynamic range than what you put in.
    Apps normally decode to 32 bit float because of it's precision, and because it can handle values above 0dB. The peaks might ultimately be clipped during any final conversion to a fixed bitdepth, but that aside, Apps tend to give you an opportunely to simply adjust the volume while re-encoding, or run the audio through DSPs, all of which should be done in float or at the highest bitdepth possible.

    And lossy encoding changes the audio, so from that perspective the lossy version is a new source. Decoding it to a higher bitdepth will have less quantisation errors than decoding it to a lower one, so it reproduces the lossy version more accurately even if it doesn't add back detail or dynamic range as such.

    Here's an 8 bit wave file converted to AAC, then the AAC version converted to wave files at different bitdepths. According to a ReplayGain scan, it took decoding the AAC version to 24 bit to represent the new AAC peak exactly. No dithering was used.

    Sample peak

    Image
    [Attachment 62764 - Click to enlarge]


    True peak (4 x oversampling)

    Image
    [Attachment 62765 - Click to enlarge]
    Last edited by hello_hello; 4th Jan 2022 at 20:07.
    Quote Quote  
  29. Originally Posted by hello_hello View Post
    Apps normally decode to 32 bit float because of it's precision, and because it can handle values above 0dB. The peaks might ultimately be clipped during any final conversion to a fixed bitdepth, but that aside, Apps tend to give you an opportunely to simply adjust the volume while re-encoding, or run the audio through DSPs, all of which should be done in float or at the highest bitdepth possible.

    To be precise not apps but apps developers, usually those without in-depth knowledge about DSP - 32bit float is perceived by many as convenient, universal format that provide more than enough dynamics and at the same time (largely falsely) precision (barely 25 bits) where dynamics and precision are not the same thing - float 32 seem to be convenient as in common misconception it will remove from developer responsibility for signal path (this is based on false assumption that 32 bit float means high quality audio where 32 bit float is frequently insufficient and may lead to nasty problems...)
    Quote Quote  
  30. Anonymous543
    Guest
    I watched few youtube videos on bit depth...in that they are saying more bitdepth means more tunes can be converted to analog to digital

    8 bit = 2⁸ =256 tunes can be converted
    16 bit = 2¹⁶ = 65536 tunes can be converted
    24 bit = 2²⁴ = 16777216 tunes can be converted

    I don't know it's correct info or not but there's something quantization too idk anything about quantization...

    when we compress a uncompressed audio track..
    What happens at that time? Size gets lower so how they compress it? They remove unnecessary data from songs or what?they reduced bit depth??
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!