When splitting video and linking is not active then don't use the first I frame\s timecode as the offset for the next file but the highest timecode + duration written to the previous file. Reason: For AVC/h.264 the timecode of the following P frames may be smaller than the first I frame's timecode.

This commit is contained in:
Moritz Bunkus 2007-03-22 09:06:14 +00:00
parent 4070ad45ee
commit f3a01efbe4
3 changed files with 15 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2007-03-22 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: bug fix: Fixed an issue with negative/huge timecodes
after splitting AVC/h.264 video.
2007-03-16 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: enhancement: The SRT reader allows "." as the decimal

View File

@ -36,6 +36,7 @@
cluster_helper_c::cluster_helper_c():
cluster(NULL),
max_video_timecode_rendered(0),
min_timecode_in_cluster(-1), max_timecode_in_cluster(-1),
current_split_point(split_points.begin()) {
@ -167,7 +168,8 @@ cluster_helper_c::add_packet(packet_cptr packet) {
first_timecode_in_file = -1;
if (no_linking)
timecode_offset = packet->assigned_timecode;
timecode_offset = video_packetizer ? max_video_timecode_rendered :
packet->assigned_timecode;
if (current_split_point->m_use_once)
++current_split_point;
@ -472,6 +474,12 @@ cluster_helper_c::render() {
pack->group = new_block_group;
last_block_group = new_block_group;
if (video_packetizer && (video_packetizer == source) &&
((pack->assigned_timecode + pack->duration) >
max_video_timecode_rendered))
max_video_timecode_rendered = pack->assigned_timecode +
pack->duration;
}
if (elements_in_cluster > 0) {

View File

@ -61,7 +61,7 @@ private:
kax_cluster_c *cluster;
vector<packet_cptr> packets;
int cluster_content_size;
int64_t max_timecode_and_duration;
int64_t max_timecode_and_duration, max_video_timecode_rendered;
int64_t last_cluster_tc, num_cue_elements, header_overhead;
int64_t packet_num, timecode_offset, *last_packets;
int64_t bytes_in_file, first_timecode_in_file;