[FFmpeg-devel] [PATCH] lavf/mux: allow unofficial extension by default for spatial data in mp4

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Fri Aug 28 03:39:42 EEST 2020


Linjie Fu:
> Mp4 unofficial extension allows Stereo3D and Spherical Mapping data
> in header if users explicitly set "-strict unofficial" or values less
> than "-1".
> 
> Currently side_data like stereo3D and spherical data in mp4 would be
> dropped by default in a transcoding procedure even if user uses streamcopy
> to get the same bitstreams. Spatial data missing in containers seems to
> cause troubles for the players like VLC while detecting the projection type
> for 360 video.
> 
> Set the default value of "strict" to "unofficial" for mp4.
> 
> Signed-off-by: Linjie Fu <linjie.justin.fu at gmail.com>
> ---
> I would prefer to add the default value for format-specific options in something
> like AVCodecDefault, however didn't find one.
>  libavformat/mux.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/libavformat/mux.c b/libavformat/mux.c
> index 44d5e5d1c0..ffb9109a6f 100644
> --- a/libavformat/mux.c
> +++ b/libavformat/mux.c
> @@ -237,6 +237,11 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options)
>      const AVCodecDescriptor *desc;
>      AVDictionaryEntry *e;
>  
> +    if (s->oformat) {
> +        if (!strcmp("mp4", s->oformat->name))
> +            s->strict_std_compliance = FF_COMPLIANCE_UNOFFICIAL;
> +    }
> +
>      if (options)
>          av_dict_copy(&tmp, *options, 0);
>  
1. s->oformat must already be set at this point.
2. You seem to believe that the only way for the user to set
strict_std_compliance etc. is by providing via the a dict provided to
avformat_init_output/write_header(). This is wrong. The user can also
set it before that. Your patch would break this.
Obviously you have no way to distinguish whether the user explicitly set
the option to FF_COMPLIANCE_NORMAL (and even less way to know whether
the user intentionally doesn't want unofficial extensions and therefore
opted to not touch strict_std_compliance).
3. One could print a warning in case the such unofficial extensions are
dropped.
3. How "unofficial" is this extension anyway? After all, the default
mode intentionally differs from FF_COMPLIANCE_STRICT.

- Andreas


More information about the ffmpeg-devel mailing list