Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »



h264 audio and video out of sync

14 replies [Last post]

We are having an issue with the JW Player playing h264 videos, at certain points in the video playback the audio and video go out of sync, this can be as much as 10 seconds. I am really at a loss as to why this is, any help or advice would be greatly accepted.

please post a link to your testpage showing the problem (else it will be a guess what is the reason)

A direct url would be :

It's noticeable at around 1:53

i have not been able to play your file without sync problems in any flash based player without converting it.

i first tried converting to .mp4 (using http://media-convert.com) but then the image didnt show -
i then tried to convert to .flv which worked fine - no sync problem - but that ofcourse makes the image quality terribly bad...

so with a bit of luck and some experimenting it ought to be possible to find some combination of encoding settings that will give the desired result - it might be a good idea first to export the screen recording in a reasonably lossless video format like .avi or the like before converting...

for more info on video compression please see -

and also checkout - http://www.bitsontherun.com/

or try some of the trial versions from http://www.adobe.com

Your audio is at a samplerate of 48000kHz and a bitrate of 768kbps.

Flash will convert 48000kHz to 44100kHz, which might mess up the sync. Also, the incredibly high bitrate of 768kbps might make it impossible for Flash to keep up with the audio decoding. For mono audio, 96kbps is plenty of bits.

@kLink - how did you determine the sample and bitrate of the audio ?

i have sometimes had good use of this neat little tool - http://www.headbands.com/gspot/
but it is ever so sligthly dated...

thanks - i guess its this you mean? http://mediainfo.sourceforge.net/en

Yup, that's the one.

Hi we have even tried to run a video with the sound set to 64 bit, and this makes no difference the audio and video go out of sync. We have tired various other movies of different lengths and all exhibit the same sync issues, I don't think this is a problem just with JW Player, the same sync issues happen in Adobe Movie Player

@Colin Boyd - stick to 44.1kHz for the sound - that is supposed to work !
- and yes it is most probably the known problem with the flash plugin

Hi everyone --

Here's the solution to your problem with a brief explanation as to why it happens.

The H.264 is not a completely "contained" compression method -- by this I mean that Audio and Video tracks are still treated as separate entities that only QuickTime can recognize integrated timing information to match each track with one another. Flash, however, can not detect this information and so when it sees a gap of no audio, it shifts the remaining audio to fill in the gap, thus causing a sync issue. Why? Not entirely sure -- it's a Flash issue that has never been addressed by Macromedia/Adobe.


Create a white noise track (generated in a sound program like Soundtrack) that is the complete duration of your video tracks and insert it underneath your currently existing audio track. Set the level to around -70dB thus making it inaudible. This track acts as a binding track to keep things in sync. Export as a self-contained file and compress as you normally would. You can still use H.264 as your compression method.

If you've already done the editing there are methods to automate inserting an audio track with already rendered/exported H.264 files. You will need FFMPEG, SOX, and a programming language (our department used Perl) If you have these programs then you can write up a short script that will input the source file, output the audio, create a whitenoise track, mux the whitenoise to the audio track, and re-insert the new audio file to the source video.


Andrew G. Wallace
Multimedia Specialist
Pearson Video Production Services

Fascinating. I probably would never have figured this out, but I did notice that gaps of silence in my H.264 files are "closed up" in the Flash player. The pauses, so carefully edited and timed, are collapsed. I thought I was going crazy! Thanks Andrew.

Andrew Wallace,

I tried your solution and still have audio sync issues.

There is one little weird thing to this issue I am having...I will get to that. :)

I edited my video in Final Cut Pro. Then, exported using File > Export > Using QuickTime Conversion...

In the format dropdown I selected QuickTime Movie, then click the options button. These are my settings:

Compression: H.264
Key Frame Rate: 24
Encoding Mode: Multi-pass
Dimensions: 720x480

Format: Integer (Little Endian)
Sample Rate: 48.000 kHz
Sample Size: 16-bit
Channels: Stereo

Then, I converted the .mov file to .flv using VisualHub. I selected flash, checked 320 pixels wide, checked raw .flv format, set quality to go nuts and left everything else as default.

Ok, so now I have my .flv file. I include the swfobject script and jw player on my site.

Now for the weird part. The video plays back in sync and smooth when using Firefox (Mac/PC), Safari (Mac/PC), and Chrome (Mac/PC). But, the audio is out of sync...and...the overall video is sluggish in Internet Explorer 6, 7, and 8.

Why is this...why does it not play right in IE. My first thought is that the JavaScript engine in IE is not on par with the other browsers (I could be off in left field on this).

Any suggestions or do you know why this is?

Thanks in advance!



Thank you for that explanation -- it was very helpful. Now this isn't a JW Player specific problem, it's a adobe flash problem correct? I've been able to reproduce the problem identically in flow player. Is this something we can expect adobe to address?