diff --git a/Changelog b/Changelog
index 1efc768387..daae1cc485 100644
--- a/Changelog
+++ b/Changelog
@@ -14,7 +14,8 @@ version <next>:
 - ADPCM Argonaut Games encoder
 - Argonaut Games ASF muxer
 - AV1 Low overhead bitstream format demuxer
-
+- FLIF16 decoder
+- FLIF demuxer
 
 version 4.3:
 - v360 filter
diff --git a/configure b/configure
index d4a1fea9ce..a702997c71 100755
--- a/configure
+++ b/configure
@@ -253,11 +253,8 @@ External library support:
   --enable-libopenh264     enable H.264 encoding via OpenH264 [no]
   --enable-libopenjpeg     enable JPEG 2000 de/encoding via OpenJPEG [no]
   --enable-libopenmpt      enable decoding tracked files via libopenmpt [no]
-  --enable-libopenvino     enable OpenVINO as a DNN module backend
-                           for DNN based filters like dnn_processing [no]
   --enable-libopus         enable Opus de/encoding via libopus [no]
   --enable-libpulse        enable Pulseaudio input via libpulse [no]
-  --enable-librabbitmq     enable RabbitMQ library [no]
   --enable-librav1e        enable AV1 encoding via rav1e [no]
   --enable-librsvg         enable SVG rasterization via librsvg [no]
   --enable-librubberband   enable rubberband needed for rubberband filter [no]
@@ -269,7 +266,6 @@ External library support:
   --enable-libspeex        enable Speex de/encoding via libspeex [no]
   --enable-libsrt          enable Haivision SRT protocol via libsrt [no]
   --enable-libssh          enable SFTP protocol via libssh [no]
-  --enable-libsvtav1       enable AV1 encoding via SVT [no]
   --enable-libtensorflow   enable TensorFlow as a DNN module backend
                            for DNN based filters like sr [no]
   --enable-libtesseract    enable Tesseract, needed for ocr filter [no]
@@ -307,7 +303,6 @@ External library support:
   --enable-mbedtls         enable mbedTLS, needed for https support
                            if openssl, gnutls or libtls is not used [no]
   --enable-mediacodec      enable Android MediaCodec support [no]
-  --enable-mediafoundation enable encoding via MediaFoundation [auto]
   --enable-libmysofa       enable libmysofa, needed for sofalizer filter [no]
   --enable-openal          enable OpenAL 1.1 capture support [no]
   --enable-opencl          enable OpenCL processing [no]
@@ -1671,7 +1666,7 @@ COMPONENT_LIST="
 "
 
 EXAMPLE_LIST="
-    avio_list_dir_example
+    avio_dir_cmd_example
     avio_reading_example
     decode_audio_example
     decode_video_example
@@ -1708,7 +1703,6 @@ EXTERNAL_AUTODETECT_LIBRARY_LIST="
     libxcb_shape
     libxcb_xfixes
     lzma
-    mediafoundation
     schannel
     sdl2
     securetransport
@@ -1744,6 +1738,7 @@ EXTERNAL_LIBRARY_VERSION3_LIST="
     liblensfun
     libopencore_amrnb
     libopencore_amrwb
+    libvmaf
     libvo_amrwbenc
     mbedtls
     rkmpp
@@ -1792,10 +1787,8 @@ EXTERNAL_LIBRARY_LIST="
     libopenh264
     libopenjpeg
     libopenmpt
-    libopenvino
     libopus
     libpulse
-    librabbitmq
     librav1e
     librsvg
     librtmp
@@ -1806,13 +1799,11 @@ EXTERNAL_LIBRARY_LIST="
     libspeex
     libsrt
     libssh
-    libsvtav1
     libtensorflow
     libtesseract
     libtheora
     libtwolame
     libv4l2
-    libvmaf
     libvorbis
     libvpx
     libwavpack
@@ -2557,7 +2548,7 @@ mips64r6_deps="mips"
 mipsfpu_deps="mips"
 mipsdsp_deps="mips"
 mipsdspr2_deps="mips"
-mmi_deps_any="loongson2 loongson3"
+mmi_deps="mips"
 msa_deps="mipsfpu"
 msa2_deps="msa"
 
@@ -2626,7 +2617,7 @@ cbs_mpeg2_select="cbs"
 cbs_vp9_select="cbs"
 dct_select="rdft"
 dirac_parse_select="golomb"
-dnn_suggest="libtensorflow libopenvino"
+dnn_suggest="libtensorflow"
 error_resilience_select="me_cmp"
 faandct_deps="faan"
 faandct_select="fdctdsp"
@@ -2798,14 +2789,11 @@ msmpeg4v3_decoder_select="h263_decoder"
 msmpeg4v3_encoder_select="h263_encoder"
 mss2_decoder_select="mpegvideo qpeldsp vc1_decoder"
 mts2_decoder_select="mss34dsp"
-mv30_decoder_select="aandcttables blockdsp"
 mvha_decoder_deps="zlib"
-mvha_decoder_select="llviddsp"
 mwsc_decoder_deps="zlib"
 mxpeg_decoder_select="mjpeg_decoder"
 nellymoser_decoder_select="mdct sinewin"
 nellymoser_encoder_select="audio_frame_queue mdct sinewin"
-notchlc_decoder_select="lzf"
 nuv_decoder_select="idctdsp lzo"
 on2avc_decoder_select="mdct"
 opus_decoder_deps="swresample"
@@ -3020,8 +3008,6 @@ wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
 wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
 
 # hardware-accelerated codecs
-mediafoundation_deps="mftransform_h MFCreateAlignedMemoryBuffer"
-mediafoundation_extralibs="-lmfplat -lmfuuid -lole32 -lstrmiids"
 omx_deps="libdl pthreads"
 omx_rpi_select="omx"
 qsv_deps="libmfx"
@@ -3038,16 +3024,12 @@ scale_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
 thumbnail_cuda_filter_deps="ffnvcodec"
 thumbnail_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
 transpose_npp_filter_deps="ffnvcodec libnpp"
