Welcome Guest ( Log In | Register )


Important

The forums will be closing permanently the weekend of March 15th. Please see the notice in the announcements forum for details.

Pages: (3) [1] 2 3  ( Go to first unread post )
Audio/video Sync Problem
« Next Oldest | Next Newest » Track this topic | Email this topic | Print this topic
jktla
Posted: Mar 11 2003, 08:23 AM


Unregistered









I have captured MPEG2 video with MPEG2 audio, and I open it with VirtualDub, and when I cut off some part of video, and then convert it to DIVX audio does not sync with video.I convert audio to MP3 format. If I don't cut anything off, sync is OK. Anyone else has this same problem?

 
  Top
ChristianHJW
Posted: Mar 11 2003, 11:16 PM


Advanced Member


Group: Moderators
Posts: 1768
Member No.: 2
Joined: 7-July 02



Can you tell us how you can open MPEG2 in Virtualdub ? Or are you using VirtualdubMod or fcchandler's mod ?

--------------------
Visit the unofficial Virtualdub support forum on http://forums.virtualdub.org - help to reduce the big number of emails Avery Lee is getting every day !!
Support matroska as container and Gstreamer as the only truely open, x-platform multimedia platform ....
 
       Top
jktla
Posted: Mar 12 2003, 05:47 AM


Unregistered









This forum is for VirtualdubMod so I use VirtualdubMod.
 
  Top
fccHandler
Posted: Mar 12 2003, 06:07 AM


Administrator n00b


Group: Moderators
Posts: 3961
Member No.: 280
Joined: 13-September 02



Try my version of VirtualDub.

--------------------
May the FOURCC be with you...
 
     Top
jktla
Posted: Mar 17 2003, 08:42 AM


Unregistered









Your version had same problem. Video length I captured was 1 hour 30 minutes. At the beginning of video audio/video sync is Ok, but at end of recorded video audio comes about 0,2 seconds before video. What is the reason for this sync problem? Is there any way to fix it?
 
  Top
fccHandler
Posted: Mar 17 2003, 09:21 AM


Administrator n00b


Group: Moderators
Posts: 3961
Member No.: 280
Joined: 13-September 02



Honestly, I'm not sure. But did you say that there were no sync problems when you encoded to DivX without cutting the MPEG? How about encoding the whole thing to DivX (with uncompressed audio) and then cutting up the DivX file? (Compress the audio after cutting.)

Also, have you tried under Video->Frame rate, "change so video and audio durations match"?



--------------------
May the FOURCC be with you...
 
     Top
jktla
Posted: Mar 17 2003, 09:55 AM


Unregistered









Reason why I don't encode whole video to Divx is that I can only cut from key frame to key frame in Divx video.

Under Video->Frame rate, "change so video and audio durations match", I have read that VirtualDub adds extra frames to video and do nothing to audio.I would like to keep frame rate to 25 fps , so don't want to use that.

It could be that your program does not cut audio from same place that video, and that causes the sync problem.
 
  Top
fccHandler
Posted: Mar 17 2003, 04:36 PM


Administrator n00b


Group: Moderators
Posts: 3961
Member No.: 280
Joined: 13-September 02



QUOTE (jktla @ Mar 17 2003, 05:55 AM)
Under Video->Frame rate, "change so video and audio durations match", I have read that VirtualDub adds extra frames to video and do nothing to audio.I would like to keep frame rate to 25 fps , so don't want to use that.

VirtualDub doesn't add extra frames. Only the frame rate is changed. Anyway, if you're encoding to AVI to watch on a PC then the actual frame rate doesn't matter as long as it's in sync.

QUOTE
It could be that your program does not cut audio from same place that video, and that causes the sync problem.

I've participated in other discussions about out-of-sync MPEG captures, and generally the capture program is to blame (especially ATI software).

--------------------
May the FOURCC be with you...
 
     Top
jktla
Posted: Mar 18 2003, 12:23 PM


Unregistered









QUOTE
VirtualDub doesn't add extra frames. Only the frame rate is changed. Anyway, if you're encoding to AVI to watch on a PC then the actual frame rate doesn't matter as long as it's in sync.

I watch on TV.
QUOTE
I've participated in other discussions about out-of-sync MPEG captures, and generally the capture program is to blame (especially ATI software).

When I watch original captured video sync is Ok.

Could it be that conversion from MPEG2 audio to MP3 causes the sync problem?
 
  Top
fccHandler
Posted: Mar 18 2003, 04:10 PM


Administrator n00b


Group: Moderators
Posts: 3961
Member No.: 280
Joined: 13-September 02



QUOTE (jktla @ Mar 18 2003, 08:23 AM)
Could it be that conversion from MPEG2 audio to MP3 causes the sync problem?

That's easy to test. Set audio to "direct stream copy" and save an AVI.

I know the LAME MP3 codec can cause sync problems.

