Media Player Audio and Video Out of Sync

If you’re seeing stange behavior in Media Player under CE 4.2, this might be of interest.


Symptom:


I have an MPEG4 QVGA file (WMV file extension) recorded with a bitrate of about 1000kbps.  When I play the video on the desktop everything is just fine.


When I play it on the device, bot the audio and video play, but the video “lags” the audio, and not by a small amount.  It’s an incremental loss, so they start out fine, but over time the video get further and further behind the audio which plays at what sounds like a normal rate.


For example, when I play off of a CF card, by the time the audio is at 0:30 in, the video is only showing the frames from about 0:15.  You read that right, it’s like the video is playing at about half speed.  If I play directly from RAM, the lag is about 30-40%.


Some other observations:



  • The “progress” bar on Media Player tracks with the audio, so when I play a 3:30 video, then the timer says 3:30, the audio finishes, yet the video continues to play, and from CF it will play for over another minute.  There’s not enough memory on this thig for it to be buffering that entire minute of video somewhere.

  • If I pause playback at some point where the audio and video are out of sync, then restart, both continue from where they left off, still out of sync.

  • If I stop the video, drag the progress slider to some point in the middle of the video and start it, the audio and video start synchronized at that point and begin diverging immediately.

  • If I add a load to the system by holding my finger on the touchpanel and wiggling the media player window around, thereby causing lots of interrupts, the lag amount does not change at all – so it seems load on the system doesn’t affect how far off it gets.

  • If I resize the window, making the video eitehr much larger (out to VGA) or much smaller than the 320×240 it was recorded at, the lag does not change.

  • The video plays fine on my WM5.0 device with a PXA270 (no graphics accelerator) off of SD, smooth video and audio.

  • The video plays ok on my Pocket PC 2003SE device from CF or SD.  The audio is smooth, but the video is a bit choppy from dropped frames.  The important thing though is that even with that, the video and audio are still in sync.  That’s how I thought Media Player was supposed to work and would be the behavior I’d expect on the custom hardware.

Explanation from Microsoft


“The problem was rooted from a frame dropping algorithm developed in Windows CE media player before 5.0. We have fixed correspondent bugs in CE 5.0 regarding this issue. So, from 5.0, CE media player does not have this problem.


If the HW resource is plentiful, e.g. faster CPU and memory bus speed (270 compared to 255), there would not be any frame drop. So, there won’t be any A/V sync problem, as you see on the 270 and desktop.


When you read data from a memory card (depending on how fast your card is), or display high bitrate video (e.g. 1mbps QVGA for 255), or on a slow CPU, CE Media Player on 4.2 could potentially trigger this frame dropping mode and therefore exhibit the A/V sync issue when dropping frames.


Windows CE Media Player and PocketPC Media Player use a different code base because CE Media Player needs to support a variety of HW platforms while PPC media player focuses on a single environment. This issue of A/V sync when dropping frames does not exist in the PocketPC Media Player code base.”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s