-overlay_cuda_filter_deps="ffnvcodec"
-overlay_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
 
 amf_deps_any="libdl LoadLibrary"
 nvenc_deps="ffnvcodec"
 nvenc_deps_any="libdl LoadLibrary"
 nvenc_encoder_deps="nvenc"
 
-aac_mf_encoder_deps="mediafoundation"
-ac3_mf_encoder_deps="mediafoundation"
 h263_v4l2m2m_decoder_deps="v4l2_m2m h263_v4l2_m2m"
 h263_v4l2m2m_encoder_deps="v4l2_m2m h263_v4l2_m2m"
 h264_amf_encoder_deps="amf"
@@ -3056,7 +3038,6 @@ h264_cuvid_decoder_deps="cuvid"
 h264_cuvid_decoder_select="h264_mp4toannexb_bsf"
 h264_mediacodec_decoder_deps="mediacodec"
 h264_mediacodec_decoder_select="h264_mp4toannexb_bsf h264_parser"
-h264_mf_encoder_deps="mediafoundation"
 h264_mmal_decoder_deps="mmal"
 h264_nvenc_encoder_deps="nvenc"
 h264_omx_encoder_deps="omx"
@@ -3073,7 +3054,6 @@ hevc_cuvid_decoder_deps="cuvid"
 hevc_cuvid_decoder_select="hevc_mp4toannexb_bsf"
 hevc_mediacodec_decoder_deps="mediacodec"
 hevc_mediacodec_decoder_select="hevc_mp4toannexb_bsf hevc_parser"
-hevc_mf_encoder_deps="mediafoundation"
 hevc_nvenc_encoder_deps="nvenc"
 hevc_qsv_decoder_select="hevc_mp4toannexb_bsf qsvdec"
 hevc_qsv_encoder_select="hevcparse qsvenc"
@@ -3090,7 +3070,6 @@ mjpeg_qsv_encoder_deps="libmfx"
 mjpeg_qsv_encoder_select="qsvenc"
 mjpeg_vaapi_encoder_deps="VAEncPictureParameterBufferJPEG"
 mjpeg_vaapi_encoder_select="cbs_jpeg jpegtables vaapi_encode"
-mp3_mf_encoder_deps="mediafoundation"
 mpeg1_cuvid_decoder_deps="cuvid"
 mpeg1_v4l2m2m_decoder_deps="v4l2_m2m mpeg1_v4l2_m2m"
 mpeg2_crystalhd_decoder_select="crystalhd"
@@ -3246,7 +3225,6 @@ libshine_encoder_select="audio_frame_queue"
 libspeex_decoder_deps="libspeex"
 libspeex_encoder_deps="libspeex"
 libspeex_encoder_select="audio_frame_queue"
-libsvtav1_encoder_deps="libsvtav1"
 libtheora_encoder_deps="libtheora"
 libtwolame_encoder_deps="libtwolame"
 libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
@@ -3300,6 +3278,7 @@ eac3_demuxer_select="ac3_parser"
 f4v_muxer_select="mov_muxer"
 fifo_muxer_deps="threads"
 flac_demuxer_select="flac_parser"
+flif_demuxer_select="zlib exif"
 flv_muxer_select="aac_adtstoasc_bsf"
 gxf_muxer_select="pcm_rechunk_bsf"
 hds_muxer_select="flv_muxer"
@@ -3310,23 +3289,21 @@ image2_brender_pix_demuxer_select="image2_demuxer"
 ipod_muxer_select="mov_muxer"
 ismv_muxer_select="mov_muxer"
 ivf_muxer_select="av1_metadata_bsf vp9_superframe_bsf"
-latm_muxer_select="aac_adtstoasc_bsf"
 matroska_audio_muxer_select="matroska_muxer"
 matroska_demuxer_select="iso_media riffdec"
 matroska_demuxer_suggest="bzlib lzo zlib"
-matroska_muxer_select="iso_media riffenc vp9_superframe_bsf aac_adtstoasc_bsf"
-mlp_demuxer_select="mlp_parser"
+matroska_muxer_select="iso_media riffenc"
 mmf_muxer_select="riffenc"
 mov_demuxer_select="iso_media riffdec"
 mov_demuxer_suggest="zlib"
-mov_muxer_select="iso_media riffenc rtpenc_chain vp9_superframe_bsf aac_adtstoasc_bsf"
+mov_muxer_select="iso_media riffenc rtpenc_chain"
 mp3_demuxer_select="mpegaudio_parser"
 mp3_muxer_select="mpegaudioheader"
 mp4_muxer_select="mov_muxer"
 mpegts_demuxer_select="iso_media"
-mpegts_muxer_select="adts_muxer latm_muxer h264_mp4toannexb_bsf hevc_mp4toannexb_bsf"
+mpegts_muxer_select="adts_muxer latm_muxer"
 mpegtsraw_demuxer_select="mpegts_demuxer"
-mxf_muxer_select="golomb pcm_rechunk_bsf"
+mxf_muxer_select="golomb"
 mxf_d10_muxer_select="mxf_muxer"
 mxf_opatom_muxer_select="mxf_muxer"
 nut_muxer_select="riffenc"
@@ -3351,7 +3328,6 @@ spdif_muxer_select="adts_header"
 spx_muxer_select="ogg_muxer"
 swf_demuxer_suggest="zlib"
 tak_demuxer_select="tak_parser"
-truehd_demuxer_select="mlp_parser"
 tg2_muxer_select="mov_muxer"
 tgp_muxer_select="mov_muxer"
 vobsub_demuxer_select="mpegps_demuxer"
@@ -3359,7 +3335,6 @@ w64_demuxer_select="wav_demuxer"
 w64_muxer_select="wav_muxer"
 wav_demuxer_select="riffdec"
 wav_muxer_select="riffenc"
-webm_chunk_muxer_select="webm_muxer"
 webm_muxer_select="iso_media riffenc"
 webm_dash_manifest_demuxer_select="matroska_demuxer"
 wtv_demuxer_select="mpegts_demuxer riffdec"
