[FFmpeg-devel] [PATCH 2/2] ffmpeg: handling copyts use case in progress report computation
Michael Niedermayer
michael at niedermayer.cc
Fri Apr 27 20:54:45 EEST 2018
On Thu, Apr 26, 2018 at 10:34:00AM +0530, vdixit at akamai.com wrote:
> From: Vishwanath Dixit <vdixit at akamai.com>
>
> Progress report computation functionality was assuming the first
> PTS value to be zero, but, when 'copyts' is enalbed, the first PTS
> can be any big number. This was eventually causing display of
> weird statistics during execution of an ffmpeg command. To overcome
> this issue, the actual first PTS value has to be considered.
> ---
> fftools/ffmpeg.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> index d9bb78a..9b71525 100644
> --- a/fftools/ffmpeg.c
> +++ b/fftools/ffmpeg.c
> @@ -1646,7 +1646,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
> int frame_number, vid, i;
> double bitrate;
> double speed;
> - int64_t pts = INT64_MIN + 1;
> + int64_t pts = INT64_MIN + 1, first_pts = INT64_MAX;
> static int64_t last_time = -1;
> static int qp_histogram[52];
> int hours, mins, secs, us;
> @@ -1744,6 +1744,11 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
> }
> vid = 1;
> }
> +
> + /* Find the first written PTS among all the output streams */
> + first_pts = FFMIN(first_pts, av_rescale_q(ost->first_pts,
> + ost->enc_ctx->time_base,
> + AV_TIME_BASE_Q));
> /* compute min output value */
> if (av_stream_get_end_pts(ost->st) != AV_NOPTS_VALUE)
> pts = FFMAX(pts, av_rescale_q(av_stream_get_end_pts(ost->st),
> @@ -1752,6 +1757,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
> nb_frames_drop += ost->last_dropped;
> }
>
> + pts -= first_pts;
> secs = FFABS(pts) / AV_TIME_BASE;
> us = FFABS(pts) % AV_TIME_BASE;
> mins = secs / 60;
there is a check later for pts to be equal AV_NOPTS_VALUE
that will not work with a "first pts" offset
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
What does censorship reveal? It reveals fear. -- Julian Assange
-------------- 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/20180427/a1bc4e28/attachment.sig>
More information about the ffmpeg-devel
mailing list