Answers.Body: <p>I suspect that your MediaInfo parser is mis-reporting.  Sampling rates are usually described both in terms of frequency and bit depth.  It is quite common to have 48kHz at 24 bits.  I suspect that whoever wrote the printf statements producing the above output meant to say "bits" not "KHz" after the "/".</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-13T13:57:03.853Z
Answers.Text: I don't see Mediainfo ever reporting sample **size** for MPEG audio streams. When it does so (for WAVs), it reports them as a separate field **bit depth**.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-13T14:13:22.000Z
Answers.Text: I just ran mediainfo on another `.mkv` file and got Sampling rate and Bit depth in to separate fields. So I guess if the bit depth known it will be listed in a separate field, or not?
Answers.UserDisplayName: arne.z
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-13T14:14:37.033Z
Answers.Text: Yes, separate field
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-13T13:23:56.400Z
Answers.LastActivityDate: 2016-02-13T13:23:56.400Z
Answers.UserDisplayName: Michael Tiemann
Answers.Body: <blockquote>
    <p>tracks show two different sampling rates. (...) Can anyone explain what this means? I always thought one audio track can only have one sampling rate. Is this just a different way of describing one sampling rate?</p>
  </blockquote>
  
  <p>MediaInfo reports what is played by a decoder, depending of its capabilities:<br>
  - if your decoder is able to play an HE-AAC stream, the stream will be played at 48 kHz (the frequecy of the "core" + the <a href="https://en.wikipedia.org/wiki/Spectral_band_replication">SBR</a> data).<br>
  - if your decoder is <strong>not</strong> able to play an HE-AAC stream, the stream will be played at 24 kHz (the frequency of the "core" AAC)</p>
  
  <blockquote>
    <p>I always thought one audio track can only have one sampling rate.</p>
  </blockquote>
  
  <p>No. You can have a "core" stream with a specific sampling rate, decodable by old players, and an additionnal sub-stream in the stream with additionnal data for having 48 kHz for decoders capable of decoding such additional sub-stream.</p>
  
  <p>Note that it is same for e.g. channels, with HE-AACv2 you'll get a mono "core" + <a href="https://en.wikipedia.org/wiki/Parametric_Stereo">PS</a> for upgrading to stereo. or AC-3 (and DTS) can have a 5.1 "core" lossy stream for old decoders + extra data for newest decoder in order to get 7.1 and/or lossless.</p>
  
  <blockquote>
    <p>At the moment, the the software just expects single values for the meta data, so storing two different values for the sampling rate would make things more complicated.</p>
  </blockquote>
  
  <p>If you are interested only in the "maximum" capability, don't care of the second value.
  If you use the command line or DLL, you can say to MediaInfo to not show info about legacy players with --LegacyStreamDisplay=0 option.</p>
  
  <p>Note : this is not "24-bit" as I read in another comment, bit depth in AAC is "dynamic" so no bit depth is shown for AAC (it would be shown for e.g. PCM). This output with several values is wanted by design (showing how an old decoder would decode the stream), and you can disable such behavior with the option provided.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-13T14:26:19.557Z
