Skip to content

Commit 0bb56d5

Browse files
authored
fix(timing): Fix --goptime producing compressed timestamps
2 parents 25d68b7 + 94a4392 commit 0bb56d5

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/ccextractor.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,11 @@ int start_ccx()
186186
ccx_options.use_gop_as_pts = 0;
187187
if (ccx_options.ignore_pts_jumps)
188188
ccx_common_timing_settings.disable_sync_check = 1;
189+
// When using GOP timing (--goptime), disable sync check because
190+
// GOP time (wall-clock) and PES PTS (stream-relative) are in
191+
// different time bases and will always appear as huge jumps.
192+
if (ccx_options.use_gop_as_pts == 1)
193+
ccx_common_timing_settings.disable_sync_check = 1;
189194
mprint("\rAnalyzing data in general mode\n");
190195
tmp = general_loop(ctx);
191196
if (!ret)

src/lib_ccx/general_loop.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,8 +1018,15 @@ int process_non_multiprogram_general_loop(struct lib_ccx_ctx *ctx,
10181018
pts = data_node_video->pts;
10191019
}
10201020

1021-
set_current_pts(dec_ctx_video->timing, pts);
1022-
set_fts(dec_ctx_video->timing);
1021+
// When using GOP timing (--goptime), timing is set from GOP headers
1022+
// in gop_header(), not from PES PTS. Skip PTS-based timing here
1023+
// to avoid conflicts between GOP time (absolute time-of-day) and
1024+
// PTS (relative stream time) that cause sync detection failures.
1025+
if (ccx_options.use_gop_as_pts != 1)
1026+
{
1027+
set_current_pts(dec_ctx_video->timing, pts);
1028+
set_fts(dec_ctx_video->timing);
1029+
}
10231030
}
10241031
size_t got = process_m2v(*enc_ctx, dec_ctx_video, data_node_video->buffer, data_node_video->len, dec_sub_video);
10251032
if (got > 0)

0 commit comments

Comments
 (0)