diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2013-02-06 00:19:52 +0100 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2013-02-06 22:55:18 +0100 |
commit | b3d2c6f8b9d0ff577a5a32ad5ae417b8b3523317 (patch) | |
tree | 39c2cdf674d7e231ef97194d0142c2e0e4fd3a74 | |
parent | 59d40fc7e66e6ebb2d89e25115492bfe13b07d95 (diff) | |
download | ffmpeg-b3d2c6f8b9d0ff577a5a32ad5ae417b8b3523317.tar.gz |
lavf/segment: fix DTS inconsistencies with -reset_timestamps
The DTS needs to be resynched against the segment start PTS, or the
resulting DTS may result < PTS.
Reported-by: Owen Jones <riots6@gmail.com>
See thread:
Subject: [FFmpeg-user] pts/dts error using reset_timestamps while splitting a DVD
Date: Sat, 19 Jan 2013 08:58:27 +0000
-rw-r--r-- | libavformat/segment.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/libavformat/segment.c b/libavformat/segment.c index 4ae2019a68..13d8c43589 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -42,7 +42,7 @@ typedef struct SegmentListEntry { int index; double start_time, end_time; - int64_t start_pts, start_dts; + int64_t start_pts; char filename[1024]; struct SegmentListEntry *next; } SegmentListEntry; @@ -664,8 +664,6 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt) seg->cur_entry.index = seg->segment_idx; seg->cur_entry.start_time = (double)pkt->pts * av_q2d(st->time_base); seg->cur_entry.start_pts = av_rescale_q(pkt->pts, st->time_base, AV_TIME_BASE_Q); - seg->cur_entry.start_dts = pkt->dts != AV_NOPTS_VALUE ? - av_rescale_q(pkt->dts, st->time_base, AV_TIME_BASE_Q) : seg->cur_entry.start_pts; } else if (pkt->pts != AV_NOPTS_VALUE) { seg->cur_entry.end_time = FFMAX(seg->cur_entry.end_time, (double)(pkt->pts + pkt->duration) * av_q2d(st->time_base)); @@ -679,18 +677,17 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt) } if (seg->reset_timestamps) { - av_log(s, AV_LOG_DEBUG, "stream:%d start_pts_time:%s pts:%s pts_time:%s start_dts_time:%s dts:%s dts_time:%s", + av_log(s, AV_LOG_DEBUG, "stream:%d start_pts_time:%s pts:%s pts_time:%s dts:%s dts_time:%s", pkt->stream_index, av_ts2timestr(seg->cur_entry.start_pts, &AV_TIME_BASE_Q), av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &st->time_base), - av_ts2timestr(seg->cur_entry.start_dts, &AV_TIME_BASE_Q), av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &st->time_base)); /* compute new timestamps */ if (pkt->pts != AV_NOPTS_VALUE) pkt->pts -= av_rescale_q(seg->cur_entry.start_pts, AV_TIME_BASE_Q, st->time_base); if (pkt->dts != AV_NOPTS_VALUE) - pkt->dts -= av_rescale_q(seg->cur_entry.start_dts, AV_TIME_BASE_Q, st->time_base); + pkt->dts -= av_rescale_q(seg->cur_entry.start_pts, AV_TIME_BASE_Q, st->time_base); av_log(s, AV_LOG_DEBUG, " -> pts:%s pts_time:%s dts:%s dts_time:%s\n", av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &st->time_base), |