View Full Version : mkv audio pitch issue
pseprodux
16th October 2006, 06:49
hi, so i've been trying to cut a clip out from an ending of an anime episode..i've used megui to transcode the video from xvid to x264 in mkv, and the audio from vbr mp3 into aac-encoded mp4. both of these transcoded files play correctly by themselves; however, when i mux the streams together in mmg, the resulting mkv plays at a whole-tone too high in pitch. i then tried the same process, except muxing to mp4, and the resulting file plays correctly. i've transcoded a number of other files in this method in the past, and this is the first time i've had this happen.
any help on why this is happening would be much appreciated.
edit:
5 second samples:
blood+ ed3 sample_audio.mp4 (http://rabbit.eng.miami.edu/students/epeng/blood+ ed3 sample_audio.mp4) (audio stream being used)
blood+ ed3 sample_final.mkv (http://rabbit.eng.miami.edu/students/epeng/blood+ ed3 sample_final.mkv) (plays a whole-tone too high)
blood+ ed3 sample_video.mkv (http://rabbit.eng.miami.edu/students/epeng/blood+ ed3 sample_video.mkv) (video stream only, before muxing above)
blood+ ed3 sample_final.mp4 (http://rabbit.eng.miami.edu/students/epeng/blood+ ed3 sample_final.mp4) (plays correctly)
blood+ ed3 sample_video.mp4 (http://rabbit.eng.miami.edu/students/epeng/blood+ ed3 sample_video.mp4) (video stream before muxing into mp4)
Kurth
18th October 2006, 07:33
The Audio stream of your file is using sample rate 96 Hertz I think that is why you are having this problem with your audio.
When I encode AAC using the Nero Digital Audio encoder and produce files with AAC-LC this MP4 file play fine without any problems but when you mux it into an MKV the audio sample rate jump from 48 hertz to 96 hertz.
If you demux the audio track of this MP4 file created using the Nero encoder and remux the Raw-AAC back to MP4 using YAMB the new MP4 file when muxed on MKV will not have this problem the audio sample will be correctly at 48 hertz inside the MKV file.
pseprodux
18th October 2006, 16:53
weird, that solved the problem. thanks a bunch.
a couple more questions, then:
first, my audio stream has a sample rate of 44.1 khz. i checked the matroska info of the two the different muxed mkvs, the incorrect pitch one and the new, correct one - both say that the sampling rate is 44.1 khz, but the incorrect one indeed says that the output sample rate is 96 khz. is there a way to control output sampling rate? and why does it jump to 96 khz only when using the aac-mp4 encoded by nero digital audio? does it have something to do with how megui/nero digital audio muxes the aac audio into mp4? however, the sample rate seems right on both aac-mp4s though.. or is it something else?
Kurth
18th October 2006, 19:33
Even if you dont use MeGUI to encode the audio this error still happen.
Maybe MKVMerge have some problems to understand the commands inside que MP4 container of the audio created with Nero Encoder and when you mux this audio on a MKV container MKVMerge apply SBR again and double the sampling rate of the audio track.
Another thing that is weird if you use on FFDshow Libfaad2 to decode the decoder say 96000Hz SBR AAC but if you use the Realaac the decoder say 48000Hz SBR AAC.
I encoded the audio using AAC-LC why the hell the decoder apply SBR to the decoding this is really weird the decoder is not supposed to use SBR on this audio track. Seems that those decoders that we have today dont understand correctly the Nero Audio inside MKV containers.
If you mux video+audio on MP4 container this sampling rate error dont happen.
This error is really weird I dont know which one is the real problem MKVmerge or Audio Decoder.
While we dont solve the problem just continue using that remuxing trick for MKV container.
pseprodux
19th October 2006, 08:58
hm, i did decided to do a little more testing, and the problem is only apparent when encoding aac with nero. for some reason, when muxing aac-mp4 encoded with nero digital audio encoder, or the old neroaacenc into mkv, the output sample rate in the mkv is made 96 khz. the problem does not happen the aac audio is created with faac, nor when muxing nero audio into mp4. however, the problem is only audible and apparent when the sample rate of the aac-mp4 is 44.1 khz; there is no pitch difference when the original sample rate is 48 khz and the output sample rate is 96 khz. that would explain why i had no problems before until now, since it turns out that all my previous audio sources were 48 khz.
so...why it happens, i still have no clue. maybe mkvmerge doesn't like how nero encodes aac-mp4s, since mp4box has no problem with them, and faac works fine.
Mosu
3rd November 2006, 17:09
Your sample file has a problem. AAC-in-MP4 contains a 2 or 5 bytes long identifier which contains the number of channels, the AAC profile used and the sampling frequency. If the config data is 5 bytes long (which it is in your case) then the fifth byte contains the output sampling frequency (rather an index into a pre-defined table of sampling frequencies). Your original .mp4 file's fifth config byte is 0. The output sampling frequency for the index 0 is 96000.
So either the file is broken or mkvmerge is reading the codec data wrong (which I doubt).
Mosu
3rd November 2006, 17:14
Hmm, it's also possible that even though there are 5 bytes config data that this isn't SBR... In which case the output sampling frequency shouldn't be used at all. Have to investiate further.
Mosu
3rd November 2006, 17:37
You guys can download this build which should fix the bug: http://www.bunkus.org/videotools/mkvtoolnix/win32/pre/mkvtoolnix-unicode-1.7.0-build20061103-1.rar
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.