[FFmpeg-devel] [PATCH] ffmpeg: Integrate two checks
Michael Niedermayer
michael at niedermayer.cc
Mon Jul 1 19:35:16 EEST 2019
On Sun, Jun 30, 2019 at 12:34:06AM +0200, Andreas Rheinhardt wrote:
> For audio packets with dts != AV_NOPTS_VALUE the dts 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 at gmail.com>
> ---
> fftools/ffmpeg.c | 16 +++++++---------
> 1 file changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> index 01f04103cf..755bc05bc1 100644
> --- a/fftools/ffmpeg.c
> +++ b/fftools/ffmpeg.c
> @@ -2044,20 +2044,18 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
> else
> opkt.pts = AV_NOPTS_VALUE;
>
> - 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;
> - }
> + (AVRational){1, ist->dec_ctx->sample_rate}, duration,
> + &ist->filter_in_rescale_delta_last, ost->mux_timebase);
> + } else
> + opkt.dts = av_rescale_q(pkt->dts, ist->st->time_base, ost->mux_timebase);
> + opkt.dts -= ost_tb_start_time;
Is this intended to have no effect on the output ?
it does have an effect, opkt.pts differs by ost_tb_start_time
thanks
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
During times of universal deceit, telling the truth becomes a
revolutionary act. -- George Orwell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190701/9ce013ee/attachment.sig>
More information about the ffmpeg-devel
mailing list