View Full Version : Why is MPEG1 almost always out of synch?
theReal
3rd February 2003, 11:58
This is not really a Vdub problem, but it ain't general enough to be posted under "general discussion" I think :-D
I am often re-encoding MPEG1 (VCD) Simpsons tv-captures to Realvideo 9 (because after applying good avisynth filters, the result looks better than the source at less than half of the size).
It's no problem to open mpeg1 with VDub or VDubMod and save it to HuffYUV and PCM audio (I'm then converting the uncompressed file via avisynth with Helix Producer).
In this process I noticed that more than half of these files were suddenly out of synch when converted to avi. VDub proposes to correct the framerate to 30.06 fps (always something around this number) instead of 29.97 fps to keep audio and video in synch - then the avi file is ok.
However the source mpeg file is not out of synch on playback - and I have absolutely no explanation for this.
What's most enervating about this is that RV9 cannot encode framerates higher than 30fps, so if my source is 30.06 fps or more, I need to process the file again before converting it...
N_F
3rd February 2003, 12:24
Any chance the huffyuv avi with its uncompressed audio is over 2 GB?
theReal
3rd February 2003, 14:24
Yes, the avi file is over 2GB, but that can't be the reason, because...right after opening the mpeg, before I even think about saving (;)), Vdub already says the audio and video of the source file are out of sync and I should change the framerate to 30.06 fps to sync it.
And if I do so, the avi file is about 2.7GB, it's 30.06 fps and it's perfectly ok.
I have also encountered mpeg1 source files that were in sync according to VDub, and I didn't need to change anything - but these are only about 1/3 of the mpeg files I converted so far...
N_F
3rd February 2003, 15:52
Hmmm... I've also converted a lot of MPEGs to DivX (for the same reasons you do it) and I can't remember VDub ever saying an MPEG1-file is out of synch. That I've only seen with AVIs.
Suggestion: Try reencoding the mpeg with TMPGEnc and try using this reencoded file instead. This may not be a good permanent solution, but it could be worth a try to see if it works.
theReal
4th February 2003, 11:22
I can solve the problem with almost no quality loss on the audio and no quality loss at all on the video track:
Save the audio as wav, run it through Besweet and change the framerate by a ratio of 1002 to 1000. Then choose the new audio track in VDub and check the frame rate tab again. In this case, where the audio track had been exactly 30.58fps before, it was now 29.98fps. Now I just change the video framerate to 29.98fps and get an avi video that is in sync and below 30fps :)
btw. if you only open the mpeg, reencode it and then only watch the beginning of the resulting avi file, you might never notice the audio running out of sync towards the end. VDub doesn't show any error message, you only see it when you open the "frame rate" dialog.
jcsston
4th February 2003, 17:23
The same thing happens to me, but VirtualDub proposes to change the framerate to 29.95 most of the time (it changes).
I think it has to do with the sound card not being on the same clock as the capture card.
If you can try capturing with VirtualDub and note the Avg Frame Rate. Mine is around 29.95 - 29.96.
fccHandler
4th February 2003, 19:34
Um, I just noticed this thread, and IMHO you are all arriving at the wrong conclusions. It's not unusual for the audio and video streams in an MPEG file to have slightly different durations, and it's the difference in the durations that causes VirtualDub to propose a slight frame rate change.
(But consider that if the video and audio have different durations in the MPEG, and you change the frame rate of the video to match the duration of the audio, then you're really throwing the playback out of sync!)
Remember that internally, the MPEG-1 format only supports a few predefined frame rates: they are 23.976, 24, 25, 29.97, 30, 50, 59.94, and 60. So regardless of what VirtualDub suggests to make the video and audio durations match, the true frame rate of the MPEG must be one of those values.
theReal
4th February 2003, 21:48
If you can try capturing with VirtualDub and note the Avg Frame Rate It's not with my own captured files (I capture in MJPEG or HuffYUV, and there's no problem with these files).
(But consider that if the video and audio have different durations in the MPEG, and you change the frame rate of the video to match the duration of the audio, then you're really throwing the playback out of sync!) I'd really like to have this happen, so I didn't have to change anything. But the fact is, when I do not convert the frame rate, then the pcm audio track saved with VDub or VDubMod is 3 to 4 seconds shorter than the HuffYUV video track (at a total length of about 21 minutes).
You don't need to be an expert to see that this is totally out of sync at the end of the episode.
So I guess it really is a VDub problem? I mean if the mpeg info shows slightly wrong values for durations (=only the predefined values, not the real ones) but VDub thinks they are correct, then the resulting avi file could be out of sync.
btw I save the video to HuffYUV using fast recompress, while the audio is saved to PCM in full processing mode. Maybe there's the difference?
jcsston
4th February 2003, 21:49
I know changing the video framerate to match the audio is a bad way to keep the audio in sync. But it's the best solution I could come up with. If I re-encode the MPEG in TMPGEnc and open the new file in VirtualDub the audio stays in sync.
When I used the old VidCap32 program my captured avi's framerate was... 29.965 ;). VirtualDub thankful drops and inserts frames to keep audio in sync.
jcsston
4th February 2003, 21:51
@theReal: Yes, VirtualDub keeps the audio in sync for me too. But what does it say the real Avg Frame-Rate is?
fccHandler
5th February 2003, 05:09
Originally posted by theReal
I'd really like to have this happen, so I didn't have to change anything. But the fact is, when I do not convert the frame rate, then the pcm audio track saved with VDub or VDubMod is 3 to 4 seconds shorter than the HuffYUV video track (at a total length of about 21 minutes).
You don't need to be an expert to see that this is totally out of sync at the end of the episode.
Again, the proper frame rate for the MPEG can only be one of the predefined values I listed. VirtualDub reads it from the MPEG header, but it may suggest a slightly different frame rate if the video and audio are not the same duration (that's fairly common in my experience).
If you've tried all of the predefined MPEG frame rates and none of them look correct, then yes, there could be something wrong with VirtualDub's MPEG parser, or the MPEG itself.
All I can say is that I've converted lots of MPEGs to AVI and I've never had a sync problem like what you're describing. However, I'm using my own customized VirtualDub, and the MPEG parser was heavily modified for that version. If you want, you can get my version at DeXT's site (http://es.geocities.com/dextstuff/).
jcsston
5th February 2003, 07:30
Originally posted by fccHandler
yes, there could be something wrong with VirtualDub's MPEG parser, or the MPEG itselfFor me it the bad MPEG's that ATI TV creates. Even AVI's longer than 15mins with ATI TV are increasingly out of sync.
ChristianHJW
8th February 2003, 01:32
Originally posted by jcsston For me it the bad MPEG's that ATI TV creates. Even AVI's longer than 15mins with ATI TV are increasingly out of sync.
MPEG container is pretty complex, not every developer understands it fully :D ... one of you guys should contact the ATI guys and consider to use another container :D !!
Teegedeck
9th February 2003, 01:13
I find it really consoling that I don't seem to be the only fool in the world who has problems MPEG-1 soundtracks after all. :) BTW Christian, did you have a look at the player I linked to in the MPEG-4-compatibility-thread on the XviD-forum? ;)
JoZ
27th February 2003, 18:05
I'm using AVI TV-Wonder PCI and I'm capturing MPEG-2 DVD quality.
What's the problem? Out of sync sometimes. I was demuxing and I found
out that video is 30-31fps and it's LONGER than the
audio with few seconds. For an example: Video is 30:55, audio is 30:52
I was looking at ATI site and I found this:
http://www.ati.com/support/infobase/3524.html
Maybe this will help someone else.
tluxon
28th February 2003, 15:57
Originally posted by theReal
I can solve the problem with almost no quality loss on the audio and no quality loss at all on the video track:
Save the audio as wav, run it through Besweet and change the framerate by a ratio of 1002 to 1000. Then choose the new audio track in VDub and check the frame rate tab again. In this case, where the audio track had been exactly 30.58fps before, it was now 29.98fps. Now I just change the video framerate to 29.98fps and get an avi video that is in sync and below 30fps :)
btw. if you only open the mpeg, reencode it and then only watch the beginning of the resulting avi file, you might never notice the audio running out of sync towards the end. VDub doesn't show any error message, you only see it when you open the "frame rate" dialog.
I see the same symptoms as you - source file in synch while VDub says the video and audio durations are different. It doesn't seem to matter where the file came from (ReplayTV, ATI AIW Radeon). Unfortunately for me, the re-encoded file is always out of synch.
However, when I transcode my audio file (.mpa) in BeSweet to change the framerate, the output (I've tried .mpa, .mp2, mp3, wav) is very chatter-y, so this isn't a good solution for me. FWIW, I usually de-mux the audio by saving a project with DVD2AVI and bring it into BeSweet because that's what I've seen suggested.
I know I must be doing something wrong, but I'm running out of time to figure it out (files keep piling up :)).
Tim
theReal
1st March 2003, 12:15
However, when I transcode my audio file (.mpa) in BeSweet to change the framerate, the output (I've tried .mpa, .mp2, mp3, wav) is very chatter-y
Besweet doesn't like every value you enter - I tried to change the frame rate from 30058 to 29970 and the result was 20 minutes of white noise (something like that). The standard frame rates work, as well as values like 1000 to 10xx, but then you mostly don't get a standard frame rate as the result (doesn't matter for encoding to Realvideo 9 though, as long as it's below 30fps)
tluxon
3rd March 2003, 17:53
Originally posted by theReal
Besweet doesn't like every value you enter - I tried to change the frame rate from 30058 to 29970 and the result was 20 minutes of white noise (something like that). The standard frame rates work, as well as values like 1000 to 10xx, but then you mostly don't get a standard frame rate as the result (doesn't matter for encoding to Realvideo 9 though, as long as it's below 30fps)
Would you say, then, that BeSweet isn't the best tool for adjusting the audio length to match the video length? What are the best programs for this?
DeXT
3rd March 2003, 19:09
Originally posted by tluxon
Would you say, then, that BeSweet isn't the best tool for adjusting the audio length to match the video length? What are the best programs for this? There are many other programs out there capable of audio stretching/enlarging, such as Cool Edit Pro. It's not freeware but offers a very good quality. Even the latest VirtualDub (1.5.x) has an audio stretch filter.
About your problem, which I experienced too, seems an issue with recent BeSweet beta releases. Give a try to beSweet 1.4, which will probably work fine.
theReal
3rd March 2003, 20:07
I'm not so sure about this...
Known issues in v1.4 :
- not all FRC (frame-rate-conversion) values are supported. common FRCs are supported (NTSC2PAL / PAL2NTSC). [...]
(from http://forum.doom9.org/showthread.php?s=&threadid=15738#post77320)
DeXT
3rd March 2003, 22:12
Originally posted by theReal
I'm not so sure about this...
Known issues in v1.4 :
- not all FRC (frame-rate-conversion) values are supported. common FRCs are supported (NTSC2PAL / PAL2NTSC). [...]
(from http://forum.doom9.org/showthread.php?s=&threadid=15738#post77320) Believe me, I tried it and it works. Even with weird frame rate values (such as -r 24024 25000). 1.5bX releases have a bug here (jittering with small FRC adjustment) while it works fine on 1.4 (tested). I'm going to put more testing about this on a separate thread inside the audio encoding section.
ya...I have downloaded a mpeg1 file and tried to convert it to avi with VDub, the result avi file was out of synch too
I think it is becuase the video and audio have different durations, and it seems that some audio data in mpeg file are somewhat "lost".
VDub remove these lost audio data, then the result audio strem has shorter duration then video, Even changing framerate cannot solve this.
There is no such problem when using TMPEG to convert mpeg-1 to avi. the result avi file just stay in sync, but the audio was occasionally "muted" (due to the lost of audio data)
It is opposite to play the mpeg-1 file, mpeg player just drop some video frame to mantain audio continuance, You can hardly notice that and the a/v just stay in sync.
I believe it's due to bad mpeg file, maybe something wrong in capturing video from TV.
/*sorry for bad english*/
theReal
4th March 2003, 15:19
I believe it's due to bad mpeg file, maybe something wrong in capturing video from TV.
I think so, too - it seems to be always the same person who is capturing the TV shows I was talking of, and they are always ~30.04fps (for cartoons changing the audio framerate is close enough to synch it again, at least almost perfectly...).
I've got another TV show recently (also VCD mpeg1) and it was not out of synch.
theReal
15th March 2003, 11:10
There is no such problem when using TMPEG to convert mpeg-1 to avi.
Stupid question: how do you convert to avi with TMPEG? I tried it yesterday but couldn't find any option for avi output (except maybe through VFAPI??)
I am using TMPEG 2.51.33.127 - do I need a newer version, maybe?
tluxon
15th March 2003, 17:20
Is there any chance the difference between video and audio durations can be attributed to dropped frames on the video side? When I'm capturing with my ATI AIW Radeon and MMC, there's a status bar that normally displays "<1% dropped". If I'm using my computer for other tasks, I've seen the number change to "<2%" & "<3%" on occasion.
I'm beginning to wonder if whether capturing is being done with my PC or with one of my ReplayTVs, there is frequently enough demand on the CPU/disk that frames could be dropped, and it's just not visible until re-encoding. Maybe there is something about the originally captured file that keeps it synched-up during playback but is lost upon re-encoding? GOPs?
Tim
tluxon
15th March 2003, 17:35
Originally posted by theReal
Stupid question: how do you convert to avi with TMPEG? I tried it yesterday but couldn't find any option for avi output (except maybe through VFAPI??)
I am using TMPEG 2.51.33.127 - do I need a newer version, maybe?
In my version, which is 2.510.___, you can go to "File->Add current project to batch list->AVI file", or just press Ctrl+Alt+A. This saves your loaded .mpg into the compression-free .avi format. I haven't tried this before, but it has a couple options that appear related to frame synch.
_ Output frame as keyframe if the frame is specified as I pic
_ Output frame as drop frame if the frame is specified as copy
[edited in}
Okay, I just tried this with my CBS "It's All Here" clip and the resulting .avi file got about 5 seconds out of synch in a clip that's only 90 seconds long! I just used all the defaults in TMPGENc.
Hmmm,
Tim
lailaw
23rd March 2003, 00:40
@theReal: I think N_F meant reencode your source mpeg using TMPGEnc, then run that mpeg (outputted by TMPGEnc) through VDubMod to get your avi.
.................TMPGEnc...................VDubMod.............
theReal.mpg -------> theReal2.mpg -------> theReal.avi
I tried it, it synched up audio and video. I agree with N_F, that it may not be a good permanent solution - I'm a raw newbie, I don't know enough about what TMPGEnc and VDubMod do to a file, but I think I saw and heard a blip in playback.
Or, N_F meant something else, and I got lucky :D
@fccHandler: I tried your customized VirtualDub (was it v1.5.1?). I think it shortened the cumulative audio lag but did not synch up my avi. Not disparaging your version, only saying I don't understand why it does what it did - I'm still looking up what a MPEG parser does :)
fccHandler
23rd March 2003, 04:11
There is a new post by Pamel in the VirtualDub forums which I think contains the definitive answer to this whole topic. Too bad there is no solution ATM, but I think Pamel's description explains everything that has been observed by the posters here:
Audio/video Sync Problem (http://virtualdub.everwicked.com/index.php?act=ST&f=14&t=2320&hl=)
DaWolf
13th June 2003, 01:35
Having converted two MPEG-1's in a row, both times with audio slowly but surely going out of sync, I'm happy to have found this thread. Now what I wonder is if there is a way to determine this problem beforehand - other than demuxing the file.
On a side note, has anyone found a way to get this fixed *directly* within Helix Producer?
Ruud
DaWolf
15th June 2003, 17:53
On the two MPEG's mentioned in my previous post using VCDGear to extract dat -> mpeg with Fix MPEG Errors checked has solved my audio sync problem. Helix GUI had no problems.
Ruud
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.