• moto's avatar
    Support multiple FFmpeg versions (#3464) · 786066b4
    moto authored
    Summary:
    This commit introduces support for multiple FFmpeg versions for OSS binary distributions.
    
    Currently torchaudio only works with FFmpeg 4. This is inconvenient from installing to runtime linking.
    This commit allows to pick FFmpeg 4, 5 or 6 at runtime, instead of just looking for v4.
    
    The way it works is that we compile the FFmpeg extension three times with different FFmpeg and ship them.
    At runtime, we look for libavutil of specific version and when one is found, load the corresponding FFmpeg extension.
    The order of preference is 6, 5, then 4.
    
    To make the build process simple and reproducible, we use pre-built binaries of FFmpeg during the build.
    They are LGPL and downloaded from S3 at build time, instead of building every time.
    
    The use of pre-built binaries as scaffolding limits the system that can build torchaudio, so it also introduces
    single FFmpeg version support mode. setting FFMPEG_ROOT during the build will change the way binaries are built
    so that it will only support one specific version of FFmpeg.
    
    Pull Request resolved: https://github.com/pytorch/audio/pull/3464
    
    Differential Revision: D47300223
    
    Pulled By: mthrok
    
    fbshipit-source-id: 560c7968315e4c8922afa11a4693f648c0356d04
    786066b4
extension.py 7.97 KB