[FFmpeg-cvslog] avfilter/vf_decimate: fix overreads when using ppsrc
ffmpeg | branch: master | Paul B Mahol | Tue Dec 22 13:19:12 2020 +0100| [686c07fb1e0455c4205eaad18e8a01bf64058dec] | committer: Paul B Mahol avfilter/vf_decimate: fix overreads when using ppsrc Derive input parameters from correct inlink when using ppsrc. Previously both input frames would use dimensions of first inlink, causing crash if first inlink w/h was smaller than second one. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=686c07fb1e0455c4205eaad18e8a01bf64058dec --- libavfilter/vf_decimate.c | 59 --- 1 file changed, 25 insertions(+), 34 deletions(-) diff --git a/libavfilter/vf_decimate.c b/libavfilter/vf_decimate.c index 8407d9942c..25bd5bda57 100644 --- a/libavfilter/vf_decimate.c +++ b/libavfilter/vf_decimate.c @@ -297,46 +297,12 @@ static int activate(AVFilterContext *ctx) return 0; } -static int config_input(AVFilterLink *inlink) -{ -int max_value; -AVFilterContext *ctx = inlink->dst; -DecimateContext *dm = ctx->priv; -const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(inlink->format); -const int w = inlink->w; -const int h = inlink->h; - -dm->hsub = pix_desc->log2_chroma_w; -dm->vsub = pix_desc->log2_chroma_h; -dm->depth = pix_desc->comp[0].depth; -max_value = (1 << dm->depth) - 1; -dm->scthresh = (int64_t)(((int64_t)max_value * w * h * dm->scthresh_flt) / 100); -dm->dupthresh = (int64_t)(((int64_t)max_value * dm->blockx * dm->blocky * dm->dupthresh_flt) / 100); -dm->nxblocks = (w + dm->blockx/2 - 1) / (dm->blockx/2); -dm->nyblocks = (h + dm->blocky/2 - 1) / (dm->blocky/2); -dm->bdiffsize = dm->nxblocks * dm->nyblocks; -dm->bdiffs= av_malloc_array(dm->bdiffsize, sizeof(*dm->bdiffs)); -dm->queue = av_calloc(dm->cycle, sizeof(*dm->queue)); - -if (!dm->bdiffs || !dm->queue) -return AVERROR(ENOMEM); - -if (dm->ppsrc) { -dm->clean_src = av_calloc(dm->cycle, sizeof(*dm->clean_src)); -if (!dm->clean_src) -return AVERROR(ENOMEM); -} - -return 0; -} - static av_cold int decimate_init(AVFilterContext *ctx) { DecimateContext *dm = ctx->priv; AVFilterPad pad = { .name = "main", .type = AVMEDIA_TYPE_VIDEO, -.config_props = config_input, }; int ret; @@ -404,6 +370,31 @@ static int config_output(AVFilterLink *outlink) const AVFilterLink *inlink = ctx->inputs[dm->ppsrc ? INPUT_CLEANSRC : INPUT_MAIN]; AVRational fps = inlink->frame_rate; +int max_value; +const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(inlink->format); +const int w = inlink->w; +const int h = inlink->h; + +dm->hsub = pix_desc->log2_chroma_w; +dm->vsub = pix_desc->log2_chroma_h; +dm->depth = pix_desc->comp[0].depth; +max_value = (1 << dm->depth) - 1; +dm->scthresh = (int64_t)(((int64_t)max_value * w * h * dm->scthresh_flt) / 100); +dm->dupthresh = (int64_t)(((int64_t)max_value * dm->blockx * dm->blocky * dm->dupthresh_flt) / 100); +dm->nxblocks = (w + dm->blockx/2 - 1) / (dm->blockx/2); +dm->nyblocks = (h + dm->blocky/2 - 1) / (dm->blocky/2); +dm->bdiffsize = dm->nxblocks * dm->nyblocks; +dm->bdiffs= av_malloc_array(dm->bdiffsize, sizeof(*dm->bdiffs)); +dm->queue = av_calloc(dm->cycle, sizeof(*dm->queue)); + +if (!dm->bdiffs || !dm->queue) +return AVERROR(ENOMEM); + +if (dm->ppsrc) { +dm->clean_src = av_calloc(dm->cycle, sizeof(*dm->clean_src)); +if (!dm->clean_src) +return AVERROR(ENOMEM); +} if (!fps.num || !fps.den) { av_log(ctx, AV_LOG_ERROR, "The input needs a constant frame rate; " ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] ffmpeg: add option stats_period
ffmpeg | branch: master | Gyan Doshi | Mon Dec 21 14:34:49 2020 +0530| [842714b5cb4112ec6805ed228b34d711024ad9e2] | committer: Gyan Doshi ffmpeg: add option stats_period At present, progress stats are updated at a hardcoded interval of half a second. For long processes, this can lead to bloated logs and progress reports. Users can now set a custom period using option -stats_period Default is kept at 0.5 seconds. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=842714b5cb4112ec6805ed228b34d711024ad9e2 --- doc/ffmpeg.texi | 7 ++- fftools/ffmpeg.c | 2 +- fftools/ffmpeg.h | 1 + fftools/ffmpeg_opt.c | 18 ++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 95d6463685..62015d7565 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -675,14 +675,19 @@ Specify the preset for matching stream(s). Print encoding progress/statistics. It is on by default, to explicitly disable it you need to specify @code{-nostats}. +@item -stats_period @var{time} (@emph{global}) +Set period at which encoding progress/statistics are updated. Default is 0.5 seconds. + @item -progress @var{url} (@emph{global}) Send program-friendly progress information to @var{url}. -Progress information is written approximately every second and at the end of +Progress information is written periodically and at the end of the encoding process. It is made of "@var{key}=@var{value}" lines. @var{key} consists of only alphanumeric characters. The last key of a sequence of progress information is always "progress". +The update period is set using @code{-stats_period}. + @anchor{stdin option} @item -stdin Enable interaction on standard input. On by default unless standard input is diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index b446d9b206..6d25f1bca9 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1699,7 +1699,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti last_time = cur_time; return; } -if ((cur_time - last_time) < 50) +if ((cur_time - last_time) < stats_period) return; last_time = cur_time; } diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 3b54dab7fc..8046e75026 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -614,6 +614,7 @@ extern int debug_ts; extern int exit_on_error; extern int abort_on_flags; extern int print_stats; +extern int64_t stats_period; extern int qp_hist; extern int stdin_interaction; extern int frame_bits_per_raw_sample; diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 7ee034c9c9..242468fc64 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -174,6 +174,7 @@ int filter_nbthreads = 0; int filter_complex_nbthreads = 0; int vstats_version = 2; int auto_conversion_filters = 1; +int64_t stats_period = 50; static int intra_only = 0; @@ -282,6 +283,21 @@ static int opt_abort_on(void *optctx, const char *opt, const char *arg) return av_opt_eval_flags(&pclass, &opts[0], arg, &abort_on_flags); } +static int opt_stats_period(void *optctx, const char *opt, const char *arg) +{ +int64_t user_stats_period = parse_time_or_die(opt, arg, 1); + +if (user_stats_period <= 0) { +av_log(NULL, AV_LOG_ERROR, "stats_period %s must be positive.\n", arg); +return AVERROR(EINVAL); +} + +stats_period = user_stats_period; +av_log(NULL, AV_LOG_INFO, "ffmpeg stats and -progress period set to %s.\n", arg); + +return 0; +} + static int opt_sameq(void *optctx, const char *opt, const char *arg) { av_log(NULL, AV_LOG_ERROR, "Option '%s' was removed. " @@ -3557,6 +3573,8 @@ const OptionDef options[] = { "enable automatic conversion filters globally" }, { "stats", OPT_BOOL,{ &print_stats }, "print progress report during encoding", }, +{ "stats_period",HAS_ARG | OPT_EXPERT, { .func_arg = opt_stats_period }, +"set the period at which ffmpeg updates stats and -progress output", "time" }, { "attach", HAS_ARG | OPT_PERFILE | OPT_EXPERT | OPT_OUTPUT, { .func_arg = opt_attach }, "add an attachment to the output file", "filename" }, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] ffmpeg: don't delay printing initial stats
ffmpeg | branch: master | Gyan Doshi | Mon Dec 21 15:04:15 2020 +0530| [3e47bbad56e8a00bf502829403f298e17c69dd1a] | committer: Gyan Doshi ffmpeg: don't delay printing initial stats The first stats is printed after the initial stats_period has elapsed. With a large period, it may appear that ffmpeg has frozen at startup. The initial stats is now printed after the first transcode_step. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3e47bbad56e8a00bf502829403f298e17c69dd1a --- fftools/ffmpeg.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 6d25f1bca9..2c0820aacf 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1685,6 +1685,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti double speed; int64_t pts = INT64_MIN + 1; static int64_t last_time = -1; +static int first_report = 1; static int qp_histogram[52]; int hours, mins, secs, us; const char *hours_sign; @@ -1697,9 +1698,8 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti if (!is_last_report) { if (last_time == -1) { last_time = cur_time; -return; } -if ((cur_time - last_time) < stats_period) +if ((cur_time - last_time) < stats_period && !first_report) return; last_time = cur_time; } @@ -1876,6 +1876,8 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti } } +first_report = 0; + if (is_last_report) print_final_stats(total_size); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/hlsenc: Add dependency on avc.o
ffmpeg | branch: master | Derek Buitenhuis | Tue Dec 22 15:58:53 2020 -0500| [a7f9b3b954ece129402ac7ef8f96e0fa1c01d8ba] | committer: Derek Buitenhuis avformat/hlsenc: Add dependency on avc.o a2b1dd0ce301450a47c972745a6b33c4c273aa5d added a dependency on ff_nal_unit_extract_rbsp. Signed-off-by: Derek Buitenhuis > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a7f9b3b954ece129402ac7ef8f96e0fa1c01d8ba --- libavformat/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/Makefile b/libavformat/Makefile index 97d868081b..3a8fbcbe5f 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -238,7 +238,7 @@ OBJS-$(CONFIG_HDS_MUXER) += hdsenc.o OBJS-$(CONFIG_HEVC_DEMUXER) += hevcdec.o rawdec.o OBJS-$(CONFIG_HEVC_MUXER)+= rawenc.o OBJS-$(CONFIG_HLS_DEMUXER) += hls.o -OBJS-$(CONFIG_HLS_MUXER) += hlsenc.o hlsplaylist.o +OBJS-$(CONFIG_HLS_MUXER) += hlsenc.o hlsplaylist.o avc.o OBJS-$(CONFIG_HNM_DEMUXER) += hnm.o OBJS-$(CONFIG_ICO_DEMUXER) += icodec.o OBJS-$(CONFIG_ICO_MUXER) += icoenc.o ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".