forked from pytorch/audio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use FFmpeg-based I/O as fallback in sox_io backend (pytorch#2419)
Summary: This commit add fallback mechanism to `info` and `load` functions of sox_io backend. If torchaudio is compiled to use FFmpeg, and runtime dependencies are properly loaded, in case `info` and `load` fail, it fallback to FFmpeg-based implementation. Depends on pytorch#2416, pytorch#2417, pytorch#2418 Pull Request resolved: pytorch#2419 Differential Revision: D36740306 Pulled By: mthrok fbshipit-source-id: 91dfdd199959d83ce643ccc38cf163ce29fba55e
- Loading branch information
1 parent
bb77cbe
commit 2426ffd
Showing
20 changed files
with
392 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import subprocess | ||
import sys | ||
|
||
|
||
def convert_to_wav(src_path, dst_path): | ||
"""Convert audio file with `ffmpeg` command.""" | ||
# TODO: parameterize codec | ||
command = ["ffmpeg", "-y", "-i", src_path, "-c:a", "pcm_f32le", dst_path] | ||
print(" ".join(command), file=sys.stderr) | ||
subprocess.run(command, check=True) |
Oops, something went wrong.