VideoHelp Forum
+ Reply to Thread
Results 1 to 8 of 8
Thread
  1. Member
    Join Date
    Aug 2018
    Location
    Canada
    Search Comp PM
    Hey Guys,

    Great info on here, have been reading topics related to my issue and thought I'd see if anyone can help me.

    Long story short is I am working with a Networked DVR which exports an interlaced .avi file. When I play back these files the lip-sync is off anywhere from 200-500 ms. Never the same. In reading a lot of posts I tried many different ways to line this back up easily, but haven't found anything that works. I was hoping using HandBrake may work, and run the file through "constant frame rate but it seems to be the audio that slips. Here are two different files, screen grabbed using MediaInfo.

    VIDEO 1
    General
    Complete name : C:\Users\msennema\Desktop\CRC\new software remot3.avi
    Format : AVI
    Format/Info : Audio Video Interleave
    File size : 3.88 MiB
    Duration : 13 s 0 ms
    Overall bit rate : 2 506 kb/s
    IsTruncated : Yes

    Video
    ID : 0
    Format : MPEG-4 Visual
    Format profile : Advanced Simple@L5
    Format settings : BVOP2
    Format settings, BVOP : 2
    Format settings, QPel : No
    Format settings, GMC : No warppoints
    Format settings, Matrix : Default (H.263)
    Muxing mode : Packed bitstream
    Codec ID : XVID
    Codec ID/Hint : XviD
    Duration : 12 s 700 ms
    Bit rate : 2 427 kb/s
    Width : 1 920 pixels
    Height : 1 080 pixels
    Display aspect ratio : 16:9
    Frame rate : 30.000 FPS
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Progressive
    Compression mode : Lossy
    Bits/(Pixel*Frame) : 0.039
    Stream size : 3.67 MiB (95%)
    Writing library : XviD 1.0.2 (UTC 2004-08-29)

    Audio
    ID : 1
    Format : PCM
    Format settings : Little / Signed
    Codec ID : 1
    Duration : 13 s 0 ms
    Bit rate mode : Constant
    Bit rate : 128 kb/s
    Channel(s) : 1 channel
    Sampling rate : 8 000 Hz
    Bit depth : 16 bits
    Stream size : 203 KiB (5%)
    Alignment : Aligned on interleaves
    Interleave, duration : 977 ms (29.31 video frames)
    Interleave, preload duration : 1000 ms

    VIDEO 2
    General
    Complete name : C:\Users\msennema\Desktop\CRC\friday.avi
    Format : AVI
    Format/Info : Audio Video Interleave
    File size : 16.9 MiB
    Duration : 1 min 22 s
    Overall bit rate : 1 731 kb/s
    IsTruncated : Yes

    Video
    ID : 0
    Format : MPEG-4 Visual
    Format profile : Advanced Simple@L5
    Format settings : BVOP2
    Format settings, BVOP : 2
    Format settings, QPel : No
    Format settings, GMC : No warppoints
    Format settings, Matrix : Default (H.263)
    Muxing mode : Packed bitstream
    Codec ID : XVID
    Codec ID/Hint : XviD
    Duration : 1 min 21 s
    Bit rate : 1 616 kb/s
    Width : 1 920 pixels
    Height : 1 080 pixels
    Display aspect ratio : 16:9
    Frame rate : 30.000 FPS
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Progressive
    Compression mode : Lossy
    Bits/(Pixel*Frame) : 0.026
    Stream size : 15.6 MiB (92%)
    Writing library : XviD 1.0.2 (UTC 2004-08-29)

    Audio
    ID : 1
    Format : PCM
    Format settings : Little / Signed
    Codec ID : 1
    Duration : 1 min 22 s
    Bit rate mode : Constant
    Bit rate : 128 kb/s
    Channel(s) : 1 channel
    Sampling rate : 8 000 Hz
    Bit depth : 16 bits
    Stream size : 1.25 MiB (7%)
    Alignment : Aligned on interleaves
    Interleave, duration : 989 ms (29.66 video frames)
    Interleave, preload duration : 1000 ms



    As you can see the audio duration is always longer then the video, and the frame rate is variable and drops to 29.66fps and 29.31fps in these examples. (always different) Is there a way to easily get these in sync without doing it manually and aligning by sight?

    Thanks in advance for any info, I'm not an expert in this field.
    Image Attached Thumbnails Click image for larger version

