diff --git a/multimedia/VLC/Portfile b/multimedia/VLC/Portfile
index 7f74bf6774..c320735e5b 100644
--- a/multimedia/VLC/Portfile
+++ b/multimedia/VLC/Portfile
@@ -5,6 +5,14 @@ PortGroup               compiler_blacklist_versions 1.0
 PortGroup               active_variants 1.1
 PortGroup               conflicts_build 1.0
 
+if {[file exists ${prefix}/etc/macports/locales.tcl]} {
+    # experimental feature to cut down the NLS/locale files, which take up over 50% of
+    # the install footprint for VLC. This feature loads the locale_select PortGroup
+    # if its configuration file exist; a variant is then added which prunes all translations from
+    # ${destroot}${prefix}/share/locale except those whitelisted in etc/macports/locales.tcl .
+    PortGroup           locale_select 1.0
+}
+
 name                    VLC
 
 categories              multimedia devel
@@ -29,8 +37,12 @@ subport lib${name} {
     homepage            http://www.videolan.org/vlc/libvlc.html
 }
 
-subport ffmpeg-VLC {}
-set FFMPEG_VLC_PREFIX   ${prefix}/lib/vlc/ffmpeg
+set use_ffmpeg_VLC      no
+
+if {[tbool use_ffmpeg_VLC]} {
+    subport ffmpeg-VLC {}
+    set FFMPEG_VLC_PREFIX   ${prefix}/lib/vlc/ffmpeg
+}
 
 if {${subport} eq ${name}} {
     conflicts           lib${name} libVLC-devel VLC-devel
@@ -44,8 +56,7 @@ supported_archs         x86_64
 ###################  ports VLC and libVLC  ###################
 ##
 if {(${subport} eq ${name}) || (${subport} eq "lib${name}")} {
-    version             2.2.4
-    revision            8
+    version             2.2.6
     license             GPL-2
 
     platforms           darwin
@@ -54,8 +65,8 @@ if {(${subport} eq ${name}) || (${subport} eq "lib${name}")} {
     distname            vlc-${version}
     use_xz              yes
 
-    checksums           rmd160  2fe178bb9a4b2ad5ca0294d3e52ceb992b22e8ee \
-                        sha256  1632e91d2a0087e0ef4c3fb4c95c3c2890f7715a9d1d43ffd46329f428cf53be
+    checksums           rmd160  b2727834bcbbf0d274e3a0b4a3317f3b914f9ad4 \
+                        sha256  c403d3accd9a400eb2181c958f3e7bc5524fe5738425f4253d42883b425a42a8
 
     if {[info exist ::env(MACPORTS_COMPRESS_WORKDIR)] && $::env(MACPORTS_COMPRESS_WORKDIR)} {
         # Enable HFS compression.
@@ -67,8 +78,11 @@ if {(${subport} eq ${name}) || (${subport} eq "lib${name}")} {
 
     depends_build       port:pkgconfig
 
-    depends_lib         port:ffmpeg-VLC \
-                        port:a52dec \
+    if {[tbool use_ffmpeg_VLC]} {
+        depends_lib-append \
+                        port:ffmpeg-VLC
+    }
+    depends_lib-append  port:a52dec \
                         port:avahi \
                         port:bzip2 \
                         port:faad2 \
@@ -189,44 +203,51 @@ if {(${subport} eq ${name}) || (${subport} eq "lib${name}")} {
                         static_assert.patch \
                         no-sparkle.patch \
                         patch-vlc-no-O4.diff \
-                        patch-ffmpegVLC.diff \
                         patch-soundfont-path.diff
+    if {[tbool use_ffmpeg_VLC]} {
+        patchfiles-append \
+                        patch-ffmpegVLC.diff
+    } else {
+        patchfiles-append \
+                        patch-ffmpeg3-compat.diff
+    }
 
     post-patch {
         if {[string match *clang* ${configure.cxx}] && ${configure.cxx_stdlib} == "libc++"} {
             reinplace "s:-lstdc\+\+:-lc++:" \
-                ${worksrcpath}/configure.ac \
                 ${worksrcpath}/modules/access/Makefile.am
         }
 
         reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/modules/codec/fluidsynth.c
 
-        # patch source using ffmpeg to use the correct header file locations
-        foreach dir {libavcodec libavformat libavresample libavutil libpostproc libswresample libswscale} {
-            foreach module {access codec/avcodec demux/avformat hw/vdpau packetizer video_chroma} {
-                foreach cf [glob -nocomplain ${worksrcpath}/modules/${module}/*.c] {
-                    reinplace "s|${dir}/|${dir}-VLC/|g" ${cf}
-                }
-                foreach cf [glob -nocomplain ${worksrcpath}/modules/${module}/*.h] {
-                    reinplace "s|${dir}/|${dir}-VLC/|g" ${cf}
+        if {[tbool use_ffmpeg_VLC]} {
+            # patch source using ffmpeg to use the correct header file locations
+            foreach dir {libavcodec libavformat libavresample libavutil libpostproc libswresample libswscale} {
+                foreach module {access codec/avcodec demux/avformat hw/vdpau packetizer video_chroma} {
+                    foreach cf [glob -nocomplain ${worksrcpath}/modules/${module}/*.c] {
+                        reinplace "s|${dir}/|${dir}-VLC/|g" ${cf}
+                    }
+                    foreach cf [glob -nocomplain ${worksrcpath}/modules/${module}/*.h] {
+                        reinplace "s|${dir}/|${dir}-VLC/|g" ${cf}
+                    }
                 }
+                reinplace "s|${dir}/|${dir}-VLC/|g" ${worksrcpath}/configure.ac ${worksrcpath}/configure
             }
-            reinplace "s|${dir}/|${dir}-VLC/|g" ${worksrcpath}/configure.ac ${worksrcpath}/configure
-        }
-        reinplace "s|postproc/|postproc-VLC/|g" ${worksrcpath}/configure.ac ${worksrcpath}/configure
-        reinplace "s|libpostproc/|libpostproc-VLC/|g" ${worksrcpath}/modules/video_filter/postproc.c
-        reinplace "s|HAVE_LIBAVUTIL_AV|HAVE_LIBAVUTIL_VLC_AV|g" \
+            reinplace "s|postproc/|postproc-VLC/|g" ${worksrcpath}/configure.ac ${worksrcpath}/configure
+            reinplace "s|libpostproc/|libpostproc-VLC/|g" ${worksrcpath}/modules/video_filter/postproc.c
+            reinplace "s|HAVE_LIBAVUTIL_AV|HAVE_LIBAVUTIL_VLC_AV|g" \
                 ${worksrcpath}/modules/codec/avcodec/avcommon.h \
                 ${worksrcpath}/modules/codec/avcodec/avcommon_compat.h
-        reinplace "s|HAVE_LIBAVFORMAT_AV|HAVE_LIBAVFORMAT_VLC_AV|g" \
+            reinplace "s|HAVE_LIBAVFORMAT_AV|HAVE_LIBAVFORMAT_VLC_AV|g" \
                 ${worksrcpath}/modules/codec/avcodec/avcommon.h \
                 ${worksrcpath}/modules/codec/avcodec/avcommon_compat.h
-        reinplace "s|HAVE_LIBAVCODEC_AV|HAVE_LIBAVCODEC_VLC_AV|g" \
+            reinplace "s|HAVE_LIBAVCODEC_AV|HAVE_LIBAVCODEC_VLC_AV|g" \
                 ${worksrcpath}/modules/codec/avcodec/avcommon.h \
                 ${worksrcpath}/modules/codec/avcodec/avcommon_compat.h
-        reinplace "s|HAVE_LIBSWSCALE_SW|HAVE_LIBSWSCALE_VLC_SW|g" \
+            reinplace "s|HAVE_LIBSWSCALE_SW|HAVE_LIBSWSCALE_VLC_SW|g" \
                 ${worksrcpath}/modules/codec/avcodec/avcommon.h \
                 ${worksrcpath}/modules/codec/avcodec/avcommon_compat.h
+        }
     }
     post-configure {
         system -W ${worksrcpath} "patch -Np0 -i ${filespath}/patch-static_assert.diff"
@@ -240,9 +261,11 @@ if {(${subport} eq ${name}) || (${subport} eq "lib${name}")} {
 
     configure.env-append \
                         CXXCPP="${configure.cxx} -E"
-    # splice in ffmpeg-VLC's pkgconfig path, hoping that PKG_CONFIG_PATH hasn't been set by anyone else
-    configure.env-append \
+    if {[tbool use_ffmpeg_VLC]} {
+        # splice in ffmpeg-VLC's pkgconfig path, hoping that PKG_CONFIG_PATH hasn't been set by anyone else
+        configure.env-append \
                         PKG_CONFIG_PATH=${FFMPEG_VLC_PREFIX}/lib/pkgconfig
+    }
     build.args-append   DESTDIR=${worksrcpath}/dest_ignore V=1
 
     # gl.c:121:3: error: Platform not recognized.
@@ -439,8 +462,8 @@ if {(${subport} eq ${name}) || (${subport} eq "lib${name}")} {
             description {Enable all variants (except freerdp, currently)} {}
     }
 
-    # this patchfile can probably go with VLC 2.2.2, or should be reviewed then.
-    # update 2.2.2 : lua 5.3 gives compiler syntax errors so we stick with 5.2 for now.
+#     # this patchfile can probably go with VLC 2.2.2, or should be reviewed then.
+#     # update 2.2.2 : lua 5.3 gives compiler syntax errors so we stick with 5.2 for now.
     patchfiles-append           patch-for-lua52.diff
 
     # make 10.12 and later ignore all QTKit code in modules/gui/macosx/open.m
@@ -452,14 +475,9 @@ if {(${subport} eq ${name}) || (${subport} eq "lib${name}")} {
             default_variants-append +qtkit
         }
 
-        configure.args-replace  --disable-macosx-eyetv --enable-macosx-eyetv
-
-        if {${subport} ne "lib${name}"} {
-            configure.args-replace  --disable-macosx-vlc-app --enable-macosx-vlc-app
-        }
+        patchfiles-append       patch-use-NSGetEnviron.diff
 
         post-patch {
-            reinplace "s/Appkit/AppKit/" ${worksrcpath}/configure.ac
             reinplace "/Sparkle.framework/d" \
                 ${worksrcpath}/extras/package/macosx/vlc.xcodeproj/project.pbxproj
             reinplace "/SDKROOT/d" \
@@ -470,14 +488,6 @@ if {(${subport} eq ${name}) || (${subport} eq "lib${name}")} {
             reinplace "s:LD_LIBRARY_PATH:DYLD_LIBRARY_PATH:g" \
                 ${worksrcpath}/Makefile.am
 
-            reinplace "/argv/s/environ/*_NSGetEnviron()/" \
-                ${worksrcpath}/modules/misc/inhibit/xdg.c \
-                ${worksrcpath}/modules/stream_filter/decomp.c
-
-            reinplace "s/extern char \\*\\*environ;/#include <crt_externs.h>/" \
-                ${worksrcpath}/modules/misc/inhibit/xdg.c \
-                ${worksrcpath}/modules/stream_filter/decomp.c
-
             if {![file exists ${worksrcpath}/contrib/BGHUDAppKit.framework]} {
                 ln -s ${frameworks_dir}/BGHUDAppKit.framework ${worksrcpath}/contrib/BGHUDAppKit.framework
             }
@@ -486,6 +496,12 @@ if {(${subport} eq ${name}) || (${subport} eq "lib${name}")} {
             file mkdir "${worksrcpath}/contrib/lib"
         }
 
+        configure.args-replace  --disable-macosx-eyetv --enable-macosx-eyetv
+
+        if {${subport} ne "lib${name}"} {
+            configure.args-replace  --disable-macosx-vlc-app --enable-macosx-vlc-app
+        }
+
         post-destroot {
             eval file delete [glob ${destroot}${prefix}/lib/vlc/plugins/*/*.la]
 
@@ -505,10 +521,20 @@ if {(${subport} eq ${name}) || (${subport} eq "lib${name}")} {
                     delete ${destroot}${applications_dir}/VLC.app/Contents/MacOS/share/lua
 
                     # http://trac.macports.org/ticket/35131
-                    ln -s ${prefix}/lib ${destroot}${applications_dir}/VLC.app/Contents/MacOS/lib
+                    xinstall -m 755 -d ${destroot}${applications_dir}/VLC.app/Contents/MacOS/lib
+                    foreach l [glob -nocomplain ${destroot}${prefix}/lib/*] {
+                        ln -s ${prefix}/lib/[file tail ${l}] ${destroot}${applications_dir}/VLC.app/Contents/MacOS/lib
+                    }
                     ln -s ${prefix}/lib/vlc/plugins ${destroot}${applications_dir}/VLC.app/Contents/MacOS/plugins
                     ln -s ${prefix}/lib/vlc/lua ${destroot}${applications_dir}/VLC.app/Contents/MacOS/share/lua
-                    ln -s ${prefix}/share/locale ${destroot}${applications_dir}/VLC.app/Contents/MacOS/share/locale
+                    foreach d [glob -nocomplain ${destroot}${prefix}/share/locale/*] {
+                        set locale [file tail ${d}]
+                        set ldir ${destroot}${applications_dir}/VLC.app/Contents/MacOS/share/locale/${locale}/LC_MESSAGES
+                        xinstall -m 755 -d ${ldir}
+                        foreach m [glob -nocomplain ${d}/LC_MESSAGES/*] {
+                            ln -s ${prefix}/share/locale/${locale}/LC_MESSAGES/[file tail ${m}] ${ldir}/
+                        }
+                    }
 
                     # the vlc executable needs to be started with a full path to the app bundle executable
                     # or else the Mac OS X interface will hang beyond even a ^C or ^\ :
@@ -529,179 +555,18 @@ if {(${subport} eq ${name}) || (${subport} eq "lib${name}")} {
             system "${prefix}/lib/vlc/vlc-cache-gen -f ${prefix}/lib/vlc"
         }
     }
-# outcomment when the port:fluid-soundfont* ports have been made available
-#     notes-append "MIDI support requires installing one or more SoundFont files,\
-#         in ${prefix}/share/sounds/sf2, for instance from one of the port:fluid-soundfont-* ports"
+    notes-append "MIDI support requires installing one or more SoundFont files,\
+        in ${prefix}/share/sounds/sf2, for instance from port:generaluser-soundfont."
 }
 
 ##
 #################  support port ffmpeg-VLC  ##################
 ##
 if {${subport} eq "ffmpeg-VLC"} {
-    PortGroup           xcodeversion 1.0
-
-    version             2.8.6
-    revision            1
-    license             LGPL-2.1+
-    categories          multimedia
-    maintainers         gmail.com:rjvbertin openmaintainer
-
-    description         Custom FFMpeg 2.8.6 build for port:VLC and port:libVLC.
-    long_description    Custom FFMpeg build for VLC and libVLC v2.2.x . It installs \
-                        a private copy of FFMpeg v2.8.6 .
-
-    platforms           darwin
-    homepage            http://www.ffmpeg.org/
-    master_sites        http://www.ffmpeg.org/releases/
-
-    use_bzip2           yes
-    distname            ffmpeg-${version}
-
-    checksums           rmd160  5b61b6b0521d39ca31dcfb7fff1dfa26d9e7667a \
-                        sha256  40611e329bc354592c6f8f1deb033c31b91f80e91f5707ca4f9afceca78d8e62
-
-    depends_build       port:pkgconfig \
-                        port:gmake
-
-    # libvpx is static only so can be considered a build dependency (#47934)
-
-    depends_build-append \
-                        port:libvpx
-
-    depends_lib         port:lame \
-                        port:libiconv \
-                        port:openjpeg15 \
-                        port:xz \
-                        port:zlib
-
-    build.cmd           ${prefix}/bin/gmake
-    build.env-append    V=1
-
-    #
-    # enable auto configure of asm optimizations
-    # requires Xcode 3.1 or better on Leopard
-    #
-    minimum_xcodeversions {9 3.1}
-
-    if {[lsearch [get_canonical_archs] i386] != -1} {
-        # clang-3.1 hits https://trac.macports.org/ticket/30137 (<rdar://problem/11542429>)
-        # clang-139 hits https://trac.macports.org/ticket/38141
-        compiler.blacklist-append {clang < 422.1.7}
-    }
-
-    configure.cflags-append -DHAVE_LRINTF ${configure.cppflags}
-    configure.args      --prefix=${FFMPEG_VLC_PREFIX} \
-                        --progs-suffix=-VLC \
-                        --build-suffix=-VLC \
-                        --disable-doc \
-                        --disable-encoder=vorbis \
-                        --enable-libopenjpeg \
-                        --disable-debug \
-                        --disable-avdevice \
-                        --disable-devices \
-                        --disable-avfilter \
-                        --disable-filters \
-                        --disable-protocol=concat \
-                        --disable-bsfs \
-                        --disable-bzlib \
-                        --enable-avresample \
-                        --enable-libmp3lame \
-                        --enable-libvpx \
-                        --disable-libbluray \
-                        --disable-sdl \
-                        --disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes --disable-libxcb-shape \
-                        --enable-shared --disable-static --enable-pthreads \
-                        --enable-rpath \
-                        --disable-stripping \
-                        --cc=${configure.cc}
-
-    # this is the old gpl2 variant. VLC is GPL2'ed, so we can just as well build ffmpeg
-    # with these components.
-    configure.args-append \
-                        --enable-gpl \
-                        --enable-postproc
-
-    configure.args-append \
-                        --arch=${configure.build_arch}
-    configure.env-append \
-                        ASFLAGS='[get_canonical_archflags]'
-    if {${build_arch} eq "x86_64"} {
-        depends_build-append \
-                        port:yasm
-        configure.args-append \
-                        --enable-yasm
+    if {[catch {source "${portpath}/Portfile.ffmpeg.tcl"} err]} {
+        puts stderr "Error reading Portfile.ffmpeg.tcl: $err"
+        return 1;
     }
-
-    platform darwin {
-        if {${os.major} < 9} {
-            configure.args-append --disable-asm
-        }
-
-        # VDA (video hardware acceleration, mostly H264) is only supported on 10.6.3+ up to (excluding) 10.11.
-        #if {(${os.major} > 10 || (${os.major} == 10 && ${os.minor} >= 3)) && (${os.major} < 15)}
-        # Due to a bug in ffmpeg(?), we have to enable VDA on 10.11 as well, even though it shouldn't be supported.
-        # More information: https://github.com/mpv-player/mpv/issues/2299
-        if {${os.major} > 10 || (${os.major} == 10 && ${os.minor} >= 3)} {
-            configure.args-delete --disable-vda
-            configure.args-append --enable-vda
-        }
-
-        # VideotoolBox, a new hardware acceleration framework, is supported on 10.8+ and "here to stay".
-        # It provides support for H264, H263, MPEG1, MPEG2 and MPEG4.
-        if {${os.major} > 11} {
-            configure.args-delete --disable-videotoolbox
-            configure.args-append --enable-videotoolbox
-        }
-
-        # Apple GCC has problems with SIMD intrinsics and -Werror=no-missing-prototypes.
-        if {${os.major} < 11} {
-            patchfiles-append patch-configure-no-error-on-missing-prototypes.diff
-        }
-
-        # kCVPixelFormatType_OneComponent8 used in avfoundation indev is only available on 10.8+
-        if {${os.major} < 12} {
-            configure.args-append --disable-indev=avfoundation
-        }
-    }
-
-    #
-    # configure isn't autoconf and they do use a dep cache
-    #
-
-    platform darwin 8 {
-        post-patch {
-            reinplace "s:,-compatibility_version,$\(LIBMAJOR\)::" ${worksrcpath}/configure
-        }
-    }
-
-    destroot.target     install-libs install-headers
-
-    post-destroot {
-        file delete -force ${destroot}${prefix}/share/examples
-        # We need to make sure that the linker will use our libraries and not one
-        # from a location like ${prefix}/lib . That's why we use --build-suffix, but
-        # that still requires us to provide pkg-config files with the standard names:
-        foreach pc [glob ${destroot}${FFMPEG_VLC_PREFIX}/lib/pkgconfig/*.pc] {
-            set standardname [strsed ${pc} "s/-VLC.pc/.pc/"]
-            ln -s [file tail ${pc}] ${standardname}
-        }
-        # oblige dependent code to include files from our own renamed header file directories, so it
-        # cannot include mismatching headers by accident (e.g. those from ffmpeg 3.x).
-        foreach dir {libavcodec libavformat libavresample libavutil libpostproc libswresample libswscale} {
-            file rename ${destroot}${FFMPEG_VLC_PREFIX}/include/${dir} ${destroot}${FFMPEG_VLC_PREFIX}/include/${dir}-VLC
-        }
-        foreach dir {libavcodec libavformat libavresample libavutil libpostproc libswresample libswscale} {
-            foreach header [glob -nocomplain ${destroot}${FFMPEG_VLC_PREFIX}/include/*/*.h] {
-                reinplace "s|${dir}/|${dir}-VLC/|g" ${header}
-            }
-        }
-        # packageable: ${destroot}${FFMPEG_VLC_PREFIX}/{include,lib/lib*VLC.dylib,lib/pkgconfig}
-    }
-
-    livecheck.type      regex
-    livecheck.url       ${master_sites}
-    livecheck.regex     "ffmpeg-(\\d+(?:\\.\\d+)*)${extract.suffix}"
-
 }
 
 # kate: backspace-indents true; indent-pasted-text true; indent-width 4; keep-extra-spaces true; remove-trailing-spaces modified; replace-tabs true; replace-tabs-save true; syntax Tcl/Tk; tab-indents true; tab-width 4;
diff --git a/multimedia/VLC/files/patch-ffmpeg3-compat.diff b/multimedia/VLC/files/patch-ffmpeg3-compat.diff
new file mode 100644
index 0000000000..7dc5411890
--- /dev/null
+++ b/multimedia/VLC/files/patch-ffmpeg3-compat.diff
@@ -0,0 +1,231 @@
+Submitted By:            Armin K <krejzi au email do com>
+Date:                    2016-05-06
+Initial Package Version: 2.2.3
+Upstream Status:         Committed
+Origin:                  Upstream
+Description:             Fixes building against ffmpeg3
+                         Rediffed for version 2.2.3 by Bruce Dubbs
+
+diff -Naur  configure  configure
+---  configure	2016-04-04 19:45:51.000000000 -0500
++++  configure	2016-05-06 22:39:24.859030920 -0500
+@@ -36549,7 +36549,7 @@
+ 
+     if test -n "$PKG_CONFIG" && \
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libavutil < 55\""; } >&5
+-  ($PKG_CONFIG --exists --print-errors "libavutil < 55") 2>&5
++  ($PKG_CONFIG --exists --print-errors "libavutil > 55") 2>&5
+   ac_status=$?
+   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+   test $ac_status = 0; }; then
+@@ -36843,7 +36843,7 @@
+     ffmpeg)
+       if test -n "$PKG_CONFIG" && \
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libavcodec >= 57.10.100\""; } >&5
+-  ($PKG_CONFIG --exists --print-errors "libavcodec >= 57.10.100") 2>&5
++  ($PKG_CONFIG --exists --print-errors "libavcodec >= 60.10.100") 2>&5
+   ac_status=$?
+   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+   test $ac_status = 0; }; then
+@@ -36927,7 +36927,7 @@
+       ffmpeg)
+         if test -n "$PKG_CONFIG" && \
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libavcodec >= 57.10.100\""; } >&5
+-  ($PKG_CONFIG --exists --print-errors "libavcodec >= 57.10.100") 2>&5
++  ($PKG_CONFIG --exists --print-errors "libavcodec >= 60.10.100") 2>&5
+   ac_status=$?
+   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+   test $ac_status = 0; }; then
+@@ -45119,7 +45119,7 @@
+     ffmpeg) av_vdpau_ver="55.42.100"
+       if test -n "$PKG_CONFIG" && \
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libavcodec >= 57.10.100\""; } >&5
+-  ($PKG_CONFIG --exists --print-errors "libavcodec >= 57.10.100") 2>&5
++  ($PKG_CONFIG --exists --print-errors "libavcodec >= 60.10.100") 2>&5
+   ac_status=$?
+   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+   test $ac_status = 0; }; then
+diff -Naur  modules/codec/avcodec/audio.c  modules/codec/avcodec/audio.c
+---  modules/codec/avcodec/audio.c	2015-12-08 10:18:56.000000000 -0600
++++  modules/codec/avcodec/audio.c	2016-05-06 22:39:24.859030920 -0500
+@@ -36,12 +36,11 @@
+ #include <vlc_codec.h>
+ #include <vlc_avcodec.h>
+ 
++#include "avcodec.h"
++
+ #include <libavcodec/avcodec.h>
+ #include <libavutil/mem.h>
+ 
+-#include <libavutil/audioconvert.h>
+-
+-#include "avcodec.h"
+ 
+ /*****************************************************************************
+  * decoder_sys_t : decoder descriptor
+diff -Naur  modules/codec/avcodec/avcommon_compat.h  modules/codec/avcodec/avcommon_compat.h
+---  modules/codec/avcodec/avcommon_compat.h	2015-03-01 08:07:35.000000000 -0600
++++  modules/codec/avcodec/avcommon_compat.h	2016-05-06 22:39:24.859030920 -0500
+@@ -506,6 +506,15 @@
+ 
+ #endif /* HAVE_LIBAVUTIL_AVUTIL_H */
+ 
++#if LIBAVUTIL_VERSION_MAJOR >= 55
++# define FF_API_AUDIOCONVERT 1
++#endif
++
++/* libavutil/pixfmt.h */
++#ifndef PixelFormat
++# define PixelFormat AVPixelFormat
++#endif
++
+ #ifdef HAVE_LIBAVFORMAT_AVFORMAT_H
+ # include <libavformat/avformat.h>
+ 
+diff -Naur  modules/codec/avcodec/encoder.c  modules/codec/avcodec/encoder.c
+---  modules/codec/avcodec/encoder.c	2015-10-21 11:36:45.000000000 -0500
++++  modules/codec/avcodec/encoder.c	2016-05-06 22:39:24.860030887 -0500
+@@ -41,7 +41,6 @@
+ #include <vlc_cpu.h>
+ 
+ #include <libavcodec/avcodec.h>
+-#include <libavutil/audioconvert.h>
+ 
+ #include "avcodec.h"
+ #include "avcommon.h"
+@@ -311,7 +310,7 @@
+     else if( !GetFfmpegCodec( p_enc->fmt_out.i_codec, &i_cat, &i_codec_id,
+                              &psz_namecodec ) )
+     {
+-        if( FindFfmpegChroma( p_enc->fmt_out.i_codec ) == PIX_FMT_NONE )
++        if( FindFfmpegChroma( p_enc->fmt_out.i_codec ) == AV_PIX_FMT_NONE )
+             return VLC_EGENERIC; /* handed chroma output */
+ 
+         i_cat      = VIDEO_ES;
+@@ -1017,7 +1016,7 @@
+         }
+     }
+ 
+-    p_sys->frame = avcodec_alloc_frame();
++    p_sys->frame = av_frame_alloc();
+     if( !p_sys->frame )
+     {
+         goto error;
+@@ -1088,7 +1087,8 @@
+     AVFrame *frame = NULL;
+     if( likely(p_pict) ) {
+         frame = p_sys->frame;
+-        avcodec_get_frame_defaults( frame );
++        av_frame_unref( frame );
++
+         for( i_plane = 0; i_plane < p_pict->i_planes; i_plane++ )
+         {
+             p_sys->frame->data[i_plane] = p_pict->p[i_plane].p_pixels;
+@@ -1329,7 +1329,7 @@
+     //How much we need to copy from new packet
+     const int leftover = leftover_samples * p_sys->p_context->channels * p_sys->i_sample_bytes;
+ 
+-    avcodec_get_frame_defaults( p_sys->frame );
++    av_frame_unref( p_sys->frame );
+     p_sys->frame->format     = p_sys->p_context->sample_fmt;
+     p_sys->frame->nb_samples = leftover_samples + p_sys->i_samples_delay;
+ 
+@@ -1451,7 +1451,8 @@
+     while( ( p_aout_buf->i_nb_samples >= p_sys->i_frame_size ) ||
+            ( p_sys->b_variable && p_aout_buf->i_nb_samples ) )
+     {
+-        avcodec_get_frame_defaults( p_sys->frame );
++        av_frame_unref( p_sys->frame );
++
+         if( p_sys->b_variable )
+             p_sys->frame->nb_samples = p_aout_buf->i_nb_samples;
+         else
+diff -Naur  modules/codec/avcodec/vaapi.c  modules/codec/avcodec/vaapi.c
+---  modules/codec/avcodec/vaapi.c	2014-11-16 12:57:58.000000000 -0600
++++  modules/codec/avcodec/vaapi.c	2016-05-06 22:39:24.860030887 -0500
+@@ -595,7 +595,7 @@
+         return err;
+ 
+     /* Only VLD supported */
+-    p_va->pix_fmt = PIX_FMT_VAAPI_VLD;
++    p_va->pix_fmt = AV_PIX_FMT_VAAPI_VLD;
+     p_va->setup = Setup;
+     p_va->get = Get;
+     p_va->release = Release;
+diff -Naur  modules/codec/avcodec/video.c  modules/codec/avcodec/video.c
+---  modules/codec/avcodec/video.c	2016-04-04 19:45:24.000000000 -0500
++++  modules/codec/avcodec/video.c	2016-05-06 22:39:24.860030887 -0500
+@@ -234,7 +234,7 @@
+     p_sys->p_codec = p_codec;
+     p_sys->i_codec_id = i_codec_id;
+     p_sys->psz_namecodec = psz_namecodec;
+-    p_sys->p_ff_pic = avcodec_alloc_frame();
++    p_sys->p_ff_pic = av_frame_alloc();
+     p_sys->b_delayed_open = true;
+     p_sys->p_va = NULL;
+     vlc_sem_init( &p_sys->sem_mt, 0 );
+@@ -446,7 +446,7 @@
+     if( ffmpeg_OpenCodec( p_dec ) < 0 )
+     {
+         msg_Err( p_dec, "cannot open codec (%s)", p_sys->psz_namecodec );
+-        avcodec_free_frame( &p_sys->p_ff_pic );
++        av_frame_free( &p_sys->p_ff_pic );
+         vlc_sem_destroy( &p_sys->sem_mt );
+         free( p_sys );
+         return VLC_EGENERIC;
+@@ -826,7 +826,7 @@
+     wait_mt( p_sys );
+ 
+     if( p_sys->p_ff_pic )
+-        avcodec_free_frame( &p_sys->p_ff_pic );
++        av_frame_free( &p_sys->p_ff_pic );
+ 
+     if( p_sys->p_va )
+         vlc_va_Delete( p_sys->p_va );
+diff -Naur  configure.ac  configure.ac
+--- configure.ac.orig	2017-07-14 17:31:03.000000000 +0200
++++ configure.ac	2017-07-14 17:19:32.000000000 +0200
+@@ -2305,8 +2305,8 @@
+ [  --enable-avcodec        libavcodec codec (default enabled)])
+ AS_IF([test "${enable_avcodec}" != "no"], [
+   PKG_CHECK_MODULES(AVCODEC,[libavcodec >= 53.34.0 libavutil >= 51.22.0], [
+-    PKG_CHECK_EXISTS([libavutil < 55],, [
+-      AC_MSG_ERROR([libavutil versions 55 and later are not supported.])
++    PKG_CHECK_EXISTS([libavutil < 56],, [
++      AC_MSG_ERROR([libavutil versions 56 and later are not supported.])
+     ])
+     VLC_SAVE_FLAGS
+     CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
+@@ -2364,8 +2364,8 @@
+ AS_IF([test "${have_vaapi}" = "yes" -a "${have_avcodec}" = "yes"], [
+   case "${avfork}" in
+     ffmpeg)
+-      PKG_CHECK_EXISTS([libavcodec >= 57.10.100], [
+-        AC_MSG_ERROR([VA API requires FFmpeg libavcodec < 57.10 or libav.])
++      PKG_CHECK_EXISTS([libavcodec >= 60.10.100], [
++        AC_MSG_ERROR([VA API requires FFmpeg libavcodec < 60.10 or libav.])
+       ])
+       ;;
+   esac
+@@ -2398,8 +2398,8 @@
+   AS_IF([test "x${have_avcodec}" = "xyes"], [
+     case "${avfork}" in
+       ffmpeg)
+-        PKG_CHECK_EXISTS([libavcodec >= 57.10.100], [
+-          AC_MSG_ERROR([DXVA2 requires FFmpeg libavcodec < 57.10 or libav.])
++        PKG_CHECK_EXISTS([libavcodec >= 60.10.100], [
++          AC_MSG_ERROR([DXVA2 requires FFmpeg libavcodec < 60.10 or libav.])
+         ])
+         ;;
+     esac
+@@ -3162,8 +3162,8 @@
+   case "${avfork}" in
+     libav) av_vdpau_ver="55.26.0" ;;
+     ffmpeg) av_vdpau_ver="55.42.100"
+-      PKG_CHECK_EXISTS([libavcodec >= 57.10.100], [
+-        AC_MSG_ERROR([VDPAU requires FFmpeg libavcodec < 57.10 or libav.])
++      PKG_CHECK_EXISTS([libavcodec >= 60.10.100], [
++        AC_MSG_ERROR([VDPAU requires FFmpeg libavcodec < 60.10 or libav.])
+       ])
+       ;;
+   esac
diff --git a/multimedia/VLC/files/patch-use-NSGetEnviron.diff b/multimedia/VLC/files/patch-use-NSGetEnviron.diff
new file mode 100644
index 0000000000..36d84f22ea
--- /dev/null
+++ b/multimedia/VLC/files/patch-use-NSGetEnviron.diff
@@ -0,0 +1,40 @@
+--- modules/misc/inhibit/orig.xdg.c	2014-08-14 09:20:04.000000000 +0200
++++ modules/misc/inhibit/xdg.c	2017-08-18 14:11:43.000000000 +0200
+@@ -48,7 +48,7 @@
+     posix_spawnattr_t attr;
+ };
+ 
+-extern char **environ;
++#include <crt_externs.h>
+ 
+ static void Timer (void *data)
+ {
+@@ -60,7 +60,7 @@
+     pid_t pid;
+ 
+     int err = posix_spawnp (&pid, "xdg-screensaver", NULL, &sys->attr,
+-                            argv, environ);
++                            argv, *_NSGetEnviron());
+     if (err == 0)
+     {
+         int status;
+--- modules/stream_filter/orig.decomp.c	2015-04-13 21:54:35.000000000 +0200
++++ modules/stream_filter/decomp.c	2017-08-18 14:11:46.000000000 +0200
+@@ -92,7 +92,7 @@
+     int64_t      pts_delay;
+ };
+ 
+-extern char **environ;
++#include <crt_externs.h>
+ 
+ static const size_t bufsize = 65536;
+ #ifdef HAVE_VMSPLICE
+@@ -361,7 +361,7 @@
+                 if (!posix_spawn_file_actions_adddup2 (&actions, comp[0], 0)
+                  && !posix_spawn_file_actions_adddup2 (&actions, uncomp[1], 1)
+                  && !posix_spawnp (&p_sys->pid, path, &actions, NULL, argv,
+-                                   environ))
++                                   *_NSGetEnviron()))
+                 {
+                     if (vlc_clone (&p_sys->thread, Thread, stream,
+                                    VLC_THREAD_PRIORITY_INPUT) == 0)
