I have some MKV files which contain h.264 video and a DTS soundtrack. My goal is to make an HD-Divx (with DTS audio) file out of this since my media player cannot handle h.264. I've done this several times (dozens actually) and lately I'm getting audio sync issues.
I extract the audio using MKVExtract and get a DTS file. I then use mkv2vfr to convert h264 to avi. At this point I would normally load into TMPGEnc and convert to Divx. Then use AVI-Mux to combine the files back together. However when I do this the video is several seconds behind the audio. I tried simply re-muxing the avi file created with mkv2vfr with the DTS file thereby eliminating the divx conversion as the possible culprit but it is still screwed up.
Seems like the frame rate is wrong. When I use mkv2vfr it always defaults to 23.976 as the framerate. Is there a way to change this? Am I even on the right track? The video is behind the audio and gets worse as the movie progresses.
Any thoughts here? FWIW never had this problem until recently (or rarely) and never once with an AC3 encoded audio stream. Seems to only affect DTS files. I've experimented with converting DTS to AC3 but it is a lengthy process with inconsistent results. Any help would be appreciated.
+ Reply to Thread
Results 1 to 29 of 29
-
-
What are the duration (lengths) of audio & video? Use mediainfo.
You can check both the .mkv and the output of mkv2vfr to give a clue if the process caused the problem. If they don't match, you will have a progressive sync problem.
It shouldn't make a difference encoding DTS=>AC3, but if you wanted to EAC3TO can do this conversion -
Hi there.
Then use AVI-Mux to combine the files back together.
The official site of Avi-Mux says:
Version 1.17.8
--- fixed bugs
DTS streams with frames of 2012 bytes got a wrong duration because the PCMSampleCount header field was not used. This made the audio go out of sync. -
I'll be damned. The extracted .dts file is 2 minutes shorter than the one inside the MKV. Using mediainfo the MKV reports the audio track as 1:44 min and the extracted .dts file using MKVExtract says 1:42. I guess this is my problem. How do I fix?
I'm using MKVextractGUI.exe version 1.6.4.1 dated 4/27/2007 -
Originally Posted by cg1200
For now, I can think of only one workaround,
which requires the use of Avisynth:
build a DirectShow graph for your MKV with GraphEdit,
open it with an audio-only .AVS file which would also load the SoundOut plugin,
convert the decoded audio stream into a .AC3 file.
Will this convoluted process solve the sync problem? I really don't know.
Good-luck! -
It might be that mediainfo is reporting incorrectly
Try muxing the raw AVC stream (from mkvextractgui) into an mp4 container using YAMB (make sure you enter the proper FPS manually), then use mediainfo on the video to determine the length
Converting the audio will unlikely fix the problem. In addition to Midzuki's suggestion, other options include EAC3TO, and foobar2000 with the .dts plugin can convert it
When you used mkv2vfr, open the timecodes file - did it show a vfr pattern? -
I tried converting the DTS to AC3 using Hypercube Transcode by creating 6 mono wav files then using Besweet to combine into a single AC3. The resulting AC3 file was 1:44 min! What the heck???
Avi-Mux 1.17.8 won't work on my VIsta machine. As soon as I double click it I get a program closed error. Don't get that either.
poisondeathray - I'm not familiar with YAMB. Could you be more specific with what you suggested? -
Originally Posted by cg1200
Stop complaining already!
Avi-Mux 1.17.8 won't work on my VIsta machine. As soon as I double click it I get a program closed error. Don't get that either. -
Originally Posted by Midzuki
I would call my conversion to AC3 a workaround not a solution. I just don't understand. How could the 2 minutes disappear during the mkvextract and then re-appear during the conversion to AC3? Also using EAC3TO was a great suggestion. Great tool. I don't think the file is being reported incorrectly by mediainfo. When I mux back together the DTS track and the avi the DTS soundtrack is 2 min shorter than the movie every single time. I have 3 movies where it's doing the exact same thing. -
I think mediainfo is misreading the audio track duration in the .mkv. There was a fix in eac3to recently and i think mediainfo hasn't been updated yet to parse DTS tracks correctly: "fixed: DTSWAV and DTSAC3 readers reported too long runtime"
When you use mkv2vfr, the cfr avi will have the same # frames but play at constant rate. You can check the duration it should be different than the one in the original .mkv, but the framecount should be the same. You can't just mux it back to .mkv; you need to use the timecode file to get it insync. You can test this with mkvmergegui
Since you are converting the video anyway, it might be easier to use an .avs script. This is the recommended "easy" way to treat vfr video as suggested in the avisynth wiki, and I have used it successfully before on VFR video (with DTS as well)
DirectShowSource("PATH\file.mkv",fps=23.976,conver tfps=true,audio=false)
Feed that into virtualdub, configure the DivX settings to unrestricted to get HD resolutions, and specify audio=>from other file & select the .dts -
I'm not sure I agree. Mediainfo reads the mkv file properly. shows the video and audio as both being 1:44 minutes. When i run the mkv through mkvextract, the mp4 video shows 1:44 but the DTS track shows 1:42. If i mux the mp4 video with the DTS track it comes out off. But I have no idea how running it through EAC3TO "fixes" it. That would point to an incorrect reading from mediainfo. Even if mediainfo is wrong when I mux the DTS track back with the video the soundis off. It's definitely missing those minutes. I really don't get it.
I have some experience using avs scripts and vdub (thought vdub occasionally hangs on my vista machine). I'll give it a shot. -
Originally Posted by poisondeathray
-
It works here... do you have recent version of vdub?
You might need the vdub directshow input driver, but I doubt it
Don't forget to use video=>fast recompress mode, or you will pointlessly do a colorspace conversion
EDIT: I just checked and I can confirm the the reported duration discrepancy in mediainfo between .mkv and extracted .dts. It's just a reporting error.
If you specify audio=true in the script, you will have to re-encode the audio, so "audio from other file" is the best choice
EDIT againsorry, vdub doesn't seem to like .dts audio and converts it to pcm wav. You can still do the video conversion, but use avimux-gui to mux in the .dts - tested and working on a .mkv with .dts (with duration reporting discrepancy in the extracted .dts) and in proper sync. If you already did the video conversion, there is no need to do it again, just checkmark the streams you want to keep, uncheckmark the streams you don't want in avimux-gui (e.g. add the .dts)
Cheers -
Originally Posted by poisondeathray
I've been using TMPGEnc to do the video conversion from h264 to Divx. When I mux the divx file with the DTS file (using Avi-Mux-GUI) its out of sync. Are you saying if I encode using virtualdub [I have version 1.7.8] I should be able to mux back with the extracted DTS file and it will be in sync? I don't see how that will help? I've been using avi-mux all along both version 1.17 and 1.18 and getting out of sync movies. How will running through virtualdub help? -
It doesn't have to be virtualdub - it's the .avs script that fixes the video (the "convertfps" part). I think TMPGEnc accepts .avs scripts, then you can use that too (any encoder that accepts avs scripts). Just change the path, and true fps (should be 23.976 since you are in NTSC land, but check with mediainfo.)
It's the video that's the problem, not the audio. I can confirm that the .dts duration is misread (It was different in the .mkv from the demuxed .dts), and this procedure works on my vfr .mkv's (I just tried it again today to confirm, and it's worked before in the past)
If you want to read more about vfr video http://avisynth.org/mediawiki/VFR -
No dice. Did not work. Audio is still off. I created a text file (named .avs) with the below line:
DirectShowSource("J:\DOWNLOAD\s-fk\kingdom.mkv",fps=23.976,convertfps=true,audio=f alse) in it.
Fed it into TMPGEnc, then muxed the DTS soundtrack back in. Audio is still a second or two ahead of the video. Did I do something wrong?
Also, if what you say is true I don't understand why converting the soundtrack from DTS to AC3 corrects the issue if the video fps is the issue.
I'll try virtualdub just for laughs... -
Verify that 23.976 was the acutal fps (not 25 for example, from a PAL source)
Did you use the newer version of avimux-gui?
Is your directshow filter chain clean? Like no postprocessing filters through ffdshow, directshow filters etc...?
Is this a constant sync problem? You can test playback in MPC or Mplayer by using +/- to figure out the delay in ms. If so, just enter the audio delay in avimux-gui to sync it up
Also, if what you say is true I don't understand why converting the soundtrack from DTS to AC3 corrects the issue if the video fps is the issue.
When I did my recent test, mediainfo reported the .mkv video & audio as 1:03, but the demuxed .dts as 1:02. When I did the conversion, and remuxed the untouched .dts, the .avi duration was 1:03, but it did not report the audio duration. So I just put this into a .mkv, and magically the reported audio duration was 1:03 again. All files in sync. This is why I think the .dts duration is misreported -
Good point...so you are saying the 1:44 AC3 is in sync when you mux it with the .avi you generated with mkv2vfr ?
So I just put this into a .mkv, and magically the reported audio duration was 1:03 again. All files in sync. This is why I think the .dts duration is misreported -
Do you mean the AC3 plays in sync with the mkv2vfr converted .avi, or the .mkv without timecodes, or the .mkv with timecodes?
Yes there are different kinds of DTS, e.g. DTS-HD MR, DTS-HD MA, a few other versions. If your .dts file is 1536kbps, chances are it's the normal garden variety of .dts
Sorry if I wasn't clear. My .avi was in sync. I only put it into an .mkv to read the audio duration (it wasn't reported in the .avi container for some reason, only the video duration). The audio duration reported is clearly misread somewhere, since I did no transcoding of the audio.
If you try muxing the .dts back into the mkv container it is supposed to be out of sync (assuming you have a vfr .mkv), unless you use the timecodes
I am beginning to think our files might be different - either the video and/or audio. I am certain mine is a vfr .mkv because I made it. I asked earlier if your timecodes showed a vfr pattern (read the wiki link on how to do this).
The other possibility is your direct show filter chain is not clean, and you are not getting frame accuracy for video transcoding when using DirectShowSource.
I admire your dedication, but if it was up to me with all the failed attempts, I would just stick with the AC3 if it's in sync... the audio quality difference isn't that big even on a expensive home theatre setup -
Do you mean the AC3 plays in sync with the mkv2vfr converted .avi, or the .mkv without timecodes, or the .mkv with timecodes?
Yes there are different kinds of DTS, e.g. DTS-HD MR, DTS-HD MA, a few other versions. If your .dts file is 1536kbps, chances are it's the normal garden variety of .dts
Sorry if I wasn't clear. My .avi was in sync. I only put it into an .mkv to read the audio duration (it wasn't reported in the .avi container for some reason, only the video duration). The audio duration reported is clearly misread somewhere, since I did no transcoding of the audio.
I am beginning to think our files might be different - either the video and/or audio. I am certain mine is a vfr .mkv because I made it. I asked earlier if your timecodes showed a vfr pattern (read the wiki link on how to do this).
I admire your dedication, but if it was up to me with all the failed attempts, I would just stick with the AC3 if it's in sync... the audio quality difference isn't that big even on a expensive home theatre setup.
Thanks again for trying to solve this with me. I wish we had a definitive answer. I'm at least grateful that the AC3 conversion works even if I haven't a clue as to why. -
Me too would like to understand why the heck there exist DTS streams that
will present sync problems after being demuxed.I thought that
Ogg Vorbis and Windows Media Audio were the only bad boys on the block,
so to speak. When I find the time to (i.e., after I finally buy a new HDD and
install XP Service Pack 3 on it 8) ), I will try to study the problem harder. -
Well, after re-reading this thread for the umpteenthtime,
and especially after reading the infamous "ts_102114v010201p.pdf",
I have a wild-guess: the "problematic" DTS streams the OP was talking about
could have ¡variable-bitrate!. Yes, me too thought
"there is no such thing as a VBR DTS file", but it seems I was wrong.
Probably AVI-Mux GUI was not designed to
detect VBR DTS and so, it will not "flag" such streams accordingly,
which might explain the sync issue in those AVIs.
Just my 3 euros...Last edited by El Heggunte; 24th Apr 2010 at 20:02.
Similar Threads
-
Ripbot and keeping dts-hd track issue
By cburbs in forum Blu-ray RippingReplies: 1Last Post: 17th Feb 2012, 15:21 -
DTS to AC3 audio conversion (using MP4Tools on a Mac) issue/problem
By SimonSimon in forum AudioReplies: 1Last Post: 1st Sep 2011, 04:41 -
DTS Audio Issue?
By jboogie713 in forum AudioReplies: 2Last Post: 8th May 2010, 14:40 -
Issue with TSMuxer and DTS audio
By ma2kp in forum Video ConversionReplies: 2Last Post: 25th Oct 2008, 13:16 -
MKV with DTS audio sync problem
By WidowMaker in forum AudioReplies: 2Last Post: 14th Oct 2008, 14:10