|
1 | 1 | """Audio Read/Write Module |
2 | 2 | """ |
3 | 3 |
|
4 | | -from . import ffmpegprocess, utils, configure, FFmpegError, probe, plugins |
| 4 | +from . import ffmpegprocess, utils, configure, FFmpegError, probe, plugins, caps |
5 | 5 | from .utils import filter as filter_utils, log as log_utils |
| 6 | +import logging |
6 | 7 |
|
7 | 8 | __all__ = ["create", "read", "write", "filter"] |
8 | 9 |
|
@@ -187,11 +188,14 @@ def read(url, progress=None, show_log=None, **options): |
187 | 188 | sample_fmt = options.get("sample_fmt", None) |
188 | 189 | ac_in = ar_in = None |
189 | 190 | if sample_fmt is None: |
190 | | - # use the same format as the input |
191 | | - info = probe.audio_streams_basic(url, 0)[0] |
192 | | - sample_fmt = info["sample_fmt"] |
193 | | - ac_in = info.get("ac", None) |
194 | | - ar_in = info.get("ar", None) |
| 191 | + try: |
| 192 | + # use the same format as the input |
| 193 | + info = probe.audio_streams_basic(url, 0)[0] |
| 194 | + sample_fmt = info["sample_fmt"] |
| 195 | + ac_in = info.get("ac", None) |
| 196 | + ar_in = info.get("ar", None) |
| 197 | + except: |
| 198 | + sample_fmt = 's16' |
195 | 199 |
|
196 | 200 | input_options = utils.pop_extra_options(options, "_in") |
197 | 201 | url, stdin, input = configure.check_url( |
|
0 commit comments