From 6fb6e16aa7ff20fef78520f8a0f300574d509579 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 28 Dec 2015 18:45:59 +0100 Subject: [PATCH] MP4 reader: fix constant offset edit list type detection An edit list with two entries where the first entry's media time is -1 means that a fixed offset must be applied to the timestamps. This is independent of the segment_duration value of the second edit list entry. Fixes #1547. --- ChangeLog | 5 +++++ src/input/r_qtmp4.cpp | 4 ++-- tests/results.txt | 1 + ..._edit_list_constant_offset_with_segment_duration_not_0.rb | 5 +++++ 4 files changed, 13 insertions(+), 2 deletions(-) create mode 100755 tests/test-521mp4_edit_list_constant_offset_with_segment_duration_not_0.rb diff --git a/ChangeLog b/ChangeLog index 6802c29e4..2d1dd0dd5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,11 @@ 2015-12-28 Moritz Bunkus + * mkvmerge: bug fix: MP4 edit lists of certain types (two entries, + first entry's media_time is -1, second entry's segment_duration is + != 0) weren't handled properly resulting in key frame flags being + assigned to the wrong frames. Fixes #1547. + * mkvmerge: bug fix: the h.265/HEVC code was writing SEI NALUs twice. This had already been mentioned in #1076 but never fixed. Patch by VladimĂ­r PilnĂ˝. diff --git a/src/input/r_qtmp4.cpp b/src/input/r_qtmp4.cpp index df570fdec..5b20024fb 100644 --- a/src/input/r_qtmp4.cpp +++ b/src/input/r_qtmp4.cpp @@ -2207,8 +2207,8 @@ qtmp4_demuxer_c::update_editlist_table() { raw_offset = editlist_table[0].media_time; constant_editlist_offset_ns = (-editlist_table[0].media_time + (frame_offset_table.empty() ? 0 : frame_offset_table[0])) * 1000000000ll / time_scale; - } else if ((editlist_table.size() == 2) && (-1 == editlist_table[0].media_time) && (0 == editlist_table[1].media_time)) { - mxdebug_if(m_debug_editlists, boost::format("Track ID %1%: Edit list analysis: type 3: two entries; first with time == -1, second zero time\n") % id); + } else if ((editlist_table.size() == 2) && (-1 == editlist_table[0].media_time)) { + mxdebug_if(m_debug_editlists, boost::format("Track ID %1%: Edit list analysis: type 3: two entries; first with time == -1\n") % id); simple_editlist_type = 3; raw_offset = editlist_table[0].segment_duration; constant_editlist_offset_ns = (editlist_table[0].segment_duration * 1000000000ll / global_time_scale) - ((frame_offset_table.empty() ? 0 : frame_offset_table[0]) * 1000000000ll / time_scale); diff --git a/tests/results.txt b/tests/results.txt index c4d31d708..413900936 100644 --- a/tests/results.txt +++ b/tests/results.txt @@ -366,3 +366,4 @@ T_517h264_forbidden_byte_sequence_in_slice_nalu:74e0fb1a25397078335c6d94974dc168 T_518mlp:bc0269df9e0c0c968e4a408d7da46d35-0624d3f1975273199a0e12a9f4b0fd20:passed:20151229-134422:0.895368448 T_519truehd:33f8c0f013c71529281179cf8669c567-33f8c0f013c71529281179cf8669c567:passed:20151229-135950:3.160459472 T_520truehd_mlp_atmos_detection:790fe7a0cca6dfe0f4439fb36afd9d40+true-dc4a06c661033cb21e70bb25b661130a+true-565bc55dc9b15f81064785367040a978+true-93866c2e47b7aa3b8cf2483e8beb09ac+true-39d23fdc03248412b4bd364e51e4cf23+true-b41aaef4bd7e736256ff497be64e1e1f+true:passed:20151229-160649:5.913862696 +T_521mp4_edit_list_constant_offset_with_segment_duration_not_0:bbd7a6660a2a5325a67470a91208b643:passed:20151228-185646:0.621563048 diff --git a/tests/test-521mp4_edit_list_constant_offset_with_segment_duration_not_0.rb b/tests/test-521mp4_edit_list_constant_offset_with_segment_duration_not_0.rb new file mode 100755 index 000000000..dc3c73d77 --- /dev/null +++ b/tests/test-521mp4_edit_list_constant_offset_with_segment_duration_not_0.rb @@ -0,0 +1,5 @@ +#!/usr/bin/ruby -w + +# T_521mp4_edit_list_constant_offset_with_segment_duration_not_0 +describe "mkvmerge / MP4, edit list with two entries, first's media_time == -1, second's segment_duration != 0" +test_merge "data/mp4/edit_list_constant_offset_segment_duration_not_0.mp4", :args => "--no-audio"