summaryrefslogtreecommitdiff
authorJustin Ruggles <justin.ruggles@gmail.com>2013-05-22 17:49:58 (GMT)
committer Derek Buitenhuis <derek.buitenhuis@gmail.com>2013-05-28 21:03:23 (GMT)
commite816a8bc26a9c9c72e4d3e0e1d6854ecffaa4fc0 (patch)
tree4d78561346d19386dbed92f38225834b12e63543
parentfe7136ef8202b19fda262ea91adc09b3367d37d7 (diff)
downloadffmpeg-e816a8bc26a9c9c72e4d3e0e1d6854ecffaa4fc0.zip
ffmpeg-e816a8bc26a9c9c72e4d3e0e1d6854ecffaa4fc0.tar.gz
ffmpeg-e816a8bc26a9c9c72e4d3e0e1d6854ecffaa4fc0.tar.bz2
ffmpeg: use actual packet pts when discarding for the copypriorss option
The ist->pts value at this point does not necessarily match the actual packet pts, which is what should be used to decide whether to discard the packet. Without this change, some video packets that have pts on or after the start time are getting discarded when they should not be. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Diffstat
-rw-r--r--ffmpeg.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 40b9608..886039b 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1388,6 +1388,7 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
{
OutputFile *of = output_files[ost->file_index];
int64_t ost_tb_start_time = av_rescale_q(of->start_time, AV_TIME_BASE_Q, ost->st->time_base);
+ int64_t ist_tb_start_time = av_rescale_q(of->start_time, AV_TIME_BASE_Q, ist->st->time_base);
AVPicture pict;
AVPacket opkt;
@@ -1397,9 +1398,15 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
!ost->copy_initial_nonkeyframes)
return;
- if (!ost->frame_number && ist->pts < of->start_time &&
- !ost->copy_prior_start)
- return;
+ if (pkt->pts == AV_NOPTS_VALUE) {
+ if (!ost->frame_number && ist->pts < of->start_time &&
+ !ost->copy_prior_start)
+ return;
+ } else {
+ if (!ost->frame_number && pkt->pts < ist_tb_start_time &&
+ !ost->copy_prior_start)
+ return;
+ }
if (of->recording_time != INT64_MAX &&
ist->pts >= of->recording_time + of->start_time) {