Re: [FFmpeg-devel] [PATCH 1/2] fftools/ffmpeg_filter: add -autoscale to disable/enable the default scale

2019-07-20 Thread Michael Niedermayer
On Thu, Jul 18, 2019 at 10:22:23PM +0200, Michael Niedermayer wrote:
> On Thu, Jul 18, 2019 at 02:44:46PM +, Eoff, Ullysses A wrote:
> > > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of 
> > > Michael Niedermayer
> > > On Mon, Jul 15, 2019 at 06:38:35PM +0800, Linjie Fu wrote:
> > > > +{ "autoscale",HAS_ARG | OPT_BOOL | OPT_SPEC |
> > > > +  OPT_EXPERT | OPT_INPUT,  
> > > >   { .off = OFFSET(autoscale) },
> > > > +"automatically insert correct scale filters" },
> > > 
> > > I think this description is inadequate to understand what the option does.
> > > Scale filters are inserted at various places (for example within a filter
> > > graph). This option here affects a specific case.
> > > 
> > 
> > Would this be sufficient?
> > 
> > "automatically insert a scale filter to scale the output of all frames to
> >   match the resolution of the initial frame"
> 
> this sounds better, yes
> 
> 
> > 
> > If not, any other suggestions?
> 
> maybe it could say how this relates to the filter graph/chain. 
> the user doenst know from this if this occurs before or after the
> filter graph.
> 
> 
> Also what happens when a encoder/muxer does not support this ?

I presume it fails in this case and if so a flag is needed
something like AV_CODEC_CAP_VARIABLE_DIMENSIONS

This would also decrease the number of cases where this doesnt
work without providing a clear error message

Thanks

[...]


-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

During times of universal deceit, telling the truth becomes a
revolutionary act. -- George Orwell


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/2] fftools/ffmpeg_filter: add -autoscale to disable/enable the default scale

2019-07-18 Thread Michael Niedermayer
On Thu, Jul 18, 2019 at 02:44:46PM +, Eoff, Ullysses A wrote:
> > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of 
> > Michael Niedermayer
> > On Mon, Jul 15, 2019 at 06:38:35PM +0800, Linjie Fu wrote:
> > > +{ "autoscale",HAS_ARG | OPT_BOOL | OPT_SPEC |
> > > +  OPT_EXPERT | OPT_INPUT,
> > > { .off = OFFSET(autoscale) },
> > > +"automatically insert correct scale filters" },
> > 
> > I think this description is inadequate to understand what the option does.
> > Scale filters are inserted at various places (for example within a filter
> > graph). This option here affects a specific case.
> > 
> 
> Would this be sufficient?
> 
> "automatically insert a scale filter to scale the output of all frames to
>   match the resolution of the initial frame"

this sounds better, yes


> 
> If not, any other suggestions?

maybe it could say how this relates to the filter graph/chain. 
the user doenst know from this if this occurs before or after the
filter graph.


Also what happens when a encoder/muxer does not support this ?

Thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/2] fftools/ffmpeg_filter: add -autoscale to disable/enable the default scale

2019-07-18 Thread Eoff, Ullysses A
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of 
> Michael Niedermayer
> On Mon, Jul 15, 2019 at 06:38:35PM +0800, Linjie Fu wrote:
> > +{ "autoscale",HAS_ARG | OPT_BOOL | OPT_SPEC |
> > +  OPT_EXPERT | OPT_INPUT,  
> >   { .off = OFFSET(autoscale) },
> > +"automatically insert correct scale filters" },
> 
> I think this description is inadequate to understand what the option does.
> Scale filters are inserted at various places (for example within a filter
> graph). This option here affects a specific case.
> 

Would this be sufficient?

"automatically insert a scale filter to scale the output of all frames to
  match the resolution of the initial frame"

If not, any other suggestions?

Thanks,
U. Artie
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/2] fftools/ffmpeg_filter: add -autoscale to disable/enable the default scale