@@ -3375,8 +3350,6 @@ alsa_outdev_deps="alsa"
 avfoundation_indev_deps="avfoundation corevideo coremedia pthreads"
 avfoundation_indev_suggest="coregraphics applicationservices"
 avfoundation_indev_extralibs="-framework Foundation"
-audiotoolbox_outdev_deps="audiotoolbox pthreads"
-audiotoolbox_outdev_extralibs="-framework AudioToolbox -framework CoreAudio"
 bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
 caca_outdev_deps="libcaca"
 decklink_deps_any="libdl LoadLibrary"
@@ -3466,8 +3439,6 @@ unix_protocol_deps="sys_un_h"
 unix_protocol_select="network"
 
 # external library protocols
-libamqp_protocol_deps="librabbitmq"
-libamqp_protocol_select="network"
 librtmp_protocol_deps="librtmp"
 librtmpe_protocol_deps="librtmp"
 librtmps_protocol_deps="librtmp"
@@ -3525,7 +3496,6 @@ derain_filter_select="dnn"
 deshake_filter_select="pixelutils"
 deshake_opencl_filter_deps="opencl"
 dilation_opencl_filter_deps="opencl"
-dnn_processing_filter_deps="swscale"
 dnn_processing_filter_select="dnn"
 drawtext_filter_deps="libfreetype"
 drawtext_filter_suggest="libfontconfig libfribidi"
@@ -3589,7 +3559,6 @@ sab_filter_deps="gpl swscale"
 scale2ref_filter_deps="swscale"
 scale_filter_deps="swscale"
 scale_qsv_filter_deps="libmfx"
-scdet_filter_select="scene_sad"
 select_filter_select="scene_sad"
 sharpness_vaapi_filter_deps="vaapi"
 showcqt_filter_deps="avcodec avformat swscale"
@@ -3646,7 +3615,7 @@ yadif_cuda_filter_deps="ffnvcodec"
 yadif_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
 
 # examples
-avio_list_dir_deps="avformat avutil"
+avio_dir_cmd_deps="avformat avutil"
 avio_reading_deps="avformat avcodec avutil"
 decode_audio_example_deps="avcodec avutil"
 decode_video_example_deps="avcodec avutil"
@@ -4451,7 +4420,7 @@ msvc_common_flags(){
             # generic catch all at the bottom will print the original flag.
             -Wall)                ;;
             -Wextra)              ;;
-            -std=c*)              ;;
+            -std=c99)             ;;
             # Common flags
             -fomit-frame-pointer) ;;
             -g)                   echo -Z7 ;;
@@ -4467,7 +4436,6 @@ msvc_common_flags(){
             -l*)                  echo ${flag#-l}.lib ;;
             -LARGEADDRESSAWARE)   echo $flag ;;
             -L*)                  echo -libpath:${flag#-L} ;;
-            -Wl,*)                ;;
             *)                    echo $flag ;;
         esac
     done
@@ -4695,11 +4663,7 @@ probe_cc(){
         _ld_path='-libpath:'
     elif $_cc -nologo- 2>&1 | grep -q Microsoft || { $_cc -v 2>&1 | grep -q clang && $_cc -? > /dev/null 2>&1; }; then
         _type=msvc
-        if $_cc -nologo- 2>&1 | grep -q Microsoft; then
-            _ident=$($_cc 2>&1 | head -n1 | tr -d '\r')
-        else
-            _ident=$($_cc --version 2>/dev/null | head -n1 | tr -d '\r')
-        fi
+        _ident=$($_cc 2>&1 | head -n1 | tr -d '\r')
         _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
         _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
         _cflags_speed="-O2"
@@ -4827,7 +4791,7 @@ fi
 
 if test "$cpu" = host; then
     enabled cross_compile &&
-        warn "--cpu=host makes no sense when cross-compiling."
+        die "--cpu=host makes no sense when cross-compiling."
 
     case "$cc_type" in
         gcc|llvm_gcc)
@@ -5010,6 +4974,8 @@ elif enabled bfin; then
 
 elif enabled mips; then
 
+    cpuflags="-march=$cpu"
+
     if [ "$cpu" != "generic" ]; then
         disable mips32r2
         disable mips32r5
@@ -5018,61 +4984,19 @@ elif enabled mips; then
         disable mips64r6
         disable loongson2
         disable loongson3
-        disable mipsdsp
-        disable mipsdspr2
-        disable msa
-        disable mmi
-
-        cpuflags="-march=$cpu"
 
         case $cpu in
-            # General ISA levels
-            mips1|mips3)
-            ;;
-            mips32r2)
-                enable msa
+            24kc|24kf*|24kec|34kc|1004kc|24kef*|34kf*|1004kf*|74kc|74kf)
                 enable mips32r2
+                disable msa
             ;;
-            mips32r5)
-                enable msa
-                enable mips32r2
-                enable mips32r5
+            p5600|i6400|p6600)
+                disable mipsdsp
+                disable mipsdspr2
             ;;
-            mips64r2|mips64r5)
-                enable msa
-                enable mmi
-                enable mips64r2
+            loongson*)
+                enable loongson2
                 enable loongson3
-            ;;
-            # Cores from MIPS(MTI)
-            24kc)
-                disable mipsfpu
-                enable mips32r2
-            ;;
-            24kf*|24kec|34kc|74Kc|1004kc)
-                enable mips32r2
-            ;;
-            24kef*|34kf*|1004kf*)
-                enable mipsdsp
-                enable mips32r2
-            ;;
-            p5600)
-                enable msa
-                enable mips32r2
-                enable mips32r5
-                check_cflags "-mtune=p5600" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops"
-            ;;
-            i6400)
-                enable mips64r6
-                check_cflags "-mtune=i6400 -mabi=64" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
-            ;;
-            p6600)
-                enable mips64r6
-                check_cflags "-mtune=p6600 -mabi=64" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
-            ;;
-            # Cores from Loongson
-            loongson2e|loongson2f|loongson3*)
-                enable mmi
                 enable local_aligned
                 enable simd_align_16
                 enable fast_64bit
