VideoHelp Forum




+ Reply to Thread
Results 1 to 16 of 16
  1. Hi
    i have 2 video files of 720P.
    in one file the video is poor but it has an audio track in the language i need.
    in the other video file the video is good but the audio is in a language that is not good for me.
    i tried to mux the good audio with the good video into one mkv. but the audio is not in synch.
    i tried to synch it with the player, & it was good. but when i scrolled the video to the end the synch was lost (it was good only at the point i set it up, at the start of the film...).
    how to synch it so it will stay in synch all the way?
    thanks
    Quote Quote  
  2. Member
    Join Date
    Aug 2015
    Location
    South Africa
    Search PM
    This means that the video and audio have two different timecodes, obviously two different sources, different encoding used.
    Try getting the timecodes from the ORIGINAL audio track and use that timecodes in the muxing process.
    It's worth a try, as I have not tested this before.
    Quote Quote  
  3. Member
    Join Date
    Aug 2015
    Location
    South Africa
    Search PM
    On command prompt do this:

    mkvextract timecodes_v2 "a movie.mkv" 1:timecodes_track1.txt

    Oh and in mkv, trackid index starts from 0 so the e.g. is getting the timecodes for the second track.
    Like I said before this is something I haven't tried so it's a 50 50 chance it may work ok.

    This is only for mkv.

    In mmg for the audio track there is an option for timecodes, simply use timecodes_track1.txt (From e.g. of course the name of your file would be different) and then re-mux.
    Last edited by Shaylen; 12th Sep 2015 at 08:09.
    Quote Quote  
  4. It's not that simple.
    Quote Quote  
  5. Member
    Join Date
    Aug 2015
    Location
    South Africa
    Search PM
    Originally Posted by sneaker View Post
    It's not that simple.
    Like I said, it's a 50 50 chance of it working.

    The other way is to do it manually which is another long story,
    I know the process but I'm a lazy person so...

    If you want to go the long way then here it is:
    1. Play the file, carefully analyzing at which point the audio goes off sync and at that point,
    use the player to +/- a delay and record the times it has to be adjusted and by what delay.
    [Remembering that the delay is accumulating]

    2. Once that process is over. Use GoldWave to edit the audio track.
    At the times it goes off sync, you either have to add silence at the point or slightly trim out the audio,
    this is dependent on whether the delay in your recording of data is positive or negative, [pray it's positive]

    3. Export the finished track and compress audio using Audiocoder and that's it.

    It'll take me a long time to do this especially if it's a movie.

    This is just an idea. If the simplier way works it'll be so awesome rather than doing this.

    Another thing to think about is the speed at which it's sources is.
    The problem could also be a speed up in either one of the sources.

    You could adjust the frame rate of the video when muxing
    or ReEncode the audio at a different speed.
    Last edited by Shaylen; 12th Sep 2015 at 10:49.
    Quote Quote  
  6. Originally Posted by Shaylen View Post
    On command prompt do this:

    mkvextract timecodes_v2 "a movie.mkv" 1:timecodes_track1.txt

    Oh and in mkv, trackid index starts from 0 so the e.g. is getting the timecodes for the second track.
    Like I said before this is something I haven't tried so it's a 50 50 chance it may work ok.

    This is only for mkv.

    In mmg for the audio track there is an option for timecodes, simply use timecodes_track1.txt (From e.g. of course the name of your file would be different) and then re-mux.
    run it at the good audio file Or at the good video (bad audio file)?
    how to run it with mp4? (one is mkv, the other mp4).
    thanks
    Quote Quote  
  7. Member
    Join Date
    Aug 2015
    Location
    South Africa
    Search PM
    Do this with the bad audio file [this has to be in mkv though] because you want that timing not the good audio's timing,
    that's why it off sync. Get the timecodes from the bad audio and use that timecodes for the good audio.

    Again this is not tested, thanks for looking into it, reply if it works or you have to go the long way,
    that's if it's something you really want.

    I'll go through mp4box and try to get a solution. The thing is that I don't know if you extract the tracks from mkv,
    whether it'll extract with the old or new timecodes. If it's the new then you can put it into mp4 afterwards.

    Extraction from mkv:

    mkvextract tracks "file.mkv" 0:"C:\\video.*" 1:"C:\\audio.*"

    * meaning the extension

    Open command prompt

    mp4box -add "video":name="" -fps value -add "audio":name="" -new "C:\\newFile.mp4"
    Last edited by Shaylen; 17th Sep 2015 at 14:43. Reason: Error in syntax: out --> new on last line
    Quote Quote  
  8. could you tell me how to get the timecodes from the audio from mp4 file?
    thanks
    Quote Quote  
  9. Member hech54's Avatar
    Join Date
    Jul 2001
    Location
    Yank in Europe
    Search PM
    This is what happens when people who THINK they know what they are talking about are actually just talking(typing) to make themselves sound smarter than they really are.
    Timecodes? On an MP4 file? Really?
    Quote Quote  
  10. What are the video frame rates? If one is 23.976fps and the other is 25fps etc, you might get lucky. You could open the MP4 containing the good video with MKVMergeGUI, add the second MP4, deselect the video and audio tracks you don't want, change the frame rate of the video you're keeping as appropriate, then mux that as a new MKV. You might still need to specify a delay for the audio, but you can do so when muxing. If setting an audio delay (positive or negative) and changing the video frame rate does the job, you're lucky. If not.....

    I'd open the original MP4s with MKVMergeGUI and remux each as an MKV, then I'd use MKVCleaver to extract the audio from each MKV and compare the durations (or you could extract the audio directly from each MP4 if you're familiar with doing so). That'd enable you to express the difference as a fraction (in seconds or milliseconds etc). For example if audio A is 3600 seconds and audio B is 3754 seconds it'd be 3600/3754 (or the other way around).

    Using MKVMergeGUI you could open the MP4 containing the "good" video, deselect the "bad" audio stream and add the "good" audio. It's usually better to apply stretching to the video rather than the audio (stretching audio can cause pops and clicks on playback, whereas stretching video just changes the frame rate). Enter the fraction representing the difference in audio durations in the section for stretching the video and mux as a new MKV.

    The whole process can be very hit and miss, and not likely to work. You said there's an audio delay required for the video and audio to be in sync at the beginning. You can apply that delay to the audio stream using MKVMergeGUI when muxing, but you'd probably need to factor it in when working out how much to stretch the video. The problem is, even if you manage to find the right audio delay and video stretch so the audio is perfectly in sync at both the start and end, there's no guarantee it'll always be in sync in between. Two videos which appear to be identical are often edited slightly differently. A frame or two here, a couple of frames there..... and that makes it impossible to sync the audio by simply stretching and/or applying a delay.

    Hopefully the above instructions make sense. Good luck.
    Quote Quote  
  11. well i think this is the problem - the mkv with the good audio is 50fps(!) that is strange... but i checked the properties & its 50.
    & the mp4 with the good video is 25 fps...
    Quote Quote  
  12. It's possibly 25fps interlaced, which some software will report as 50fps. Either that or it was 25fps interlaced, and it was de-interlaced when it was encoded. You can de-interlace 25fps interlaced to either 25fps progressive or 50fps progressive. The latter gives you smoother motion because there's twice as many frames, but the frames go by at twice the speed so the duration stays exactly the same.

    Chances are the two versions of the video have been edited slightly differently. If you can sync the audio at the beginning and the sync goes out as the video progresses, but the sync changes in distinct steps, then you'd literally need to edit either the audio or video yourself to match them up again (for example the sync might be 100ms out for several minutes, then all of a sudden it might change to being 250ms out, but it'll stay 250ms out for quite a while, then suddenly it'll jumps to being 500ms out etc, etc).

    I might also depend on the type of video it was to begin with. If it was film (24fps) mostly that's converted to 25fps simply by speeding it up, but other methods are sometimes used that don't involve speeding it up so the duration doesn't change. If it was a film converted to 25fps using different methods, then changing the frame rate might be enough to sync them again.... you can only experiment to see if it works.
    Last edited by hello_hello; 13th Sep 2015 at 21:53.
    Quote Quote  
  13. Member
    Join Date
    Aug 2015
    Location
    South Africa
    Search PM
    Yeah you can't deal with timecodes in mp4, there's just no way in that container. I went through the switches in mp4box and there's nothing available.
    Last edited by Shaylen; 17th Sep 2015 at 15:19.
    Quote Quote  
  14. DECEASED
    Join Date
    Jun 2009
    Location
    Heaven
    Search Comp PM
    Originally Posted by Shaylen View Post
    Originally Posted by hech54 View Post
    Timecodes? On an MP4 file? Really?
    Yeah you can't deal with timecodes in mp4, I agree, there's just no way in that container. I went through the switches in mp4box and there's nothing available.
    Code:
    [C:\]
    =>mp4fpsmod
    mp4fpsmod 0.24
    usage: mp4fpsmod [options] FILE
      -o <file>             Specify MP4 output filename.
      -p, --print <file>    Output current timecodes into timecode-v2 format.
      -t, --tcfile <file>   Edit timecodes with timecode-v2 file.
      -x, --optimize        Optimize timecode
      -r, --fps <nframes:fps>
                            Edit timecodes with the spec.
                            You can specify -r more than two times, to produce
                            VFR movie.
                            "nframes" is number of frames, which "fps" is
                            aplied to.
                            0 as nframes means "rest of the movie"
                            "fps" is a rational or integer.
                            For example, 25 or 30000/1001.
      -c, --compress-dts    Enable DTS compression.
      -d, --delay <n>       Delay audio by n millisecond.
      -T, --timescale <keep|n>
                            keep: Keep original timescale.
                            n: Set timescale of videotrack to n.
    
    [C:\]
    =>
    Download from:

    https://sites.google.com/site/qaacpage/cabinet
    Quote Quote  
  15. Member
    Join Date
    Aug 2015
    Location
    South Africa
    Search PM
    I edited my previous statement and removed the quote.
    I also thought quoting what that guy said was harsh so ya..

    @El Heggunte
    Cool man, just cool.
    Quote Quote  



Similar Threads

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