Answers.LastActivityDate: 2016-02-13T14:34:45.163Z
Answers.LastEditDate: 2016-02-13T14:34:45.163Z
Answers.UserDisplayName: Jérôme Martinez
Body: <p>I am working on a project that reads the meta data of video files with <a href="https://mediaarea.net/en/MediaInfo" rel="nofollow">MediaInfo</a> and processes the results. While testing my code with some sample files I noticed that the audio track of a <code>.mkv</code> file has two different samling rates. The file has two different audio tracks (English and Japanese) but they are listed separately and both tracks show two different sampling rates. Here is the according output of <code>MediaInfo</code> for clarification:</p>
  
  <pre><code>Audio #1
  ID                                       : 2
  Format                                   : AAC
  Format/Info                              : Advanced Audio Codec
  Format profile                           : HE-AAC / LC
  Codec ID                                 : A_AAC
  Duration                                 : 22mn 46s
  Channel(s)                               : 2 channels
  Channel positions                        : Front: L R
  Sampling rate                            : 48.0 KHz / 24.0 KHz &lt;-- here
  Compression mode                         : Lossy
  Delay relative to video                  : 31ms
  Language                                 : English
  Default                                  : Yes
  Forced                                   : No
  
  Audio #2
  ID                                       : 3
  Format                                   : AAC
  Format/Info                              : Advanced Audio Codec
  Format profile                           : HE-AAC / LC
  Codec ID                                 : A_AAC
  Duration                                 : 22mn 46s
  Channel(s)                               : 2 channels
  Channel positions                        : Front: L R
  Sampling rate                            : 48.0 KHz / 24.0 KHz &lt;-- and here
  Compression mode                         : Lossy
  Delay relative to video                  : 31ms
  Language                                 : Japanese
  Default                                  : No
  Forced                                   : No
  </code></pre>
  
  <p>Can anyone explain what this means? I always thought one audio track can only have one sampling rate. Is this just a different way of describing one sampling rate? Or is it really possible to use two different sampling rates for one audio track?
  At the moment, the the software just expects single values for the meta data, so storing two different values for the sampling rate would make things more complicated. Would it be possible to either convert these two values to one value or just choose one of them?</p>
  
  <p>Thanks for your help!</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-02-13T12:38:11.080Z
