Index: libhb/muxmp4.c =================================================================== --- libhb/muxmp4.c (revision 1278) +++ libhb/muxmp4.c (working copy) @@ -444,11 +444,20 @@ } /* Video */ + + if ( job->vfr ) + { + int64_t bias = ( buf->start * job->arate / 90000 ) - m->sum_dur; + duration = ( buf->stop - buf->start ) * job->arate / 90000 + bias; + } + else + { + duration = ( buf->stop * job->arate / 90000 ) - m->sum_dur; + } + /* Because we use the audio samplerate as the timescale, we have to use potentially variable durations so the video doesn't go out of sync */ - int64_t bias = ( buf->start * job->arate / 90000 ) - m->sum_dur; - duration = ( buf->stop - buf->start ) * job->arate / 90000 + bias; m->sum_dur += duration; } else