--- frontend/main.c.orig 2007-11-01 13:33:30.000000000 -0700 +++ frontend/main.c 2008-09-16 11:01:40.000000000 -0700 @@ -911,12 +911,14 @@ if (sampleId == 0) dur = 0; if (useAacLength || (timescale != samplerate)) { sample_count = frameInfo.samples; } else { sample_count = (unsigned int)(dur * frameInfo.channels); + if (sample_count > frameInfo.samples) + sample_count = frameInfo.samples; if (!useAacLength && !initial && (sampleId < numSamples/2) && (sample_count != frameInfo.samples)) { faad_fprintf(stderr, "MP4 seems to have incorrect frame duration, using values from AAC data.\n"); useAacLength = 1; sample_count = frameInfo.samples;