diff options
author | John Stebbins <[email protected]> | 2016-03-27 10:18:41 -0700 |
---|---|---|
committer | John Stebbins <[email protected]> | 2016-03-27 10:18:41 -0700 |
commit | 136f6bdf0a71a37b24b21501a66dc307b39487ef (patch) | |
tree | 0c431ea6e6675cbab446dd6845ed98d01b09fa08 /libhb | |
parent | 982883bafae3df039a25f137bfb2084ebb67150d (diff) |
muxavformat: fix muxer interleaving in mkv
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/muxavformat.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libhb/muxavformat.c b/libhb/muxavformat.c index 77065c1b3..2d249d436 100644 --- a/libhb/muxavformat.c +++ b/libhb/muxavformat.c @@ -1053,15 +1053,17 @@ static int avformatMux(hb_mux_object_t *m, hb_mux_data_t *track, hb_buffer_t *bu if (buf == NULL) return 0; - if (track->type == MUX_TYPE_VIDEO && (job->mux & HB_MUX_MASK_MKV)) + if (track->type == MUX_TYPE_VIDEO && (job->mux & HB_MUX_MASK_MKV) && + buf->s.renderOffset < 0) { // libav matroska muxer doesn't write dts to the output, but // if it sees a negative dts, it applies an offset to both pts // and dts to make it positive. This offset breaks chapter // start times and A/V sync. libav also requires that dts is // "monotically increasing", which means it last_dts <= next_dts. - // So we can't set dts = pts because pts can go backwards due to - // bframes. So set dts = 0 for mkv. + // It also uses dts to determine track interleaving, so we need + // to provide some reasonable dts value. + // So when renderOffset < 0, set to 0 for mkv. buf->s.renderOffset = 0; // Note: for MP4, libav allows negative dts and creates an edts // (edit list) entry in this case. |