VideoHelp Forum




+ Reply to Thread
Results 1 to 29 of 29
  1. Member
    Join Date
    Feb 2008
    Location
    United States
    Search Comp PM
    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.
    Quote Quote  
  2. 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
    Quote Quote  
  3. Banned
    Join Date
    Jun 2007
    Location
    UNREACHABLE
    Search Comp PM
    Hi there.

    Then use AVI-Mux to combine the files back together.
    Assuming that you meant "Avi-Mux GUI": are you using the latest version
    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.
    HTH.
    Quote Quote  
  4. Member
    Join Date
    Feb 2008
    Location
    United States
    Search Comp PM
    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
    Quote Quote  
  5. Banned
    Join Date
    Jun 2007
    Location
    UNREACHABLE
    Search Comp PM
    Try TSMuxeR for demuxing the mkv and check whether that makes a difference.
    Quote Quote  
  6. Member
    Join Date
    Feb 2008
    Location
    United States
    Search Comp PM
    Originally Posted by Midzuki
    Hi there.

    Then use AVI-Mux to combine the files back together.
    Assuming that you meant "Avi-Mux GUI": are you using the latest version
    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'm using 1.17.7 but isn't the problem MKVextract? That's what I'm using to extract the DTS file in the first place. The resulting extracted dts file is 2 min shorter than the orignial in the MKV. I can try it though.
    HTH.
    Quote Quote  
  7. Member
    Join Date
    Feb 2008
    Location
    United States
    Search Comp PM
    Originally Posted by Midzuki
    Try TSMuxeR for demuxing the mkv and check whether that makes a difference.
    Tried TSmuxer, no difference. Resulting DTS file is still showing as 1:42 instead of 1:44. WTF? I don't get it. Where are those 2 minutes going?
    Quote Quote  
  8. Banned
    Join Date
    Jun 2007
    Location
    UNREACHABLE
    Search Comp PM
    Originally Posted by cg1200
    Originally Posted by Midzuki
    Try TSMuxeR for demuxing the mkv and check whether that makes a difference.
    Tried TSmuxer, no difference. Resulting DTS file is still showing as 1:42 instead of 1:44. WTF? I don't get it. Where are those 2 minutes going?
    Me either has no idea of WTF is going on with that wicked DTS stream
    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!
    Quote Quote  
  9. 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?
    Quote Quote  
  10. Member
    Join Date
    Feb 2008
    Location
    United States
    Search Comp PM
    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?
    Quote Quote  
  11. Banned
    Join Date
    Jun 2007
    Location
    UNREACHABLE
    Search Comp PM
    Originally Posted by cg1200
    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???
    If the AC3 is in-sync with the video, you have found a valid solution to the problem.
    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.
    Try running it under the "Windows XP compatibility mode".
    Quote Quote  
  12. Member
    Join Date
    Feb 2008
    Location
    United States
    Search Comp PM
    Originally Posted by Midzuki
    Originally Posted by cg1200
    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???
    If the AC3 is in-sync with the video, you have found a valid solution to the problem.
    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.
    Try running it under the "Windows XP compatibility mode".
    Hey that worked (running in XP mode)! Thanks.

    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.
    Quote Quote  
  13. 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
    Quote Quote  
  14. Member
    Join Date
    Feb 2008
    Location
    United States
    Search Comp PM
    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.
    Quote Quote  
  15. Did you mux it back with the timecodes? otherwise it should be out of sync

    Play the extracted .dts and .ac3 converted file (by eac3to) with vlc or mpc. Are they the same duration?
    Quote Quote  
  16. Member
    Join Date
    Feb 2008
    Location
    United States
    Search Comp PM
    Originally Posted by poisondeathray
    and specify audio=>from other file & select the .dts
    How do I do this in virtualdub? How do I add audio? All it seems to want is a wav file.
    Quote Quote  
  17. 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 again sorry, 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
    Quote Quote  
  18. Member
    Join Date
    Feb 2008
    Location
    United States
    Search Comp PM
    Originally Posted by poisondeathray

    EDIT again sorry, 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
    First off, thank you for your help!

    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?
    Quote Quote  
  19. 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
    Quote Quote  
  20. Member
    Join Date
    Feb 2008
    Location
    United States
    Search Comp PM
    Originally Posted by poisondeathray
    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.)
    Ahh. I get it. TMPG definitely accepts avs scripts. I will give it a shot and report back. Thanks again for your help.
    Quote Quote  
  21. Member
    Join Date
    Feb 2008
    Location
    United States
    Search Comp PM
    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...
    Quote Quote  
  22. 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.
    Good point...so you are saying the 1:44 AC3 is in sync when you mux it with the .avi you generated with mkv2vfr ?

    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
    Quote Quote  
  23. Member
    Join Date
    Feb 2008
    Location
    United States
    Search Comp PM
    Good point...so you are saying the 1:44 AC3 is in sync when you mux it with the .avi you generated with mkv2vfr ?
    Yes. When i convert the DTS to AC3 using EAC3TO the AC3 file comes out with the correct length (same as the movie) and plays in sync. I have no idea why but it's worked every time and the quality is quite good (so at least I have a workaround). I have at least 5 or 10 movies with the DTS soundtrack and the divx in sync so I know this has worked normally in the past. I wonder if it has something to do with the newer DTS (isn't there a true DTS or something now?) formats and the extract tools not properly handling them?

    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
    This is the difference. I'm not muxing to create an mkv, I'm muxing to create an avi (divx) file. My goal is to have an HD divx since my media player can only handle divx not mkv natively. Can you try creating an avi instead of an MKV with avi-mux and see if the audio is out of sync with your test file? I bet it will be off like mine.
    Quote Quote  
  24. 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
    Quote Quote  
  25. Member
    Join Date
    Feb 2008
    Location
    United States
    Search Comp PM
    Do you mean the AC3 plays in sync with the mkv2vfr converted .avi, or the .mkv without timecodes, or the .mkv with timecodes?
    The AC3 file plays in sync with my divx encoded avi file or with the raw h.264 video file extracted from the MKV (when I mux into an avi or mkv). If I re-mux the DTS soundtrack with either the h.264 or the converted divx avi into an avi container, the audio is ahead of the video. I've never messed with timecodes, don't even know what they do.

    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
    All of the files i've been dealing with show 1536kbps so I guess I'm wrong about that.

    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 tried this too - making an MKV file out of my divx avi and the extracted DTS file and naturally it came out fine. Audio and video in sync and showing the proper duration.


    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 make the vfr file myself by using mkv2vfr. It produces an avi file which i then convert to divx using TMPGEnc.

    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.
    Quite right. AC3 is just fine. I guess I'm just fascinated as to why it all of a sudden stopped working. I've been using the same method for over a year and all of a sudden it just stopped working. Until someone recommended EAC3TO my conversion to AC3 was painful and sounded like crap. But EAC3TO really works well. So well I think I'm throwing in the towel. I guess I will never really understand. It has to be something with the audio track. MKV's with AC3 soundtracks work perfectly every time. It's only with DTS soundtracks where I run into this.

    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.
    Quote Quote  
  26. Banned
    Join Date
    Jun 2007
    Location
    UNREACHABLE
    Search Comp PM
    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.
    Quote Quote  
  27. Had the same problem. Extracted DTS (and converted ac3) had length 82 min. Video itself had 87 min and out of sync with ac3. I changed video fps from 23.979 to 25 fps and remuxed with ac3 audio (TSremuxer). Got film 82 min length. Perfect synchronization.
    Quote Quote  
  28. DECEASED
    Join Date
    Jun 2009
    Location
    Heaven
    Search Comp PM
    never mind
    Quote Quote  
  29. DECEASED
    Join Date
    Jun 2009
    Location
    Heaven
    Search Comp PM
    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.
    Quote Quote  



Similar Threads

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