From 91b412e786055aec3c5b6529a0c9ecc70fde8a6d Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 28 Nov 2011 11:47:02 +0100 Subject: avconv: update InputStream.pts in the streamcopy case. This was broken in 2a651b719c309c5e2fc663a5a9d6ca36153ab98f. --- avconv.c | 1 + 1 file changed, 1 insertion(+) (limited to 'avconv.c') diff --git a/avconv.c b/avconv.c index 4c5498ad93..067678d637 100644 --- a/avconv.c +++ b/avconv.c @@ -1906,6 +1906,7 @@ static int output_packet(InputStream *ist, /* handle stream copy */ if (!ist->decoding_needed) { rate_emu_sleep(ist); + ist->pts = ist->next_pts; switch (ist->st->codec->codec_type) { case AVMEDIA_TYPE_AUDIO: ist->next_pts += ((int64_t)AV_TIME_BASE * ist->st->codec->frame_size) / -- cgit v1.2.3 From 741a05a2936505476ec0ff484d1251276635af73 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 28 Nov 2011 11:15:06 +0100 Subject: avconv: compute next_pts from input packet duration when possible. --- avconv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'avconv.c') diff --git a/avconv.c b/avconv.c index 067678d637..ab0d4eca20 100644 --- a/avconv.c +++ b/avconv.c @@ -1747,7 +1747,9 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int } ist->next_pts = ist->pts = guess_correct_pts(&ist->pts_ctx, decoded_frame->pkt_pts, decoded_frame->pkt_dts); - if (ist->st->codec->time_base.num != 0) { + if (pkt->duration) + ist->next_pts += av_rescale_q(pkt->duration, ist->st->time_base, AV_TIME_BASE_Q); + else if (ist->st->codec->time_base.num != 0) { int ticks = ist->st->parser ? ist->st->parser->repeat_pict + 1 : ist->st->codec->ticks_per_frame; ist->next_pts += ((int64_t)AV_TIME_BASE * -- cgit v1.2.3 From 7bb3e6259492c9923881f906be88b0c2eb5e071e Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 29 Nov 2011 11:10:31 +0100 Subject: avconv: make copy_tb on by default. I.e. on streamcopy set output codec timebase from input stream timebase (as opposed to input codec timebase). This should be more sane, because since the stream is not decoded, the input codec tb has no relation to the timestamps of the copied packets. --- avconv.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'avconv.c') diff --git a/avconv.c b/avconv.c index ab0d4eca20..d6045b7ef4 100644 --- a/avconv.c +++ b/avconv.c @@ -113,7 +113,7 @@ static int video_sync_method= -1; static int audio_sync_method= 0; static float audio_drift_threshold= 0.1; static int copy_ts= 0; -static int copy_tb; +static int copy_tb = 1; static int opt_shortest = 0; static char *vstats_filename; static FILE *vstats_file; @@ -2067,9 +2067,7 @@ static int transcode_init(OutputFile *output_files, } memcpy(codec->extradata, icodec->extradata, icodec->extradata_size); codec->extradata_size = icodec->extradata_size; - if (!copy_tb && - av_q2d(icodec->time_base)*icodec->ticks_per_frame > av_q2d(ist->st->time_base) && - av_q2d(ist->st->time_base) < 1.0/500) { + if (!copy_tb) { codec->time_base = icodec->time_base; codec->time_base.num *= icodec->ticks_per_frame; av_reduce(&codec->time_base.num, &codec->time_base.den, -- cgit v1.2.3