Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using VLC 1.1.9 on Ubuntu 11.04 and constantly have to adjust the audio-delay when playing videos to get the audio/video in sync (usually about -400ms but it varies occasionally, sometimes -250 and sometimes 0...)

Why would this happen? How can I fix it? or at a minimum set a default audio delay to save myself some effort...

I don't seem to have the same issue with mplayer or Totem, so I don't think it's a system/sound setup issue, and I haven't noticed a pattern with the file types, it happens with .avi, .mp4 etc.

share|improve this question
    
Have you tried the same videos in both players and found that the issue only exists when the file is played with VLC? I've seen that happen on some videos, but it was the encoding of the video that caused it. –  MaQleod Sep 3 '11 at 1:42
    
Yes, the same file will have a delay in VLC, but not in mplayer/Totem. –  Tom Sep 6 '11 at 0:28

1 Answer 1

In VLC there are 3 items, which should effect how a frame skip, or Uneven length of Audio vs Video is handled. In VLC the Tools menu select Preferances. You may have to switch to the All mode instead of SIMPLE mode to see them all.

in AUDIO, the [ ] Enable time stretching mode

I assume this attempts to correct for an audio and video stream that are offset in length from each other. It skips video or changes the playback rate of the audio so the 2 streams end at the same time.
This can be good or this can be very bad, it just depends on if the audio did run longer than the video, or offsets and other data things that can exist. It could Help one video with it on, and Hurt another video with it off. Any video that the program fully understands, and that was encoded properly, it would not matter if it is on Or off.

in VIDEO 2 things [ ] Drop Late frames & [X] Skip Frames

One of these allows for the video to drop a video frame , when the player/computer cannot keep up with the playback. As I try and explain below, this can cause an initial offset of the AV, or Not depending on many other factors. It can continue to get worse and worse as frames are skipped.

Usually you would want to set better settings, or use a better decode method, or display method to Never have a single dropped frame. Disabling any extra and uneeded processing of the video data, can also free up the work required to display. So if you can try and find out why your machine can't keep up, or change the display render method to something more simple.

The other is probably the handling of Broken frames or data, which brings up another whole array of things that can happen, when data is corrupt that can take the AV out of sync.

Change these 3 items, till that One video plays correctally, and hope that the next video you get is similar :-) There is no ONE way to set these for all videos and all machines. I can guarentee that there are videos out there, that are not encoded right, and all the switches in the world will not completly fix it :-)


I am not going to use all the correct technical , this is just how I simply understand it

When playing a video in about any player, if the video skips a beat looses a frame, and the audio keeps going along as if nothing happened, the audio and video get out of sync.

The audio and video are actually 2 different streams of data , even if they come out of the same file in many of your AV player situations. This audio and video can be interleaved in the data stream at different intervals of time or frames, or not at all, it could even be a seperate file.

it can be like this in the file actually, Poor player trying to figure out how to keep those 2 synced :-)

|----A-U-D-I-O-------------------------------|=======V=I=D=E=O===========================|

But more commonly like this

|----A-----|=======V=====|----A-----|=======V=====|----A-----|=======V=====|

If you have a tight "interleave" of the data it can be like this

|-A-|=V=|-A-|=V=|-A-|=V=|-A-|=V=|-A-|=V=|-A-|=V=|-A-|=V=|-A-|=V=|-A-|=V=|

If you ever go to re-encode or encode a video, if possible use an encoder that can set a tight AV interleave and even if the video skips a beat or you FFWD or RRWD the video will stay in sync much better. Virtual Dub, still one of the best things for Free messing with a video, you can just pass through a video "Direct" and re-interleave it. Once interleaved it mostly STAYS that way on playback. so a screwey encode will also be (sort of) locked in.

Further explainations, would also include if the video is "offset all the way through", if the offset "migrates" getting further off over time, or if it "jumps or gets off in middle places" in the video, these 3 can be entirely different issues, and caused by entirely different things. With VirtualDub you can fix 2 of these problems, in short processing time.

In conclusion, most of the problems are bad encoding, the complexity of the different ways of encoding/decoding, and corrupted data. It would be also good if a shorter interleave was used when possible.

Your understanding, can be more valuable than some switch that changes things. A slight understanding, will go a long way in knowing when how and why to switch, or to just repair the video yourself, or to encode better yourself. It is not limited to VLC, many other players have the same switches using different names. So sorry if I poorly explained it, or ran on to much.

share|improve this answer
    
That's a pretty good explanation, thanks. This happens for almost every file played though, so it's not likely to be an encoding issue or corrupted file. It's also consistent for the length of the video, so it's not due to dropping frames. It also only happens in VLC, not in other media players. –  Tom Oct 6 '11 at 5:02
    
Shortcut Key k Audio delay up (audio comes before video) Shortcut key J Audio delay down (audio comes after video) I prefer to move this type of thing to KP +- , and some video encode types you cannot shift the sync in some programs. also requires the internal audio switcher things to be running, so the program can process the audio. –  Psycogeek Oct 6 '11 at 6:06
    
I think putting both of your statements together, you meant to say it consisitantly is all over the place :-) sounds like some kind of buffers problem, somewhere, from program to hardware, which even could include driver, or hooks to the driver, filters on the driver and other stuff, nobody makes things simple anymore, one fix another problem –  Psycogeek Oct 6 '11 at 6:13
    
more, any reason why the audio playback "rate" or sample rate was reading wrong, or somone decided to use a weird non-standard sampling rate. and the notorious VBR (variable bit rate) instead of CBR audio. any overclock that took some "timer" off that was using incorrect timing methods. –  Psycogeek Oct 6 '11 at 6:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.