@@ -5080,43 +5004,75 @@ elif enabled mips; then
                 enable fast_cmov
                 enable fast_unaligned
                 disable aligned_stack
+                disable mipsdsp
+                disable mipsdspr2
                 # When gcc version less than 5.3.0, add -fno-expensive-optimizations flag.
-                if test "$cc_type" = "gcc"; then
-                    case $gcc_basever in
-                        2|2.*|3.*|4.*|5.0|5.1|5.2)
-                        expensive_optimization_flag="-fno-expensive-optimizations"
-                        ;;
-                        *)
+                if [ $cc == gcc ]; then
+                    gcc_version=$(gcc -dumpversion)
+                    if [ "$(echo "$gcc_version 5.3.0" | tr " " "\n" | sort -rV | head -n 1)" == "$gcc_version" ]; then
                         expensive_optimization_flag=""
-                        ;;
-                    esac
+                    else
+                        expensive_optimization_flag="-fno-expensive-optimizations"
+                    fi
                 fi
-
                 case $cpu in
                     loongson3*)
-                        enable loongson3
-                        enable msa
                         cpuflags="-march=loongson3a -mhard-float $expensive_optimization_flag"
                     ;;
                     loongson2e)
-                        enable loongson2
                         cpuflags="-march=loongson2e -mhard-float $expensive_optimization_flag"
                     ;;
                     loongson2f)
-                        enable loongson2
                         cpuflags="-march=loongson2f -mhard-float $expensive_optimization_flag"
                     ;;
                 esac
             ;;
             *)
-                warn "unknown MIPS CPU"
+                # Unknown CPU. Disable everything.
+                warn "unknown CPU. Disabling all MIPS optimizations."
+                disable mipsfpu
+                disable mipsdsp
+                disable mipsdspr2
+                disable msa
+                disable mmi
             ;;
         esac
 
+        case $cpu in
+            24kc)
+                disable mipsfpu
+                disable mipsdsp
+                disable mipsdspr2
+            ;;
+            24kf*)
+                disable mipsdsp
+                disable mipsdspr2
+            ;;
+            24kec|34kc|1004kc)
+                disable mipsfpu
+                disable mipsdspr2
+            ;;
+            24kef*|34kf*|1004kf*)
+                disable mipsdspr2
+            ;;
+            74kc)
+                disable mipsfpu
+            ;;
+            p5600)
+                enable mips32r5
+                check_cflags "-mtune=p5600" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops"
+            ;;
+            i6400)
+                enable mips64r6
+                check_cflags "-mtune=i6400 -mabi=64" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
+            ;;
+            p6600)
+                enable mips64r6
+                check_cflags "-mtune=p6600 -mabi=64" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
+            ;;
+        esac
     else
-        disable mipsdsp
-        disable mipsdspr2
-        # Disable DSP stuff for generic CPU, it can't be detected at runtime.
+        # We do not disable anything. Is up to the user to disable the unwanted features.
         warn 'generic cpu selected'
     fi
 
@@ -5393,11 +5349,6 @@ case $target_os in
         fi
         version_script='-exported_symbols_list'
         VERSION_SCRIPT_POSTPROCESS_CMD='tr " " "\n" | sed -n /global:/,/local:/p | grep ";" | tr ";" "\n" | sed -E "s/(.+)/_\1/g" | sed -E "s/(.+[^*])$$$$/\1*/"'
-        # Workaround for Xcode 11 -fstack-check bug
-        if enabled clang; then
-            clang_version=$($cc -dumpversion)
-            test ${clang_version%%.*} -eq 11 && add_cflags -fno-stack-check
-        fi
         ;;
     msys*)
         die "Native MSYS builds are discouraged, please use the MINGW environment."
@@ -5863,42 +5814,28 @@ EOF
 
 elif enabled mips; then
 
-    # Check toolchain ISA level
-    if enabled mips64; then
-        enabled mips64r6 && check_inline_asm mips64r6 '"dlsa $0, $0, $0, 1"' &&
-            disable mips64r2
-
-        enabled mips64r2 && check_inline_asm mips64r2 '"dext $0, $0, 0, 1"'
+    enabled loongson2 && check_inline_asm loongson2 '"dmult.g $8, $9, $10"'
+    enabled loongson3 && check_inline_asm loongson3 '"gsldxc1 $f0, 0($2, $3)"'
+    enabled mmi && check_inline_asm mmi '"punpcklhw $f0, $f0, $f0"'
 
-        disable mips32r6 && disable mips32r5 && disable mips32r2
+    # Enable minimum ISA based on selected options
+    if enabled mips64; then
+        enabled mips64r6 && check_inline_asm_flags mips64r6 '"dlsa $0, $0, $0, 1"' '-mips64r6'
+        enabled mips64r2 && check_inline_asm_flags mips64r2 '"dext $0, $0, 0, 1"' '-mips64r2'
+        disabled mips64r6 && disabled mips64r2 && check_inline_asm_flags mips64r1 '"daddi $0, $0, 0"' '-mips64'
     else
-        enabled mips32r6 && check_inline_asm mips32r6 '"aui $0, $0, 0"' &&
-            disable mips32r5 && disable mips32r2
-
-        enabled mips32r5 && check_inline_asm mips32r5 '"eretnc"'
-        enabled mips32r2 && check_inline_asm mips32r2 '"ext $0, $0, 0, 1"'
-
-        disable mips64r6 && disable mips64r5 && disable mips64r2
+        enabled mips32r6 && check_inline_asm_flags mips32r6 '"aui $0, $0, 0"' '-mips32r6'
+        enabled mips32r5 && check_inline_asm_flags mips32r5 '"eretnc"' '-mips32r5'
+        enabled mips32r2 && check_inline_asm_flags mips32r2 '"ext $0, $0, 0, 1"' '-mips32r2'
+        disabled mips32r6 && disabled mips32r5 && disabled mips32r2 && check_inline_asm_flags mips32r1 '"addi $0, $0, 0"' '-mips32'
     fi
 
