Re: [FFmpeg-devel] [PATCH] fate/ffprobe: Verify ffprobe XML output against schema file

2021-07-13 Thread Tobias Rapp

On 30.06.2021 10:20, Tobias Rapp wrote:

On 16.04.2021 10:58, Tobias Rapp wrote:

Adds schema validation for ffprobe XML output so that updating the
ffprobe.xsd file upon changes to ffprobe is not forgotten. This was
suggested by Marton Balint in:
http://ffmpeg.org/pipermail/ffmpeg-devel/2021-March/278428.html

The schema FATE test is only run if xmllint command is available.

Signed-off-by: Tobias Rapp 
---
  configure  |  3 +++
  tests/fate/ffprobe.mak |  6 +
  tests/ref/fate/ffprobe_xsd | 57 
++

  3 files changed, 66 insertions(+)
  create mode 100644 tests/ref/fate/ffprobe_xsd

[...]

Would like to push this in a week or so, if there are no objections.


Patch applied.

Regards,
Tobias

___
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] ffmpeg: add option recast_media

2021-07-13 Thread Anton Khirnov
Quoting Gyan Doshi (2021-07-02 12:03:05)
> Allows forcing decoders of different media type.
> Needed to decode media data muxed as data streams.
> ---
>  doc/ffmpeg.texi  | 5 +
>  fftools/ffmpeg_opt.c | 7 ++-
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
> index 7827291755..c1065086e5 100644
> --- a/doc/ffmpeg.texi
> +++ b/doc/ffmpeg.texi
> @@ -449,6 +449,11 @@ output file already exists.
>  Set number of times input stream shall be looped. Loop 0 means no loop,
>  loop -1 means infinite loop.
>  
> +@item -recast_media (@emph{global})
> +Enable to allow forcing a decoder of a different media type than
> +the one detected or designated by the demuxer. Useful for decoding
> +media data muxed as data streams.
> +
>  @item -c[:@var{stream_specifier}] @var{codec} 
> (@emph{input/output,per-stream})
>  @itemx -codec[:@var{stream_specifier}] @var{codec} 
> (@emph{input/output,per-stream})
>  Select an encoder (when used before an output file) or a decoder (when used
> diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
> index a63bed54cf..76a220c21c 100644
> --- a/fftools/ffmpeg_opt.c
> +++ b/fftools/ffmpeg_opt.c
> @@ -186,6 +186,7 @@ static int input_sync;
>  static int input_stream_potentially_available = 0;
>  static int ignore_unknown_streams = 0;
>  static int copy_unknown_streams = 0;
> +static int recast_media = 0;
>  static int find_stream_info = 1;
>  
>  static void uninit_options(OptionsContext *o)
> @@ -759,7 +760,7 @@ static const AVCodec *find_codec_or_die(const char *name, 
> enum AVMediaType type,
>  av_log(NULL, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name);
>  exit_program(1);
>  }
> -if (codec->type != type) {
> +if (codec->type != type && !recast_media) {
>  av_log(NULL, AV_LOG_FATAL, "Invalid %s type '%s'\n", codec_string, 
> name);
>  exit_program(1);
>  }
> @@ -774,6 +775,8 @@ static const AVCodec *choose_decoder(OptionsContext *o, 
> AVFormatContext *s, AVSt
>  if (codec_name) {
>  const AVCodec *codec = find_codec_or_die(codec_name, 
> st->codecpar->codec_type, 0);
>  st->codecpar->codec_id = codec->id;
> +if (recast_media && st->codecpar->codec_type != codec->type)
> +st->codecpar->codec_type = codec->type;

The caller is not allowed to modify this struct for demuxing. This might
confuse demuxers that expect the values they put there to remain

-- 
Anton Khirnov
___
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] avfilter/vf_signature: Initialize all houghspace elements

2021-07-13 Thread Jai Luthra
Co-authored-by: Oscar 
---
The uninitialized score & dist values are used a few lines below this, leading 
to inconsistent mpeg7 matches.
Original PR here: https://github.com/livepeer/FFmpeg/pull/4

 libavfilter/signature_lookup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/signature_lookup.c b/libavfilter/signature_lookup.c
index 272c717c77..f1d378237a 100644
--- a/libavfilter/signature_lookup.c
+++ b/libavfilter/signature_lookup.c
@@ -200,7 +200,7 @@ static MatchingInfo* 
get_matching_parameters(AVFilterContext *ctx, SignatureCont
 /* initialize houghspace */
 for (i = 0; i < MAX_FRAMERATE; i++) {
 hspace[i] = av_malloc_array(2 * HOUGH_MAX_OFFSET + 1, 
sizeof(hspace_elem));
-for (j = 0; j < HOUGH_MAX_OFFSET; j++) {
+for (j = 0; j < 2 * HOUGH_MAX_OFFSET + 1; j++) {
 hspace[i][j].score = 0;
 hspace[i][j].dist = 9;
 }
-- 
2.32.0

___
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] avcodec/h264_parser: remove key frame tagging heuristics

2021-07-13 Thread Anton Khirnov
Quoting Kieran Kunhya (2021-07-13 04:44:40)
> On Tue, 13 Jul 2021, 02:45 James Almer,  wrote:
> 
> > On 7/12/2021 10:01 PM, Kieran Kunhya wrote:
> > >>
> > >> Because it isn't something that should be marked as a keyframe as coded
> > >> bitstream in any kind of container, like it's the case of mp4 sync
> > samples.
> > >>
> > >
> > > MPEG-TS Random Access Indicator expects keyframes to be signalled like
> > this.
> > > With intra-refresh and this code removed, there will be no random access
> > > points at all.
> >
> > If MPEG-TS wants to tag packets containing things other than IDR access
> > units as RAPs, then it should analyze the bitstream itself in order to
> > tag them itself as such in the output.
> > This parser as is is generating invalid output for other containers that
> > are strict about key frames, and signal recovery points (like those
> > indicated by the use of this SEI) by other means.
> >
> 
> Why not just detect IDR in containers that only care about that (which is a
> mistake because if things like open gop)? Doing that's is relatively simple
> compared to adding bitstream parsing into MPEGTS.

Seems we need a better definition of what "keyframe" means in our APIs.

-- 
Anton Khirnov
___
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] ffmpeg: add option recast_media

2021-07-13 Thread Gyan Doshi



On 2021-07-13 13:14, Anton Khirnov wrote:

Quoting Gyan Doshi (2021-07-02 12:03:05)

Allows forcing decoders of different media type.
Needed to decode media data muxed as data streams.
---
  doc/ffmpeg.texi  | 5 +
  fftools/ffmpeg_opt.c | 7 ++-
  2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 7827291755..c1065086e5 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -449,6 +449,11 @@ output file already exists.
  Set number of times input stream shall be looped. Loop 0 means no loop,
  loop -1 means infinite loop.
  
+@item -recast_media (@emph{global})

+Enable to allow forcing a decoder of a different media type than
+the one detected or designated by the demuxer. Useful for decoding
+media data muxed as data streams.
+
  @item -c[:@var{stream_specifier}] @var{codec} (@emph{input/output,per-stream})
  @itemx -codec[:@var{stream_specifier}] @var{codec} 
(@emph{input/output,per-stream})
  Select an encoder (when used before an output file) or a decoder (when used
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index a63bed54cf..76a220c21c 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -186,6 +186,7 @@ static int input_sync;
  static int input_stream_potentially_available = 0;
  static int ignore_unknown_streams = 0;
  static int copy_unknown_streams = 0;
+static int recast_media = 0;
  static int find_stream_info = 1;
  
  static void uninit_options(OptionsContext *o)

@@ -759,7 +760,7 @@ static const AVCodec *find_codec_or_die(const char *name, 
enum AVMediaType type,
  av_log(NULL, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name);
  exit_program(1);
  }
-if (codec->type != type) {
+if (codec->type != type && !recast_media) {
  av_log(NULL, AV_LOG_FATAL, "Invalid %s type '%s'\n", codec_string, 
name);
  exit_program(1);
  }
@@ -774,6 +775,8 @@ static const AVCodec *choose_decoder(OptionsContext *o, 
AVFormatContext *s, AVSt
  if (codec_name) {
  const AVCodec *codec = find_codec_or_die(codec_name, 
st->codecpar->codec_type, 0);
  st->codecpar->codec_id = codec->id;
+if (recast_media && st->codecpar->codec_type != codec->type)
+st->codecpar->codec_type = codec->type;

The caller is not allowed to modify this struct for demuxing. This might
confuse demuxers that expect the values they put there to remain


choose_decoder() is called from within add_input_streams().

Near the end of this parent function, we have

ret = avcodec_parameters_from_context(par, ist->dec_ctx);

where par is

    AVCodecParameters *par = st->codecpar;


avcodec_parameters_from_context(), starts with
{
    codec_parameters_reset(par);   -->  sets codec_type to 
AVMEDIA_TYPE_UNKNOWN


    par->codec_type = codec->codec_type;
    ...
}

So it's already being done. I did an immediate recast to avoid some 
temporary variables as the media type is used in a few switch blocks 
after the decoder is set.

But that way also works for me, if you insist.

Regards,
Gyan








___
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] Suggestion: Cache for seeking?

2021-07-13 Thread m...@gmx.net

When cutting a long video from the command-line using
ffmpeg, seeking takes minutes. Since one rarely gets the
cut-points 100% correct the first time, it does take minutes
every time you try again with adjusted values.

Can't ffmpeg simply keep a small cache (in tmp) providing it
with the entry points? Just take the filename, size and time
stamps. If the file is unchanged, the next seeking (for
cuts) to a similar region should only take a split-second.

There could be an option for this. If so, I suggest it
should be on by default.
___
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] Suggestion: Cache for seeking?

2021-07-13 Thread Gyan Doshi



This should be posted to the ffmpeg-user list.

When you do so, share the full command line you used as well as the full 
log without -hide_banner.


On 2021-07-13 15:28, m...@gmx.net wrote:

When cutting a long video from the command-line using
ffmpeg, seeking takes minutes. Since one rarely gets the
cut-points 100% correct the first time, it does take minutes
every time you try again with adjusted values.

Can't ffmpeg simply keep a small cache (in tmp) providing it
with the entry points? Just take the filename, size and time
stamps. If the file is unchanged, the next seeking (for
cuts) to a similar region should only take a split-second.

There could be an option for this. If so, I suggest it
should be on by default.


Regards,
Gyan
___
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] lavfi/vf_v360: add missing 0.5 subpixel shift

2021-07-13 Thread 黄宇星(凌怀)
Signed-off-by: 凌怀 
---
 libavfilter/vf_v360.c | 49 ++-
 1 file changed, 35 insertions(+), 14 deletions(-)

diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index 0c47883d4d..c0dafe6bbe 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -1790,8 +1790,8 @@ static int hequirect_to_xyz(const V360Context *s,
 int i, int j, int width, int height,
 float *vec)
 {
-const float phi   = ((2.f * i + 0.5f) / width  - 1.f) * M_PI_2;
-const float theta = ((2.f * j + 0.5f) / height - 1.f) * M_PI_2;
+const float phi   = ((2.f * i + 1.0f) / width  - 1.f) * M_PI_2;
+const float theta = ((2.f * j + 1.0f) / height - 1.f) * M_PI_2;
 const float sin_phi   = sinf(phi);
 const float cos_phi   = cosf(phi);
@@ -2158,8 +2158,8 @@ static int xyz_to_equirect(const V360Context *s,
 const float phi   = atan2f(vec[0], vec[2]);
 const float theta = asinf(vec[1]);
-const float uf = (phi   / s->iflat_range[0] + 1.f) * width  / 2.f;
-const float vf = (theta / s->iflat_range[1] + 1.f) * height / 2.f;
+const float uf = (phi   / s->iflat_range[0] + 1.f) * width  / 2.f - 0.5f;
+const float vf = (theta / s->iflat_range[1] + 1.f) * height / 2.f - 0.5f;
 const int ui = floorf(uf);
 const int vi = floorf(vf);
@@ -2866,7 +2866,7 @@ static int fisheye_to_xyz(const V360Context *s,
   int i, int j, int width, int height,
   float *vec)
 {
-const float uf = s->flat_range[0] * ((2.f * i) / width  - 1.f);
+const float uf = s->flat_range[0] * ((2.f * i + 1.f) / width  - 1.f);
 const float vf = s->flat_range[1] * ((2.f * j + 1.f) / height - 1.f);
 const float phi   = atan2f(vf, uf);
@@ -2932,6 +2932,9 @@ static int xyz_to_fisheye(const V360Context *s,
 uf = (uf + 0.5f) * width;
 vf = (vf + 0.5f) * height;
+uf -= 0.5f;
+vf -= 0.5f;
+
 ui = floorf(uf);
 vi = floorf(vf);
@@ -3007,8 +3010,8 @@ static int xyz_to_pannini(const V360Context *s,
 const float x = S * sinf(phi);
 const float y = S * tanf(theta);
-const float uf = (x + 1.f) * width  / 2.f;
-const float vf = (y + 1.f) * height / 2.f;
+const float uf = (x + 1.f) * width  / 2.f - 0.5f;
+const float vf = (y + 1.f) * height / 2.f - 0.5f;
 const int ui = floorf(uf);
 const int vi = floorf(vf);
@@ -3115,8 +3118,8 @@ static int xyz_to_cylindrical(const V360Context *s,
 const float phi   = atan2f(vec[0], vec[2]) / s->iflat_range[0];
 const float theta = asinf(vec[1]);
-const float uf = (phi + 1.f) * (width - 1) / 2.f;
-const float vf = (tanf(theta) / s->iflat_range[1] + 1.f) * height / 2.f;
+const float uf = (phi + 1.f) * (width - 1) / 2.f - 0.5f;
+const float vf = (tanf(theta) / s->iflat_range[1] + 1.f) * height / 2.f - 
0.5f;
 const int ui = floorf(uf);
 const int vi = floorf(vf);
@@ -3225,8 +3228,8 @@ static int xyz_to_cylindricalea(const V360Context *s,
 const float phi   = atan2f(vec[0], vec[2]) / s->iflat_range[0];
 const float theta = asinf(vec[1]);
-const float uf = (phi + 1.f) * (width - 1) / 2.f;
-const float vf = (sinf(theta) / s->iflat_range[1] + 1.f) * height / 2.f;
+const float uf = (phi + 1.f) * (width - 1) / 2.f - 0.5f;
+const float vf = (sinf(theta) / s->iflat_range[1] + 1.f) * height / 2.f - 
0.5f;
 const int ui = floorf(uf);
 const int vi = floorf(vf);
@@ -3361,6 +3364,9 @@ static int xyz_to_tetrahedron(const V360Context *s,
 uf *= width;
 vf *= height;
+uf -= 0.5f;
+vf -= 0.5f;
+
 ui = floorf(uf);
 vi = floorf(vf);
@@ -3397,7 +3403,7 @@ static int dfisheye_to_xyz(const V360Context *s,
 const int ei = i >= ew ? i - ew : i;
 const float m = i >= ew ? 1.f : -1.f;
-const float uf = s->flat_range[0] * ((2.f * ei) / ew - 1.f);
+const float uf = s->flat_range[0] * ((2.f * ei + 1.f) / ew - 1.f);
 const float vf = s->flat_range[1] * ((2.f * j + 1.f) / eh - 1.f);
 const float h = hypotf(uf, vf);
@@ -3452,6 +3458,9 @@ static int xyz_to_dfisheye(const V360Context *s,
 uf = ew - uf;
 }
+uf -= 0.5f;
+vf -= 0.5f;
+
 ui = floorf(uf);
 vi = floorf(vf);
@@ -3491,8 +3500,8 @@ static int barrel_to_xyz(const V360Context *s,
 const int ew = 4 * width / 5;
 const int eh = height;
-const float phi   = ((2.f * i) / ew - 1.f) * M_PI/ scale;
-const float theta = ((2.f * j) / eh - 1.f) * theta_range / scale;
+const float phi   = ((2.f * i + 1.f) / ew - 1.f) * M_PI/ scale;
+const float theta = ((2.f * j + 1.f) / eh - 1.f) * theta_range / scale;
 const float sin_phi   = sinf(phi);
 const float cos_phi   = cosf(phi);
@@ -3596,6 +3605,9 @@ static int xyz_to_barrel(const V360Context *s,
 vf = 0.5f * eh * (vf * scale + 1.f);
 }
+uf -= 0.5f;
+vf -= 0.5f;
+
 ui = floorf(uf);
 vi = floorf(v