diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2019-10-12 05:18:39 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-02-13 00:40:47 +0100 |
commit | 13dc90396d6d8eb70c583b94fb2978ed5a3f417c (patch) | |
tree | c0176316d271a99b7bcc1e642cdb1b4dbcf550de /fftools/ffmpeg.c | |
parent | 568d62117d7cb6df803cac267ea86d76730078ca (diff) | |
download | ffmpeg-13dc90396d6d8eb70c583b94fb2978ed5a3f417c.tar.gz |
fftools/ffmpeg: Integrate two checks
For audio packets with dts != AV_NOPTS_VALUEs the dts was converted
twice to the muxer's timebase during streamcopy, once as a normal
packet and once specifically as an audio packet. This has been changed.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'fftools/ffmpeg.c')
-rw-r--r-- | fftools/ffmpeg.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index b0bffe0a54..a43f94bef6 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -2048,20 +2048,20 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p if (pkt->pts != AV_NOPTS_VALUE) opkt.pts = av_rescale_q(pkt->pts, ist->st->time_base, ost->mux_timebase) - ost_tb_start_time; - if (pkt->dts == AV_NOPTS_VALUE) + if (pkt->dts == AV_NOPTS_VALUE) { opkt.dts = av_rescale_q(ist->dts, AV_TIME_BASE_Q, ost->mux_timebase); - else - opkt.dts = av_rescale_q(pkt->dts, ist->st->time_base, ost->mux_timebase); - opkt.dts -= ost_tb_start_time; - - if (ost->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && pkt->dts != AV_NOPTS_VALUE) { + } else if (ost->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) { int duration = av_get_audio_frame_duration(ist->dec_ctx, pkt->size); if(!duration) duration = ist->dec_ctx->frame_size; - opkt.dts = opkt.pts = av_rescale_delta(ist->st->time_base, pkt->dts, - (AVRational){1, ist->dec_ctx->sample_rate}, duration, &ist->filter_in_rescale_delta_last, - ost->mux_timebase) - ost_tb_start_time; - } + opkt.dts = av_rescale_delta(ist->st->time_base, pkt->dts, + (AVRational){1, ist->dec_ctx->sample_rate}, duration, + &ist->filter_in_rescale_delta_last, ost->mux_timebase); + /* dts will be set immediately afterwards to what pts is now */ + opkt.pts = opkt.dts - ost_tb_start_time; + } else + opkt.dts = av_rescale_q(pkt->dts, ist->st->time_base, ost->mux_timebase); + opkt.dts -= ost_tb_start_time; opkt.duration = av_rescale_q(pkt->duration, ist->st->time_base, ost->mux_timebase); |