-    enabled mipsfpu && check_inline_asm mipsfpu '"cvt.d.l $f0, $f2"'
+    enabled mipsfpu && check_inline_asm_flags mipsfpu '"cvt.d.l $f0, $f2"' '-mhard-float'
     enabled mipsfpu && (enabled mips32r5 || enabled mips32r6 || enabled mips64r6) && check_inline_asm_flags mipsfpu '"cvt.d.l $f0, $f1"' '-mfp64'
-
+    enabled mipsfpu && enabled msa && check_inline_asm_flags msa '"addvi.b $w0, $w1, 1"' '-mmsa' && check_headers msa.h || disable msa
     enabled mipsdsp && check_inline_asm_flags mipsdsp '"addu.qb $t0, $t1, $t2"' '-mdsp'
     enabled mipsdspr2 && check_inline_asm_flags mipsdspr2 '"absq_s.qb $t0, $t1"' '-mdspr2'
-
-    # MSA and MSA2 can be detected at runtime so we supply extra flags here
-    enabled mipsfpu && enabled msa && check_inline_asm msa '"addvi.b $w0, $w1, 1"' '-mmsa' && append MSAFLAGS '-mmsa'
-    enabled msa && enabled msa2 && check_inline_asm msa2 '"nxbits.any.b $w0, $w0"' '-mmsa2' && append MSAFLAGS '-mmsa2'
-
-    # loongson2 have no switch cflag so we can only probe toolchain ability
-    enabled loongson2 && check_inline_asm loongson2 '"dmult.g $8, $9, $10"' && disable loongson3
-
-    # loongson3 is paired with MMI
-    enabled loongson3 && check_inline_asm loongson3 '"gsldxc1 $f0, 0($2, $3)"' '-mloongson-ext' && append MMIFLAGS '-mloongson-ext'
-
-    # MMI can be detected at runtime too
-    enabled mmi && check_inline_asm mmi '"punpcklhw $f0, $f0, $f0"' '-mloongson-mmi' && append MMIFLAGS '-mloongson-mmi'
+    enabled msa && enabled msa2 && check_inline_asm_flags msa2 '"nxbits.any.b $w0, $w0"' '-mmsa2' && check_headers msa2.h || disable msa2
 
     if enabled bigendian && enabled msa; then
         disable msa
@@ -6143,7 +6080,6 @@ check_headers io.h
 check_headers linux/perf_event.h
 check_headers libcrystalhd/libcrystalhd_if.h
 check_headers malloc.h
-check_headers mftransform.h
 check_headers net/udplite.h
 check_headers poll.h
 check_headers sys/param.h
@@ -6184,7 +6120,6 @@ enabled videotoolbox && check_apple_framework VideoToolbox
 check_apple_framework CoreFoundation
 check_apple_framework CoreMedia
 check_apple_framework CoreVideo
-check_apple_framework CoreAudio
 
 enabled avfoundation && {
     disable coregraphics applicationservices
@@ -6207,7 +6142,6 @@ check_type "windows.h dxva.h" "DXVA_PicParams_VP9" -DWINAPI_FAMILY=WINAPI_FAMILY
 check_type "windows.h d3d11.h" "ID3D11VideoDecoder"
 check_type "windows.h d3d11.h" "ID3D11VideoContext"
 check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602
-check_func_headers mfapi.h MFCreateAlignedMemoryBuffer -lmfplat
 
 check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC"
 check_type "vdpau/vdpau.h" "VdpPictureInfoVP9"
@@ -6304,11 +6238,10 @@ for func in $COMPLEX_FUNCS; do
 done
 
 # these are off by default, so fail if requested and not available
-enabled avisynth          && require_headers "avisynth/avisynth_c.h"
 enabled cuda_nvcc         && { check_nvcc cuda_nvcc || die "ERROR: failed checking for nvcc."; }
 enabled chromaprint       && require chromaprint chromaprint.h chromaprint_get_version -lchromaprint
 enabled decklink          && { require_headers DeckLinkAPI.h &&
-                               { test_cpp_condition DeckLinkAPIVersion.h "BLACKMAGIC_DECKLINK_API_VERSION >= 0x0a0a0000" || die "ERROR: Decklink API version must be >= 10.10"; } }
+                               { test_cpp_condition DeckLinkAPIVersion.h "BLACKMAGIC_DECKLINK_API_VERSION >= 0x0a090500" || die "ERROR: Decklink API version must be >= 10.9.5."; } }
 enabled frei0r            && require_headers "frei0r.h dlfcn.h"
 enabled gmp               && require gmp gmp.h mpz_export -lgmp
 enabled gnutls            && require_pkg_config gnutls gnutls gnutls/gnutls.h gnutls_global_init
@@ -6380,7 +6313,6 @@ enabled libopenh264       && require_pkg_config libopenh264 openh264 wels/codec_
 enabled libopenjpeg       && { check_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version ||
                                { require_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } }
 enabled libopenmpt        && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++"
-enabled libopenvino       && require libopenvino c_api/ie_c_api.h ie_c_api_version -linference_engine_c_api
 enabled libopus           && {
     enabled libopus_decoder && {
         require_pkg_config libopus opus opus_multistream.h opus_multistream_decoder_create
@@ -6390,7 +6322,6 @@ enabled libopus           && {
     }
 }
 enabled libpulse          && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new
-enabled librabbitmq       && require_pkg_config librabbitmq "librabbitmq >= 0.7.1" amqp.h amqp_new_connection
 enabled librav1e          && require_pkg_config librav1e "rav1e >= 0.1.0" rav1e.h rav1e_context_new
 enabled librsvg           && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo
 enabled librtmp           && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket
@@ -6403,7 +6334,6 @@ enabled libsoxr           && require libsoxr soxr.h soxr_create -lsoxr
 enabled libssh            && require_pkg_config libssh libssh libssh/sftp.h sftp_init
 enabled libspeex          && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
 enabled libsrt            && require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket
-enabled libsvtav1         && require_pkg_config libsvtav1 "SvtAv1Enc >= 0.8.4" EbSvtAv1Enc.h svt_av1_enc_init_handle
 enabled libtensorflow     && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow
 enabled libtesseract      && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate
 enabled libtheora         && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
@@ -6413,7 +6343,7 @@ enabled libtwolame        && require libtwolame twolame.h twolame_init -ltwolame
                                die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; }
 enabled libv4l2           && require_pkg_config libv4l2 libv4l2 libv4l2.h v4l2_ioctl
 enabled libvidstab        && require_pkg_config libvidstab "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit
