[I've edited this post, changing only its title, as I think the original title perhaps caused too many people to avoid reading this. This is not the usual audio sync problem discussed so many times before. I think it's worth a read. Please check this out. And thanks to anybody who has any ideas that can help me figure this out.]
Greetings;
I know that many people have encountered sync problems, and that there is already tons of discussion about that, and no need to duplicate it here.
But I think that this question is NOT the same old thing one more time again, but is a question of a deeper nature.
It's not bad video frames, and it's not slowly drifting sync. It's a constant offset, but one that I seem not be to able to predict, nor confirm.
I'm wondering about the synchronization of audio and video, in avi's mpg's, etc. Like many people, I've run into various problems, have found various workaround solutions, and have been thinking about the issue.
Basically, I wonder how we can be certain that audio and video IS in sync or not. It seems that there are too many variables, and no way to be sure. But it's not so simple to explain what I mean. I suppose I'll need to describe some of my usual procedures, some of the problems I've found, and give examples. Sorry if this gets a little long...
I often obtain avi files by download. The sources of these videos are varied and unknown, and as a result, the variety of problems I encounter with them is likewise varied... My desire is to convert these all into a generic format, a single format if possible, that I can be more certain of. Something simpler, more universal. And so, I usually convert everything to video CD, mpeg1. I write these mpg files then either in VCD or DVD format to write once media. I can then watch these on my TV DVD player, or in the computer. If some video is very high quality, and I care to keep it that way, I will then encode it in mpg2, and write it to DVD proper.
I use VirtualDub to extract the audo from the avi, and convert it to WAV format. If the audio is AC3, VirtualDub does a raw extract, in AC3 format, which I then use HeadAC3he to convert to WAV. I then use TMpgEnc to convert the avi video stream and the WAV audio stream to MPG1, VCD standard, with perhaps a 48K sample rate if I expect to write the output eventually to DVD. I use scmpx to sample rate convert and encode the audio into MP3 at the VCD standard of 224K.
Now, in doing this, I sometimes found audio and video out of sync. The original avi file was in sync, but the output of TMpgEnc is out of sync. Sometimes by a little, sometimes by a lot, and sometimes it's perfectly OK. It was a puzzle. I then found I could inspect the audio position with respect to the video inside of TMpgEnc, during the process of setting up the encoding to MPG1. I would go to it's Source Range dialog, where I could see the video frame and the respective audio waveform for that frame. I would compare this between using the original avi file as audio source, and the extracted WAV as audio source. Many times, I find that the WAV audio is 24 mS early. So, I would shift it 24 mS later, and it seemed OK.
Some videos cannot be done like this. If the audio is AC3, TMpgEnc won't show any audio at all. On another computer where I do this, I apparently have different codecs installed than on my main computer, and again TMpgEnc won't show any audio, even if the audio is MP3. So, this method does not always work, but when it does, it seems to help be more sure that audio and video are in sync.
Ok, then, even after doing this, I would find that various programs would play the mpg file with audio and video out of sync again ! And I think I have an idea why.
I was told recently that the MP3 specification is not very exact. It does not specify in all cases what the audio encoder and decoder must do. There is some variance. This can be seen in another way. I have made MP3 files of audio, where the original WAV file had an audio attack transient rather close to the beginning of the file (no dead time in the lead in). In sending these to a colleague, he complained that the first part of the music was cut off when he played it on his system. On my system, the playback was fine. I also have read info about LAME, describing some amount of bytes at the beginning and end of MP3 streams that is 'filler' or something, and may be discarded. Or not... And I think that this sort of thing may be what can cause MP3 audio to shift, as in the cutoff front end my colleague complained of. Now, if this is so, can't it also happen to an MP3 audio stream that is supposedly playing in sync with video ? As in an MPG file ?
If this is true, then how are we ever able to be sure that we have audio and video in sync ? On my machine, with my codecs, it may be fine. On your machine, it may be wrong. And what about TV players ? What do they do ? And do they all behave the same way ? I would bet they don't !
Finally, what is the best MP3 codec to use for Windows ? I was using one of the fraunhofer codecs, but it seems this is not available anymore for free. Anybody have a good suggestion, or know where to find the latest free fraunhofer codec ? (I have also had problems in the past with some MP3 codecs, which one I am not certain, that would add a very nasty high frequency ringing sound to the audio.)
If anybody knows anything about this, and has any ideas on how to deal with this, please let me know !
Thanks
+ Reply to Thread
Results 1 to 2 of 2
-
-
I've done a little more investigating, and what I have found only makes me more confused. Here is my example for today.
I took an avi as source. VirtualDub, when opening it, reports, as it often does with many files, an inproper VBR encoding, which may introduce up to 8468 ms of skew. This much skew doesn't seem to ever happen though.
VirtualDub shows the properties of this file to be :
624x352, 23.976 fps
Xvid codec
48K audio sample rate MP3
I seem to be using a fraunhofer codec.
I extract the audio with VirtualDub into a WAV file. I open the avi as both audio and video source in TMpgEnc, in preparation for encoding it into VCD resolution NTSC Mpg1, but with audio 48K sample rate. I check the audio position with the video and take note of it. I then substitute the WAV file as audio source, and check the audio position with respect to video again. The audio is now 24 mS too early, as it usually seems to be with files of this type. As mentioned in the previous post, I use TMpgEnc to slide the audio 24 mS later to compensate. I then encode to Mpg1.
I have done this many times, but today I got curious to see the audio position with respect to video of the resulting mpg1 file. I have never checked this before. I looked at it today and I find the audio is not where I think it should be. Compared to the avi file it came from, the mpg1 version produced by TMpgEnc has the audio now 34 mS too late. I checked this the very same way, by looking at it in TMpgEnc.
So, what is happening here ? Where is the audio really positioned ? Was it really 24 mS early as I thought ? It is now really 34 mS later as it seems to be ? Is some codec messing things up, making measurements of this type impossible ? Is some software not doing the right thing, and showing me 'random' offsets ? I am completely confused as to where to go from here, and have no idea how to fix this, and be sure that I have audio and video synced.
All I can ever do is watch the video and see if it seems that the lips move at the same time as the audio is heard. But even this is not always easy to be accurate with. Also, when checking files in this manner, it seems that some have good sync, and others don't. So I really have no idea about how to determine when it will happen, by how much, or why.
Does anybody know how to deal with this issue ?
Similar Threads
-
MiniDV Video & Audio Problem - Corrupted, Detiriorated, Missing Audio
By 4truce in forum Capturing and VCRReplies: 14Last Post: 4th Aug 2011, 06:36 -
RipBot264 Audio Problem (no audio)
By fefalas in forum Video ConversionReplies: 9Last Post: 8th Apr 2011, 10:39 -
VCD MPG1 file to CD Question
By Excelsior123 in forum Authoring (VCD/SVCD)Replies: 21Last Post: 22nd May 2008, 19:14 -
avi to mpg1
By zoranb in forum MacReplies: 3Last Post: 12th Sep 2007, 14:46 -
Minimum MPG1 file size?
By Choppa in forum Authoring (VCD/SVCD)Replies: 17Last Post: 17th Jun 2007, 23:04