Re: Audio/Video Sync problems

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I began having this problem recently. First, let me give you some history:
In 2005 I started an online scanner website with the following hardware:
P4 1.8GHz Dell Workstation
512MB RAM
Nvidia FX5200 128MB Video
Windows Server 2003 Enterprise SP1
80GB IDE HDD

I was running 2 WME instances. One of them doing a regional screen capture
with audio and the other just audio. In addition, I was running a ShoutCast
Win32 server with WinAmp encoder. Audio is via a SoundBlaster Live Value. All
was running fine and no video/audio sync issues.

Then, the CPU burned up on the system. I used Aronis to image the drive and
moved it to a new server:
P4 2.8GHz
512MB RAM

Moved the video and sound cards to the new server and slammed the image onto
the new server. After a second-level repair of the OS, immediately I noticed
that the video would lag behind the audio. The longer the encoder ran, the
further the video would lag and it even seemed to be making it difficult for
users to connect to the encoder. Clients would continue to buffer and buffer
and it would be minutes before they could connect. And when they would, the
video would be very lagged.

I tried everything to get rid of the problem. I tried: disabling/enabling
video hardware acceleration, disabling all video enhancements (reducing color
depth, turning off ClearType, reducing screen clutter) and nothing worked.
What's worse is that the stream would be in sync for a while then for no
apparent reason it would begin to lag and it would continue to get worse.
Sometimes it would be 30 minutes before the video lagged and other times it
would be immediately after the encoder started broadcasting.

I finally decided to give both of the wmenc.exe processes realtime priority
in Task Manager and the problem went away immediately. It has been running
for over an hour now and it is completely in sync.

I don't pretend to know why a system with a faster processor should have
problems with sync when a slower system didn't, but it is what it is.

Anyway, give that a try and see what happens.


"Chris Richards" wrote:

Neil Smith [MVP Digital Media] wrote:

If you had to quantify it, what's the relationship of the 100 -> 500ms
lag compared to the encoded length of the video ?

As the video gets longer, the lag steadily gets worse. So the video
might start out with almost no noticeable lag, but as it plays, the lag
gets worse and worse.


Plotting that graph may be instructive - try it as a straight through
capture if you can reproduce it there, then try it with a pause in the
encoding to see if the lag is consistent with the video duration.

I'll have to see if I can get my hands on a system that I can do it
with. I'll let you know what I find.

Something's nagging about audio lag which mght come back to me later :
What specific type of camera is this - a DV cam ? Or webcam ?

It's a USB webcam. My client bought like a million of them from China
for $6 each or something. I'm not even certain who they are made by.

The only way that could influence the encode is if the camera and
encoder combination is consistently and systematically moving backward
relative to the video frames. Any chance of swapping camera models ?

I can check into this as well and see what I can find out.

Because this is a USB camera, and the audio is coming through the
onboard chipset, it's not unreasonable to expect some degree of
de-synchronization between the video and the audio. However, I would
tend to expect this to be constant, not changing over time.

This brings me to a question, is there a way for me to compensate for
lag in the video or audio to better synchronize the streams (e.g. a
programmatic delay that can be applied to one or the other)? As far as
I have been able to find, the WME SDK doesn't really provide me a way of
doing this?

Thanks for your help.

Later,
Chris




HTH
Cheers - Neil

On Sun, 05 Aug 2007 21:57:18 -0500, Chris Richards
<gizmo@xxxxxxxxxxxxx> wrote:

I'm encoding straight from the camera, using the IWMEncoder2 interface.
I'm loading my profile using the IWMEncProfile2 object, and then setting
that to my source group.

I'm then loading the first audience in the profile so that I can get the
size of the video buffer stored in the profile. I then add 1 second
to that and store it internally. (I'm doing this because I've found
that if I don't wait at least this long after the user presses 'Stop'
before I actually stop the archive file, the video will be chopped off.)
I'm then calling encoder->archive to stop the archive (this is actually
how I start/stop/pause encoding; the encoder runs all the time, and I
just flip the archive on or off as necessary; this is necessary for the
next part).

