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

Linjie Fu linjie.justin.fu at gmail.com
Thu Aug 27 16:12:17 EEST 2020


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);
 
-- 
2.28.0



More information about the ffmpeg-devel mailing list