From 31d0389758bd506a6c349d85c0d3191880d0dea4 Mon Sep 17 00:00:00 2001 From: John Stebbins Date: Fri, 3 Mar 2017 14:19:36 -0700 Subject: [PATCH] sync: fix small video dejitter error This very small error snowballs into a crash in x264 :-p If the amount of jitter on the first frame in the queue was small (about 1 tick) then jitter would not be removed from that frame. This extra tick of jitter can appear on different frames depending on when frame arrives and how much has been queued. This very small amount of randomness lead to problems in the VFR filter. A frame duration difference as small as 1 tick can lead to an extra frame getting duplicated when doing CFR. When doing 2 pass encoding, this extra frame causes x264 to crash at the end of the 2nd pass. --- libhb/sync.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libhb/sync.c b/libhb/sync.c index f199feff8..ac30f7e28 100644 --- a/libhb/sync.c +++ b/libhb/sync.c @@ -554,6 +554,11 @@ static void dejitterVideo( sync_stream_t * stream ) if (ABS(duration - frame_duration) < 1.1) { // Ignore small jitter + buf->s.start = stream->next_pts + frame_duration; + buf = hb_list_item(stream->in_queue, 0); + buf->s.start = stream->next_pts; + buf->s.duration = frame_duration; + buf->s.stop = stream->next_pts + frame_duration; return; } -- 2.40.0