-enabled libvmaf           && require_pkg_config libvmaf "libvmaf >= 1.5.2" libvmaf.h compute_vmaf
+enabled libvmaf           && require_pkg_config libvmaf "libvmaf >= 1.3.9" libvmaf.h compute_vmaf
 enabled libvo_amrwbenc    && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
 enabled libvorbis         && require_pkg_config libvorbis vorbis vorbis/codec.h vorbis_info_init &&
                              require_pkg_config libvorbisenc vorbisenc vorbis/vorbisenc.h vorbis_encode_init
@@ -6729,7 +6659,7 @@ if enabled x86; then
             disable ffnvcodec cuvid nvdec nvenc
             ;;
     esac
-elif enabled_any aarch64 ppc64 && ! enabled bigendian; then
+elif enabled ppc64 && ! enabled bigendian; then
     case $target_os in
         linux)
             ;;
@@ -7478,8 +7408,6 @@ LDSOFLAGS=$LDSOFLAGS
 SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
 ASMSTRIPFLAGS=$ASMSTRIPFLAGS
 X86ASMFLAGS=$X86ASMFLAGS
-MSAFLAGS=$MSAFLAGS
-MMIFLAGS=$MMIFLAGS
 BUILDSUF=$build_suffix
 PROGSSUF=$progs_suffix
 FULLNAME=$FULLNAME
diff --git a/doc/general.texi b/doc/general.texi
index 4fcc497244..1144538dcd 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -904,6 +904,8 @@ following image formats are supported:
 @item Flash Screen Video v2  @tab  X  @tab  X
 @item Flash Video (FLV)      @tab  X  @tab  X
     @tab Sorenson H.263 used in Flash
