1. 14 Aug, 2023 1 commit
  2. 10 Aug, 2023 1 commit
  3. 29 Jul, 2023 1 commit
    • moto's avatar
      Refactor compat (#3518) · 8497ee91
      moto authored
      Summary:
      The I/O functions in _compat module was introduced there so that
      everything related to FFmpeg is in torchaudio.io and FFmpeg library
      initialization can be carried out in `torchaudio.io.__init__`.
      
      Now that this constraint is removed, (all the initialization happens
      at `torchaudio._extension.__init__`) and `_compat` is only used by
      FFmpeg dispatcher backend, we move the module to `torchaudio._backend`
      for better locality.
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/3518
      
      Reviewed By: huangruizhe
      
      Differential Revision: D47877412
      
      Pulled By: mthrok
      
      fbshipit-source-id: aa18c8cb6e5d5360950df5158c33c653e37c565f
      8497ee91
  4. 12 Jul, 2023 1 commit
    • 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
  5. 01 Jun, 2023 1 commit
    • moto's avatar
      Refactor arg mapping in ffmpeg save function (#3387) · b99e5f46
      moto authored
      Summary:
      The arguments of TorchAudio's save function ("format", "bits_per_sample" and "encoding")
      are not one-to-one mapping to the arguments of FFmpeg encoding.
      
      For example, to use vorbis codec, FFmpeg expects "ogg" container/extension with "vorbis"
      encoder. It does not recognize "vorbis" extension like TorchAudio (libsox) does.
      
      This commit refactors the logic to parse/map the arguments.
      
      As a result it now properly works with vorbis and mp3 extension.
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/3387
      
      Reviewed By: hwangjeff
      
      Differential Revision: D46328787
      
      Pulled By: mthrok
      
      fbshipit-source-id: 36f993952a062bfec58a8b51be6aa86297571f90
      b99e5f46
  6. 07 Apr, 2023 1 commit
  7. 04 Apr, 2023 1 commit
    • moto's avatar
      [BC-breaking] Make I/O optional arguments kw-only (#3227) · ab40a3a3
      moto authored
      Summary:
      Recently, we added bunch of options to make StreamReader/Writer flexible. As a result, their methods have many number of arguments, and some of them have semantic grouping.
      
      For example, the arguments of ``StreamWriter.add_video_stream`` are roughly grouped as follow;
      
      - Information about input media format
         `frame_rate`, `width`, `height`, `format`
      - Information about encoder
         `encoder`, `encoder_option`
      - Information about codec configuration
         `codec_config`
      - Information about encode media format
         `encoder_format`, `encoder_frame_rate`, `encoder_width`, `encoder_height`
      - Information about additional processing
         `filter_desc`
      - Hardware acceleration
         `hw_accel`
      
      We do not know what arguments will be added in the future, but when we do,
      we want to keep them roughly grouped, by inserting the new argument
      somewhere in a middle without breaking backward compatibility.
      
      This commit puts most of them in keyword-only argument, so that we can
      rearrange them without breaking backward compatibility.
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/3227
      
      Reviewed By: hwangjeff
      
      Differential Revision: D44681620
      
      Pulled By: mthrok
      
      fbshipit-source-id: b55f6168f4c2f3d0f59731b9bb0db4ae54e5a90f
      ab40a3a3
  8. 01 Mar, 2023 1 commit
  9. 24 Feb, 2023 2 commits
    • moto's avatar
      Cleanup ffmpeg bidings (#3095) · b46628ba
      moto authored
      Summary: Pull Request resolved: https://github.com/pytorch/audio/pull/3095
      
      Reviewed By: nateanl
      
      Differential Revision: D43544998
      
      Pulled By: mthrok
      
      fbshipit-source-id: 4359cdbbdbee53084016a84129cb3d65900b0457
      b46628ba
    • moto's avatar
      Bind StreamReader/Writer with PyBind11 (#3091) · b012b452
      moto authored
      Summary:
      This commit is kind of clean up and preparation for future
      development.
      
      We plan to pass around more complicated objects among
      StreamReader and StreamWriter, and TorchBind is not expressive enough
      for defining intermediate object, so we use PyBind11 for binding
      StreamWriter.
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/3091
      
      Reviewed By: xiaohui-zhang
      
      Differential Revision: D43515714
      
      Pulled By: mthrok
      
      fbshipit-source-id: 9097bb104bbf8c1536a5fab6f87447c08b10a7f2
      b012b452
  10. 15 Feb, 2023 1 commit
  11. 22 Jan, 2023 1 commit
    • moto's avatar
      Make StreamReader return PTS (#2975) · 0dd59e0d
      moto authored
      Summary:
      This commit makes `StreamReader` report PTS (presentation time stamp) of the returned chunk as well.
      
      Example
      
      ```python
      from torchaudio.io import StreamReader
      
      s = StreamReader(...)
      s.add_video_stream(...)
      for (video_chunk, ) in s.stream():
          # video_chunk is Torch tensor type but has extra attribute of PTS
          print(video_chunk.pts)  # reports the PTS of the first frame of the video chunk.
      ```
      
      For the backward compatibility, we introduce a `_ChunkTensor`, that is a composition
      of Tensor and metadata, but works like a normal tensor in PyTorch operations.
      
      The implementation of `_ChunkTensor` is based on [TrivialTensorViaComposition](https://github.com/albanD/subclass_zoo/blob/0eeb1d68fb59879029c610bc407f2997ae43ba0a/trivial_tensors.py#L83).
      
      It was also suggested to attach metadata directly to Tensor object,
      but the possibility to have the collision on torchaudio's metadata and new attributes introduced in
      PyTorch cannot be ignored, so we use Tensor subclass implementation.
      
      If any unexpected issue arise from metadata attribute name collision, client code can
      fetch the bare Tensor and continue.
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/2975
      
      Reviewed By: hwangjeff
      
      Differential Revision: D42526945
      
      Pulled By: mthrok
      
      fbshipit-source-id: b4e9422e914ff328421b975120460f3001268f35
      0dd59e0d
  12. 21 Dec, 2022 1 commit
    • moto's avatar
      Extract libsox integration from libtorchaudio (#2929) · 1706a72f
      moto authored
      Summary:
      This commit makes the following changes to the C++ library organization
      - Move sox-related feature implementations from `libtorchaudio` to `libtorchaudio_sox`.
      - Remove C++ implementation of `is_sox_available` and `is_ffmpeg_available` as it is now sufficient to check the existence of `libtorchaudio_sox` and `libtorchaudio_ffmpeg` to check the availability. This makes `libtorchaudio_sox` and `libtorchaudio_ffmpeg` independent from `libtorchaudio`.
      - Move PyBind11-based bindings (`_torchaudio_sox`, `_torchaudio_ffmpeg`) into `torchaudio.lib` so that the built library structure is less cluttered.
      
      Background:
      Originally, when the `libsox` was the only C++ extension and `libtorchaudio` was supposed to contain all the C++ code.
      The things are different now. We have a bunch of C++ extensions and we need to make the code/build structure more modular.
      
      The new `libtorchaudio_sox` contains the implementations and `_torchaudio_sox` contains the PyBin11-based bindings.
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/2929
      
      Reviewed By: hwangjeff
      
      Differential Revision: D42159594
      
      Pulled By: mthrok
      
      fbshipit-source-id: 1a0fbca9e4143137f6363fc001b2378ce6029aa7
      1706a72f
  13. 10 Dec, 2022 1 commit
  14. 02 Nov, 2022 1 commit
  15. 07 Oct, 2022 1 commit
  16. 08 Jun, 2022 1 commit
  17. 02 Jun, 2022 1 commit