Name:	DVR Audio Sync.png
Views:	113
Size:	110.2 KB
ID:	46623  

    Click image for larger version

Name:	DVR AUDIO Sync 2.png
Views:	101
Size:	111.0 KB
ID:	46624  

    Quote Quote  
  2. Use VirtualDub or the newer VirtualDub2:

    1) File -> Open Video File
    2) Video -> Direct Stream Copy
    3) Audio -> Direct Stream Copy (this is the default so you don't actually have to set it)
    4) Audio -> Interleaving... set Audio Skew Correction to the required delay (negative value to advance)
    5) File -> Save As AVI.

    Audio and Video don't need to be the same length.
    Quote Quote  
  3. Member
    Join Date
    Aug 2018
    Location
    Canada
    Search Comp PM
    Can you tell by looking at those interlaced properties (interlace duration etc) what the skew is? Or do I always have to manually find it within VLC or a player where I can adjust the skew on the fly?

    Trouble I'm having is VLC and other programs I have only work in 50ms increments
    Quote Quote  
  4. You mean the interleaves? No. The audio and video are interleaved. Ie, there's some audio then some video then some more audio then some more video... The interleave duration tells you how long those interleaves are. For example, one second of audio, one second of video... The preload is just how much audio appears before the first video packet. But it does not imply a delay or advance. There are separate flags for that.

    You can use the play output function in VirtualDub to see the A/V sync. Or use an media player like MPCHC or MPCBE that lets you set the audio skew by pressing + or - on the numeric keypad, and shows you the delay currently being used. Once you've found the right delay/advance you can enter that in VirtualDub.
    Quote Quote  
  5. The MPC variants (I use MPC-HC) allow for setting the delay in 10ms increments.
    Quote Quote  
  6. Member
    Join Date
    Aug 2018
    Location
    Canada
    Search Comp PM
    Thanks guys, manual it is. I guess I was hoping there would be some sort of conversion i could do like :

    video file 1 m 10 s
    audio file 1 m 9 s
    -----------------------
    = 100ms skew

    1000 preload duration
    -984 interleave duration
    -----------------------
    = 16

    =116ms skew

    I know this is way off and was trying a few different ways, but no success. Thanks for your help, the 10ms increments are good enough for what I'm doing in MPC
    Quote Quote  
  7. Member
    Join Date
    Aug 2010
    Location
    San Francisco, California
    Search PM
    You could automate this with a Windows script and FFmpeg. Use FFprobe to send duration stats to a file (or use FOR /F), do the simple math, then call FFmpeg with -itsoffset. A bonus of this approach is that you can remux into the original container format instead of being forced into AVI.
    Quote Quote  
  8. Originally Posted by senlab View Post
    Thanks guys, manual it is. I guess I was hoping there would be some sort of conversion i could do like :

    video file 1 m 10 s
    audio file 1 m 9 s
    -----------------------
    = 100ms skew

    1000 preload duration
    -984 interleave duration
    -----------------------
    = 16

    =116ms skew

    I know this is way off and was trying a few different ways, but no success. Thanks for your help, the 10ms increments are good enough for what I'm doing in MPC
    In general, a procedure like that won't work. The audio and video in an AV file don't have to start at the same time, end at the same time, or be the same length. The preload is not the same as the skew. That said, if you find that your particular recorder does something consistent you could take advantage of that consistency to automate the process.
    Quote Quote  



Similar Threads

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