2019-07-17 Thread Michael Niedermayer
On Mon, Jul 15, 2019 at 06:38:35PM +0800, Linjie Fu wrote:
> Currently, ffmpeg inserts scale filter by default in the filter graph
> to force the whole decoded stream to scale into the same size with the
> first frame. It's not quite make sense in resolution changing cases if
> user wants the rawvideo without any scale.
> 
> Using autoscale/noautoscale to indicate whether auto inserting the scale
> filter in the filter graph:
> -noautoscale or -autoscale 0:
> disable the default auto scale filter inserting.
> 
> Signed-off-by: Linjie Fu 
> ---
>  fftools/ffmpeg.c| 1 +
>  fftools/ffmpeg.h| 4 
>  fftools/ffmpeg_filter.c | 2 +-
>  fftools/ffmpeg_opt.c| 5 +
>  4 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> index 01f04103cf..5d52430b1e 100644
> --- a/fftools/ffmpeg.c
> +++ b/fftools/ffmpeg.c
> @@ -2133,6 +2133,7 @@ static int ifilter_send_frame(InputFilter *ifilter, 
> AVFrame *frame)
>  
>  /* determine if the parameters for this input changed */
>  need_reinit = ifilter->format != frame->format;
> +fg->autoscale = ifilter->ist->autoscale;
>  
>  switch (ifilter->ist->st->codecpar->codec_type) {
>  case AVMEDIA_TYPE_AUDIO:
> diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
> index 7b6f802082..1602406581 100644
> --- a/fftools/ffmpeg.h
> +++ b/fftools/ffmpeg.h
> @@ -133,6 +133,8 @@ typedef struct OptionsContext {
>  intnb_hwaccel_output_formats;
>  SpecifierOpt *autorotate;
>  intnb_autorotate;
> +SpecifierOpt *autoscale;
> +intnb_autoscale;
>  
>  /* output options */
>  StreamMap *stream_maps;
> @@ -285,6 +287,7 @@ typedef struct FilterGraph {
>  
>  AVFilterGraph *graph;
>  int reconfiguration;
> +int autoscale;
>  
>  InputFilter   **inputs;
>  int  nb_inputs;
> @@ -335,6 +338,7 @@ typedef struct InputStream {
>  int guess_layout_max;
>  
>  int autorotate;
> +int autoscale;
>  
>  int fix_sub_duration;
>  struct { /* previous decoded subtitle and related variables */
> diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
> index 72838de1e2..2a2eb080eb 100644
> --- a/fftools/ffmpeg_filter.c
> +++ b/fftools/ffmpeg_filter.c
> @@ -469,7 +469,7 @@ static int configure_output_video_filter(FilterGraph *fg, 
> OutputFilter *ofilter,
>  if (ret < 0)
>  return ret;
>  
> -if (ofilter->width || ofilter->height) {
> +if ((ofilter->width || ofilter->height) && fg->autoscale) {
>  char args[255];
>  AVFilterContext *filter;
>  AVDictionaryEntry *e = NULL;
> diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
> index f5ca18aa64..47f90c22aa 100644
> --- a/fftools/ffmpeg_opt.c
> +++ b/fftools/ffmpeg_opt.c
> @@ -742,7 +742,9 @@ static void add_input_streams(OptionsContext *o, 
> AVFormatContext *ic)
>  MATCH_PER_STREAM_OPT(ts_scale, dbl, ist->ts_scale, ic, st);
>  
>  ist->autorotate = 1;
> +ist->autoscale  = 1;
>  MATCH_PER_STREAM_OPT(autorotate, i, ist->autorotate, ic, st);
> +MATCH_PER_STREAM_OPT(autoscale, i, ist->autoscale, ic, st);
>  
>  MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, ic, st);
>  if (codec_tag) 
{

> @@ -3640,6 +3642,9 @@ const OptionDef options[] = {
>  { "autorotate",   HAS_ARG | OPT_BOOL | OPT_SPEC |
>OPT_EXPERT | OPT_INPUT,
> { .off = OFFSET(autorotate) },
>  "automatically insert correct rotate filters" },
> +{ "autoscale",HAS_ARG | OPT_BOOL | OPT_SPEC |
> +  OPT_EXPERT | OPT_INPUT,
> { .off = OFFSET(autoscale) },
> +"automatically insert correct scale filters" },

I think this description is inadequate to understand what the option does.
Scale filters are inserted at various places (for example within a filter
graph). This option here affects a specific case.

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety -- Benjamin Franklin


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/2] fftools/ffmpeg_filter: add -autoscale to disable/enable the default scale

2019-07-15 Thread Linjie Fu
Currently, ffmpeg inserts scale filter by default in the filter graph
to force the whole decoded stream to scale into the same size with the
first frame. It's not quite make sense in resolution changing cases if
user wants the rawvideo without any scale.

Using autoscale/noautoscale to indicate whether auto inserting the scale
filter in the filter graph:
-noautoscale or -autoscale 0:
disable the default auto scale filter inserting.

Signed-off-by: Linjie Fu 
---
 fftools/ffmpeg.c| 1 +
 fftools/ffmpeg.h| 4 
 fftools/ffmpeg_filter.c | 2 +-
 fftools/ffmpeg_opt.c| 5 +
 4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 01f04103cf..5d52430b1e 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2133,6 +2133,7 @@ static int ifilter_send_frame(InputFilter *ifilter, 
AVFrame *frame)
 
 /* determine if the parameters for this input changed */
 need_reinit = ifilter->format != frame->format;
+fg->autoscale = ifilter->ist->autoscale;
 
 switch (ifilter->ist->st->codecpar->codec_type) {
 case AVMEDIA_TYPE_AUDIO:
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 7b6f802082..1602406581 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -133,6 +133,8 @@ typedef struct OptionsContext {
 intnb_hwaccel_output_formats;
 SpecifierOpt *autorotate;
 intnb_autorotate;
+SpecifierOpt *autoscale;
+intnb_autoscale;
 
 /* output options */
 StreamMap *stream_maps;
@@ -285,6 +287,7 @@ typedef struct FilterGraph {
 
 AVFilterGraph *graph;
 int reconfiguration;
+int autoscale;
 
 InputFilter   **inputs;
 int  nb_inputs;
@@ -335,6 +338,7 @@ typedef struct InputStream {
 int guess_layout_max;
 
 int autorotate;
+int autoscale;
 
 int fix_sub_duration;
 struct { /* previous decoded subtitle and related variables */
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 72838de1e2..2a2eb080eb 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -469,7 +469,7 @@ static int configure_output_video_filter(FilterGraph *fg, 
OutputFilter *ofilter,
 if (ret < 0)
 return ret;
 
-if (ofilter->width || ofilter->height) {
+if ((ofilter->width || ofilter->height) && fg->autoscale) {
 char args[255];
 AVFilterContext *filter;
 AVDictionaryEntry *e = NULL;
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index f5ca18aa64..47f90c22aa 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -742,7 +742,9 @@ static void add_input_streams(OptionsContext *o, 
AVFormatContext *ic)
 MATCH_PER_STREAM_OPT(ts_scale, dbl, ist->ts_scale, ic, st);
 
 ist->autorotate = 1;
+ist->autoscale  = 1;
 MATCH_PER_STREAM_OPT(autorotate, i, ist->autorotate, ic, st);
+MATCH_PER_STREAM_OPT(autoscale, i, ist->autoscale, ic, st);
 
 MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, ic, st);
 if (codec_tag) {
@@ -3640,6 +3642,9 @@ const OptionDef options[] = {
 { "autorotate",   HAS_ARG | OPT_BOOL | OPT_SPEC |
   OPT_EXPERT | OPT_INPUT,  
  { .off = OFFSET(autorotate) },
 "automatically insert correct rotate filters" },
+{ "autoscale",HAS_ARG | OPT_BOOL | OPT_SPEC |
+  OPT_EXPERT | OPT_INPUT,  
  { .off = OFFSET(autoscale) },
+"automatically insert correct scale filters" },
 
 /* audio options */
 { "aframes",OPT_AUDIO | HAS_ARG  | OPT_PERFILE | OPT_OUTPUT,   
{ .func_arg = opt_audio_frames },
-- 
2.17.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".