Comments.Text: Maybe the two channels in each stream are at different rates? Do you have ffmpeg?
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-02-13T12:42:40.270Z
Comments.Text: Yes, I also thought about that. But the only channels are left an right, so why would they have different sample sizes? I do have ffmpeg. Can I use it to get more information about the audio track?
Comments.UserDisplayName: arne.z
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-02-13T12:56:31.513Z
Comments.Text: Try `ffmpeg -i input.mkv -vn -c:a copy -map_channel 0.1.0 eng-left.aac -map_channel 0.1.1 eng-right.aac -map_channel 0.2.0 jap-left.aac -map_channel 0.2.1 jap-right.aac` and then run ffprobe on the 4 files.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-02-13T14:08:00.960Z
Comments.Text: Thanks helping. Unfortunately the command does not work for me  because the aac encoder s experimental. Even with `-strict -2`it's still not working. Is there another way to get the sample rate of one specific channel?
Comments.UserDisplayName: arne.z
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-02-13T14:09:02.530Z
Comments.Text: Which version of ffmpeg? AAC encoder became stable in early December.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-02-13T14:37:25.593Z
Comments.Text: I was using version 2.8.3. Compiling 2.8.6 now. But according to @Jérôme's answer, the tracks have indeed two sampling rates. I'll still try to get your command to work though!
Comments.UserDisplayName: arne.z
Tags: <mkv><sampling-frequency><metadata>
Title: Why does AAC have two Sampling rates?
UserDisplayName: arne.z
ThreadText: # Why does AAC have two Sampling rates?
  
  (Asked by: username_0 on 2016-02-13)
  
  I am working on a project that reads the meta data of video files with [MediaInfo](https://mediaarea.net/en/MediaInfo) and processes the results. While testing my code with some sample files I noticed that the audio track of a `.mkv` file has two different samling rates. The file has two different audio tracks (English and Japanese) but they are listed separately and both tracks show two different sampling rates. Here is the according output of `MediaInfo` for clarification:
  
  ```
  Audio #1
  ID                                       : 2
  Format                                   : AAC
  Format/Info                              : Advanced Audio Codec
  Format profile                           : HE-AAC / LC
  Codec ID                                 : A_AAC
  Duration                                 : 22mn 46s
  Channel(s)                               : 2 channels
  Channel positions                        : Front: L R
  Sampling rate                            : 48.0 KHz / 24.0 KHz <-- here
  Compression mode                         : Lossy
  Delay relative to video                  : 31ms
  Language                                 : English
  Default                                  : Yes
  Forced                                   : No
  
  Audio #2
  ID                                       : 3
  Format                                   : AAC
  Format/Info                              : Advanced Audio Codec
  Format profile                           : HE-AAC / LC
  Codec ID                                 : A_AAC
  Duration                                 : 22mn 46s
  Channel(s)                               : 2 channels
  Channel positions                        : Front: L R
  Sampling rate                            : 48.0 KHz / 24.0 KHz <-- and here
  Compression mode                         : Lossy
  Delay relative to video                  : 31ms
  Language                                 : Japanese
  Default                                  : No
  Forced                                   : No
  
  ```
  
  Can anyone explain what this means? I always thought one audio track can only have one sampling rate. Is this just a different way of describing one sampling rate? Or is it really possible to use two different sampling rates for one audio track?
  At the moment, the the software just expects single values for the meta data, so storing two different values for the sampling rate would make things more complicated. Would it be possible to either convert these two values to one value or just choose one of them?
  
  Thanks for your help!
  
  **Tags:** mkv, sampling-frequency, metadata
  
  > **Comments:**
  > **username_1**: Maybe the two channels in each stream are at different rates? Do you have ffmpeg?  
  > **username_0**: Yes, I also thought about that. But the only channels are left an right, so why would they have different sample sizes? I do have ffmpeg. Can I use it to get more information about the audio track?  
  > **username_1**: Try `ffmpeg -i input.mkv -vn -c:a copy -map_channel 0.1.0 eng-left.aac -map_channel 0.1.1 eng-right.aac -map_channel 0.2.0 jap-left.aac -map_channel 0.2.1 jap-right.aac` and then run ffprobe on the 4 files.  
  > **username_0**: Thanks helping. Unfortunately the command does not work for me  because the aac encoder s experimental. Even with `-strict -2`it's still not working. Is there another way to get the sample rate of one specific channel?  
  > **username_1**: Which version of ffmpeg? AAC encoder became stable in early December.  
  > **username_0**: I was using version 2.8.3. Compiling 2.8.6 now. But according to @username_3's answer, the tracks have indeed two sampling rates. I'll still try to get your command to work though!  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2016-02-13. Score: 7 | Accepted answer
  
  > tracks show two different sampling rates. (...) Can anyone explain what this means? I always thought one audio track can only have one sampling rate. Is this just a different way of describing one sampling rate?
  
  MediaInfo reports what is played by a decoder, depending of its capabilities:  
  - if your decoder is able to play an HE-AAC stream, the stream will be played at 48 kHz (the frequecy of the "core" + the [SBR](https://en.wikipedia.org/wiki/Spectral_band_replication) data).  
  - if your decoder is **not** able to play an HE-AAC stream, the stream will be played at 24 kHz (the frequency of the "core" AAC)
  
  > I always thought one audio track can only have one sampling rate.
  
  No. You can have a "core" stream with a specific sampling rate, decodable by old players, and an additionnal sub-stream in the stream with additionnal data for having 48 kHz for decoders capable of decoding such additional sub-stream.
  
  Note that it is same for e.g. channels, with HE-AACv2 you'll get a mono "core" + [PS](https://en.wikipedia.org/wiki/Parametric_Stereo) for upgrading to stereo. or AC-3 (and DTS) can have a 5.1 "core" lossy stream for old decoders + extra data for newest decoder in order to get 7.1 and/or lossless.
  
  > At the moment, the the software just expects single values for the meta data, so storing two different values for the sampling rate would make things more complicated.
  
  If you are interested only in the "maximum" capability, don't care of the second value.
  If you use the command line or DLL, you can say to MediaInfo to not show info about legacy players with --LegacyStreamDisplay=0 option.
  
  Note : this is not "24-bit" as I read in another comment, bit depth in AAC is "dynamic" so no bit depth is shown for AAC (it would be shown for e.g. PCM). This output with several values is wanted by design (showing how an old decoder would decode the stream), and you can disable such behavior with the option provided.
  
  
  ---
  
  ### Answer by username_2 on 2016-02-13. Score: 1
  
  I suspect that your MediaInfo parser is mis-reporting. Sampling rates are usually described both in terms of frequency and bit depth. It is quite common to have 48kHz at 24 bits. I suspect that whoever wrote the printf statements producing the above output meant to say "bits" not "KHz" after the "/".
  
  > **Comments:**
  > **username_1**: I don't see Mediainfo ever reporting sample **size** for MPEG audio streams. When it does so (for WAVs), it reports them as a separate field **bit depth**.  
  > **username_0**: I just ran mediainfo on another `.mkv` file and got Sampling rate and Bit depth in to separate fields. So I guess if the bit depth known it will be listed in a separate field, or not?  
  > **username_1**: Yes, separate field  
  
  ---
  
  