+@item FLIF (Free Lossless Image Format @tab     @tab  X
+    @tab Precursor to JPEG XL and FUIF
 @item FM Screen Capture Codec  @tab     @tab  X
 @item Forward Uncompressed   @tab     @tab  X
 @item Fraps                  @tab     @tab  X
diff --git a/libavformat/Makefile b/libavformat/Makefile
index cbb33fe37c..73cd23221c 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -192,6 +192,7 @@ OBJS-$(CONFIG_FLAC_DEMUXER)              += flacdec.o rawdec.o \
 OBJS-$(CONFIG_FLAC_MUXER)                += flacenc.o flacenc_header.o \
                                             vorbiscomment.o
 OBJS-$(CONFIG_FLIC_DEMUXER)              += flic.o
+OBJS-$(CONFIG_FLIF_DEMUXER)            += flifdec.o
 OBJS-$(CONFIG_FLV_DEMUXER)               += flvdec.o
 OBJS-$(CONFIG_LIVE_FLV_DEMUXER)          += flvdec.o
 OBJS-$(CONFIG_FLV_MUXER)                 += flvenc.o avc.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 0aa9dd7198..d003889b6f 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -150,6 +150,7 @@ extern AVOutputFormat ff_fits_muxer;
 extern AVInputFormat  ff_flac_demuxer;
 extern AVOutputFormat ff_flac_muxer;
 extern AVInputFormat  ff_flic_demuxer;
+extern AVInputFormat  ff_flif_demuxer;
 extern AVInputFormat  ff_flv_demuxer;
 extern AVOutputFormat ff_flv_muxer;
 extern AVInputFormat  ff_live_flv_demuxer;
diff --git a/libavformat/flifdec.c b/libavformat/flifdec.c
new file mode 100644
index 0000000000..1fccca5373
--- /dev/null
+++ b/libavformat/flifdec.c
@@ -0,0 +1,431 @@
+/*
+ * FLIF16 demuxer
+ * Copyright (c) 2020 Anamitra Ghorui <aghorui@teknik.io>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * FLIF demuxer.
+ */
+
+#include "avformat.h"
+#include "libavutil/common.h"
+#include "libavutil/bprint.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/opt.h"
+#include "internal.h"
+#include "libavcodec/exif.h"
+
+#include "libavcodec/flif16.h"
+#include "libavcodec/flif16_rangecoder.h"
+
+#include "config.h"
+
+#if CONFIG_ZLIB
+#include <zlib.h>
+#endif
+
+/*
+ * FLIF's reference encoder currently encodes metadata as a raw DEFLATE stream
+ * (RFC 1951). In order to decode a raw deflate stream using Zlib, inflateInit2
+ * must be used with windowBits being between -8 .. -15.
+ */
+#define ZLIB_WINDOW_BITS -15
+#define BUF_SIZE 4096
+
+typedef struct FLIFDemuxContext {
+#if CONFIG_ZLIB
+    z_stream stream;
+    uint8_t active;
+#endif
+} FLIFDemuxContext;
+
+
+#if CONFIG_ZLIB
+static int flif_inflate(FLIFDemuxContext *s, uint8_t *buf, int buf_size,
+                        uint8_t **out_buf, int *out_buf_size)
+{
+    int ret;
+    z_stream *stream = &s->stream;
+
+    if (!s->active) {
+        s->active = 1;
+        stream->zalloc   = Z_NULL;
+        stream->zfree    = Z_NULL;
+        stream->opaque   = Z_NULL;
+        stream->avail_in = 0;
+        stream->next_in  = Z_NULL;
+        ret = inflateInit2(stream, ZLIB_WINDOW_BITS);
+
+        if (ret != Z_OK)
+            return ret;
+
+        *out_buf_size = buf_size;
+        *out_buf = av_realloc_f(*out_buf, *out_buf_size, 1);
+        if (!*out_buf)
+            return AVERROR(ENOMEM);
+    }
+
+    stream->next_in  = buf;
+    stream->avail_in = buf_size;
+
+    do {
+        while (stream->total_out >= (*out_buf_size - 1)) {
+            *out_buf = av_realloc_f(*out_buf, (*out_buf_size) * 2, 1);
+            if (!*out_buf)
+                return AVERROR(ENOMEM);
+            *out_buf_size *= 2;
+        }
+
+        stream->next_out  = *out_buf + stream->total_out;
+        stream->avail_out = *out_buf_size - stream->total_out - 1;
+     
+        ret = inflate(stream, Z_PARTIAL_FLUSH);
+
+        switch (ret) {
+        case Z_NEED_DICT:
+        case Z_DATA_ERROR:
+            (void)inflateEnd(stream);
+            return AVERROR_INVALIDDATA;
+        case Z_MEM_ERROR:
+            (void)inflateEnd(stream);
+            return AVERROR(ENOMEM);
+        }
+    } while (stream->avail_in > 0);
+
+    if (ret == Z_STREAM_END) {
+        s->active = 0;
+        (*out_buf)[stream->total_out] = '\0';
+        (void) inflateEnd(stream);
+    } else
+        ret = AVERROR(EAGAIN);
+
+    return ret; // Return Z_BUF_ERROR/EAGAIN as long as input is incomplete.
+}
+#endif
+
+#if CONFIG_EXIF
+static int flif_read_exif(void *logctx, uint8_t *buf, int buf_size, AVDictionary **d)
+{
+    uint8_t le;
+    uint32_t temp;
+    int ret;
+    GetByteContext gb;
+
+    // Read exif header
+    if (memcmp("Exif", buf, 4))
+        return AVERROR_INVALIDDATA;
+
+    buf += 6;
+
+    // Figure out endianness
+    if (buf[0] == 'M' && buf[1] == 'M')
+        le = 0;
+    else if (buf[0] == 'I' && buf[1] == 'I')
+        le = 1;
+    else
+        return AVERROR_INVALIDDATA;
+
+    buf += 2;
+
+    bytestream2_init(&gb, buf, buf_size - 8);
+    temp = ff_tget_short(&gb, le);
+
+    // Check TIFF marker
+    if (temp != 0x002A)
+        return AVERROR_INVALIDDATA;
+
+    buf += 2;
+
+    if (le)
+        temp = bytestream2_get_le32(&gb);
+    else
+        temp = bytestream2_get_be32(&gb);
+
+    // Subtract read bytes, then skip
+    bytestream2_skip(&gb, temp - 8);
+
+    ret = ff_exif_decode_ifd(logctx, &gb, le, 0, d);
+    
+    return ret;
+}
+#endif
+
+static int flif16_probe(const AVProbeData *p)
+{
+    uint32_t vlist[3] = {0};
+    unsigned int count = 0, pos = 0;
+
+    // Magic Number
+    if (memcmp(p->buf, flif16_header, 4)) {
+        return 0;
+    }
+
+    for(int i = 0; i < 2 + (((p->buf[4] >> 4) > 4) ? 1 : 0); i++) {
+        while (p->buf[5 + pos] > 127) {
+            if (!(count--)) {
+                return 0;
+            }
+            VARINT_APPEND(vlist[i], p->buf[5 + pos]);
+            ++pos;
+        }
+        VARINT_APPEND(vlist[i], p->buf[5 + pos]);
+        count = 0;
+    }
+
+    if (!((vlist[0] + 1) && (vlist[1] + 1)))
+        return 0;
+
+    if (((p->buf[4] >> 4) > 4) && !(vlist[2] + 2))
+        return 0;
+
+    return AVPROBE_SCORE_MAX;
+}
+
+static int flif16_read_header(AVFormatContext *s)
+{
+    FLIFDemuxContext *dc = s->priv_data;
+    GetByteContext gb;
+    FLIF16RangeCoder rc = (FLIF16RangeCoder) {0};
+
+    AVIOContext     *pb  = s->pb;
+    AVStream        *st;
+
+    int64_t duration = 0;
+    uint32_t vlist[3] = {0};
+    uint32_t flag, animated, temp;
+    uint32_t bpc = 0;
+    uint32_t metadata_size = 0;
+    int out_buf_size = 0;
+    int buf_size = 0;
+    unsigned int count = 4;
+    int ret;
+    int format;
+    int segment = 0, i = 0;
+    uint8_t tag[5] = {0};
+    uint8_t buf[BUF_SIZE];
+    uint8_t *out_buf = NULL;
+    uint8_t loops = 0;
+    uint8_t num_planes;
+    uint8_t num_frames;
+
+#if !CONFIG_ZLIB
+    av_log(s, AV_LOG_WARNING, "ffmpeg has not been compiled with Zlib. Metadata may not be decoded.\n");
+#endif
+
+    // Magic Number
+    if (avio_rl32(pb) != (*((uint32_t *) flif16_header))) {
+        av_log(s, AV_LOG_ERROR, "bad magic number\n");
+        return AVERROR_INVALIDDATA;
+    }
+
+    st = avformat_new_stream(s, NULL);
+    if (!st)
+        return AVERROR(ENOMEM);
+    flag = avio_r8(pb);
+    animated = (flag >> 4) > 4;
+    duration = !animated;
+    bpc = avio_r8(pb); // Bytes per channel
+
+    num_planes = flag & 0x0F;
+
+    for (int i = 0; i < (2 + animated); i++) {
+        while ((temp = avio_r8(pb)) > 127) {
+            if (!(count--))
+                return AVERROR_INVALIDDATA;
+            VARINT_APPEND(vlist[i], temp);
+        }
+        VARINT_APPEND(vlist[i], temp);
+        count = 4;
+    }
+
+    vlist[0]++;
+    vlist[1]++;
+    if (animated)
+        vlist[2] += 2;
+    else
+        vlist[2] = 1;
+
+    num_frames = vlist[2];
+
+    while ((temp = avio_r8(pb))) {
+        // Get metadata identifier
+        tag[0] = temp;
+        for(int i = 1; i <= 3; i++)
+            tag[i] = avio_r8(pb);
+
+        // Read varint
+        while ((temp = avio_r8(pb)) > 127) {
+            if (!(count--))
+                return AVERROR_INVALIDDATA;
+            VARINT_APPEND(metadata_size, temp);
+        }
+        VARINT_APPEND(metadata_size, temp);
+        count = 4;
+
+#if CONFIG_ZLIB
+
+        /*
+         * Decompression Routines
+         * There are 3 supported metadata chunks currently in FLIF: eXmp, eXif,
+         * and iCCp. Currently, iCCp color profiles are not handled.
+         */
+
+        if (*((uint32_t *) tag) ==  MKTAG('i','C','C','P')) {
+            goto metadata_skip;
+        }
+
+        while (metadata_size > 0) {
+            if ((buf_size = avio_read_partial(pb, buf, FFMIN(BUF_SIZE, metadata_size))) < 0)
+                return buf_size;
+            metadata_size -= buf_size;
+            if((ret = flif_inflate(dc, buf, buf_size, &out_buf, &out_buf_size)) < 0 &&
+                ret != AVERROR(EAGAIN)) {
+                if (ret == AVERROR(ENOMEM) || ret == AVERROR_INVALIDDATA)
+                    return ret;
+                av_log(s, AV_LOG_ERROR, "could not decode metadata segment: %s\n", tag);
+                goto metadata_skip;
+            }
+        }
+
+        switch (*((uint32_t *) tag)) {
+        case MKTAG('e', 'X', 'i','f'):
+#if CONFIG_EXIF
+            ret = flif_read_exif(s, out_buf, out_buf_size, &s->metadata);
+            if (ret < 0)
+                av_log(s, AV_LOG_WARNING, "metadata may be corrupted\n");
+#endif
+            break;
+
+        default:
+            av_dict_set(&s->metadata, tag, out_buf, 0);
+            break;
+        }
+#else
+        avio_skip(pb, metadata_size);
+#endif
+
+        continue;
+
+        metadata_skip:
+        avio_skip(pb, metadata_size);
+    }
+
+    av_freep(&out_buf);
+
+    do {
+        if ((ret = avio_read_partial(pb, buf, BUF_SIZE)) < 0)
+            return ret;
+        bytestream2_init(&gb, buf, ret);
+    } while (ff_flif16_rac_init(&rc, &gb) < 0);
+
+    while (1) {
+        switch (segment) {
+        case 0:
+            if (bpc == '0') {
+                bpc = 0;
+                for (; i < num_planes; i++) {
+                    RAC_GET(&rc, NULL, 1, 15, &temp, FLIF16_RAC_UNI_INT8);
+                    bpc = FFMAX(bpc, (1 << temp) - 1);
+                }
+                i = 0;
+            } else
+                bpc = (bpc == '1') ? 255 : 65535;
+            if (num_frames < 2)
+                goto end;
+            segment++;
+
+        case 1:
+            if (num_planes > 3) {
+                RAC_GET(&rc, NULL, 0, 1, &temp, FLIF16_RAC_UNI_INT8);
+            }
+            segment++;
+
+        case 2:
+            if (num_frames > 1) {
+                RAC_GET(&rc, NULL, 0, 100, &loops, FLIF16_RAC_UNI_INT8);
+            }
+            if (!loops)
+                loops = 1;
+            segment++;
+
+        case 3:
+            if (num_frames > 1) {
+                for (; i < num_frames; i++) {
+                    temp = 0;
+                    RAC_GET(&rc, NULL, 0, 60000, &(temp), FLIF16_RAC_UNI_INT16);
+                    duration += temp;
+                }
+                i = 0;
+            } else
+                duration = 1;
+            goto end;
+        }
+
+        need_more_data:
+        if ((ret = avio_read_partial(pb, buf, BUF_SIZE)) < 0)
+            return ret;
+        bytestream2_init(&gb, buf, ret);
+    }
+
+    end:
+    if (bpc > 65535) {
+        av_log(s, AV_LOG_ERROR, "depth per channel greater than 16 bits not supported\n");
+        return AVERROR_PATCHWELCOME;
+    }
+
+    format = flif16_out_frame_type[FFMIN(num_planes, 4)][bpc > 255];
+
+    // The minimum possible delay in a FLIF16 image is 1 millisecond.
+    // Therefore time base is 10^-3, i.e. 1/1000
+    avpriv_set_pts_info(st, 64, 1, 1000);
+    st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
+    st->codecpar->codec_id   = AV_CODEC_ID_FLIF16;
+    st->codecpar->width      = vlist[0];
+    st->codecpar->height     = vlist[1];
+    st->codecpar->format     = format;
+    st->duration             = duration * loops;
+    st->start_time           = 0;
+    st->nb_frames            = vlist[2];
+    st->need_parsing         = 1;
+
+    // Jump to start because flif16 decoder needs header data too
+    if (avio_seek(pb, 0, SEEK_SET) != 0)
+        return AVERROR(EIO);
+    return 0;
+}
+
+
+static int flif16_read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+    AVIOContext *pb  = s->pb;
+    int ret;
+    ret = av_get_packet(pb, pkt, avio_size(pb));
+    return ret;
+}
+
+AVInputFormat ff_flif_demuxer = {
+    .name           = "flif",
+    .long_name      = NULL_IF_CONFIG_SMALL("Free Lossless Image Format (FLIF)"),
+    .priv_data_size = sizeof(FLIFDemuxContext),
+    .extensions     = "flif",
+    .read_probe     = flif16_probe,
+    .read_header    = flif16_read_header,
+    .read_packet    = flif16_read_packet,
+};