--------------------
May the FOURCC be with you...
 
     Top
jktla
Posted: Mar 19 2003, 05:55 AM


Unregistered









I tested saving audio to wav and then I encoded it to MP3 and then I combined audio and video with virtualdub and same sync problem still exists.

Am I the only one who has this problem?
 
  Top
smball
Posted: Mar 20 2003, 06:26 AM


Unregistered









This problem is usualy happen at capture mpeg2 file.
because it was be save at varient FPS. (27.96 ~ 32.14)
but its mpeg header is say 29.96 FPS.
that why when you encode capture mpeg2 file will cause audio out of sync,
but direct play this mpeg file(not encode) is fine.

solution have many way
1. use vtdb change frame rate. its not reasonable but can slove some case.
2. correct the header info

i search this forum for best solution.
may fccHandler will summary and announce.
 
  Top
fccHandler
Posted: Mar 20 2003, 06:45 AM


Administrator n00b


Group: Moderators
Posts: 3961
Member No.: 280
Joined: 13-September 02



QUOTE (jktla @ Mar 19 2003, 01:55 AM)
Am I the only one who has this problem?

I guess I'm lucky, because I've never had an out-of-sync MPEG from one of my own captures, but you are not alone. Similar problems have been reported in these forums and Doom9's forum:

Why is MPEG1 almost always out of synch?
All in Wonder Synch Problems
Audio/video Sync Problem

I still say the capture software (or hardware) is to blame. As Avery Lee said, "it's what we get for putting audio and video capture on separate clocks."

--------------------
May the FOURCC be with you...
 
     Top
Pamel
Posted: Mar 22 2003, 06:51 PM


matroska team member


Group: Moderators
Posts: 151
Member No.: 1353
Joined: 15-December 02



************************
Edit: Avery has alerted me(everyone) to the fact that this post is complete BS. In his words, "So please stop spreading this crap. MPEG does not support VFR, and AVI does not have the sync problem you describe." I am going to just leave this post here for the sake of completeness, but you are probably better off skipping the rest of it.
************************

The problem isn't MPEG or directly ATI's fault, it is the design of the AVI container.

When you are capturing NTSC video using whatever software, you're usually going to be capturing at ~29.997fps, or ~30fps for our purposes. This is a constant framerate, as the video being recieved is a constant framerate. If something happens on the computer that causes the CPU usage to spike, then the encoding software cannot afford to spend time encoding the current frame and skips, or 'drops', it. Basically the encoding application doesn't give that frame to the codec, so it is never encoded and it is never stored. When this happens, you suddenly end up with a situation where the fps (frame per second) drops to 15fps for a frame.

This is fine for storing in MPEG, because the container supports vfr (variable frame rate). It can go along at 30fps, switch to 15fps for a frame or so, and then switch back to 30fps. And because the container supports it, when playing it back, the video renderer will display a few frames when they should be seen.

The problem is when you try and convert this vfr MPEG to AVI, or capture video with dropped frames directly to AVI. AVI ONLY SUPPORTS CFR (constant frame rate). So, if the video capture starts at 30fps, that is how AVI will store every frame, even if one was dropped and the framerate drops. What happens if you are displaying a 30fps video at 30fps, and the framerate briefly drops to 15fps, but you keep displaying it at 30fps? Well, if the audio is constant (and it basically always is) then the video gets ahead of the audio. Voila! Instant out of synch audio/video.

The ATI software just isn't very efficient with the CPU usage, causing it to spike more often, and thus more dropped frames. The resulting files will work fine in MPEG, but when you try to convert to AVI, you get instant synch problems.

This is one of the reasons that the Matroska container was invented. It can hold all types of video like AVI, but supports vfr. So, in theory, you should be able to convert a vfr MPEG video file to a Matroska file, and never lose synch.



--------------------
Please take anything I say with many many grains of salt. I can't tell the difference between my AVI and a hole in the ground.
 
      Top
fccHandler
Posted: Mar 23 2003, 12:19 AM


Administrator n00b


Group: Moderators
Posts: 3961
Member No.: 280
Joined: 13-September 02



@Pamel:
Great explanation, and I think you are probably correct with everything you said.

Perhaps VirtualDub's MPEG parser could read the actual PTS stamps, and attach them to the frames for seeking purposes, rather than assuming (for instance) that 2997 frames equals 100 seconds into the clip. Seems like you would need to do this anyway to pass correct time stamps into the Matroska container.

Using the PTS stamps means that converting a vfr MPEG to cfr AVI might cause some frames to be doubled, or others to be dropped, but at least it should stay in sync. Hmmmmm...

--------------------
May the FOURCC be with you...
 
     Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
35 replies since Mar 11 2003, 08:23 AM Track this topic | Email this topic | Print this topic
Pages: (3) [1] 2 3 
<< Back to Testing / Bug Reports