2

I am working on a project that reads the meta data of video files with 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!

  • Maybe the two channels in each stream are at different rates? Do you have ffmpeg? – Gyan Feb 13 '16 at 12:38
  • 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? – arne.z Feb 13 '16 at 12:42
  • 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. – Gyan Feb 13 '16 at 12:56
  • Thanks helping. Unfortunately the command does not work for me because the aac encoder s experimental. Even with -strict -2it's still not working. Is there another way to get the sample rate of one specific channel? – arne.z Feb 13 '16 at 14:08
  • Which version of ffmpeg? AAC encoder became stable in early December. – Gyan Feb 13 '16 at 14:09
6

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 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 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.

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 "/".

  • 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. – Gyan Feb 13 '16 at 13:57
  • 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? – arne.z Feb 13 '16 at 14:13
  • Yes, separate field – Gyan Feb 13 '16 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.