Now, as for the profile itself. It is currently set for a 56K stream only:
Audio: 10 Kbps, 16 KHz, mono CBR
Video: 240x180, 15 fps, 8 second key frame interval, 40Kbps, 5 second
buffer, video smoothness at 75, and decoder complexity at auto. Both
audio and video are CBR.

Audio Codec: Windows Media Audio 9.1
Video Codec: Windows Media Video 9

Video format: NTSC

If there is any other info that you need, please let me know and I'll
try to provide it.

Thanks in advance.

Later,
Chris




Neil Smith [MVP Digital Media] wrote:
Nobody knows anything about the encoding profile, or the source files
you're encoding. Start there and somebody can probably help ;-)

Cheers - Neil

On Sun, 05 Aug 2007 14:16:16 -0500, Chris Richards
<gizmo@xxxxxxxxxxxxx> wrote:

I've an application using WMEncoder 9. It works on most computers just
fine, but I'm increasingly running into people who are using laptops,
and experiencing issues with the synchronization of audio and video. In
almost all cases, the video is lagging the audio. On a few of the
systems, I have seen situations where improving the lighting of the
video would reduce or eliminate this problem (i.e. the video would be
very dark, and the audio and video would be way out of sync (like 100 or
more mS, up to as much as 500 mS; increasing the lighting on the subject
would improve this.)

Has anyone else experienced this? I know there are issues relating to
CPU and memory requirements, and MS recommends a P4 3.0 GHz or better
with at least 1 gig of RAM. However, I have desktops running
comfortably on 2 GHz Celerons and 256 Meg of RAM, while I have laptops
with 2.4 GHZ Core2Duos with 2 Gig of RAM that are having issues?

This is a real problem for me, because more and more people are using
laptops, and the laptops seem to be the ones having the majority of the
problems.

Thanks in advance.

Later,
Chris
------------------------------------------------
Digital Media MVP : 2004-2007
http://mvp.support.microsoft.com/mvpfaqs
------------------------------------------------
Digital Media MVP : 2004-2007
http://mvp.support.microsoft.com/mvpfaqs

.



Relevant Pages

  • Re: Recording Audio for a DVD
    ... break your video. ... videos I've seen that sound like they were recorded with a consumer ... video is gorgeous, if the audio stinks, it cheapens the value of the ... whatever you plug into this microphone jack, ...
    (rec.video.desktop)
  • Re: WMP11 stops playing files that played fine in wmp10
    ... Audio Codecs ... DMO WMAPro over S/PDIF DMO 0162 wmadmod.dll 11.0.5358.4827 DMO WMA Voice Decoder DMO 000A, 000B wmspdmod.dll 11.0.5358.4827 DMO Pixela Sampling Rate Regulator DMO 0001 ... ICM Intel IYUV codec IYUV iyuv_32.dll 5.1.2600.2180 ICM Microsoft RLE MRLE msrle32.dll 5.1.2600.2180 ICM Microsoft Video 1 MSVC msvidc32.dll 5.1.2600.0 ICM Microsoft YUV UYVY msyuv.dll 5.3.2600.2180 ICM Toshiba YUV Codec Y411 tsbyuv.dll 5.1.2600.0 ICM Microsoft YUV UYVY msyuv.dll 5.3.2600.2180 ...
    (microsoft.public.windowsmedia.player)
  • Top MP3 players
    ... TV and video formats supported: ... Support for 480p and 576p component TV out ... Low-Complexity version of the H.264 Baseline Profile with AAC-LC audio ... Additional features: Calendar, Bass Boost, Volume control, Voice ...
    (microsoft.public.windows.vista.music_pictures_video)
  • Re: Archive file
    ... >creating an archive while streaming. ... >in the PC and we are looking at streaming video and audio from the same PC. ... copy of the encoder pointing at the audio source and video source. ...
    (microsoft.public.windowsmedia.encoder)
  • FS DSR-80 DVCAM VTR very very LOW hours. Unit in NY $3400
    ... jog audio and digital slow functions. ... * Built-in SMPTE Time Code Generator/Reader ... * The DVCAM digital recording format for video ... provides a recognizable picture at various speeds over a ...
    (rec.video.marketplace)