質問編集履歴

2

テストコードの結果の追記

2022/10/18 10:42

投稿

chem_search
chem_search

スコア30

test CHANGED
File without changes
test CHANGED
@@ -112,6 +112,59 @@
112
112
 
113
113
  なぜこのような現象が起こるのでしょうか?
114
114
 
115
+ ### 試したこと2
116
+
117
+ jbpb0様に提案頂いた以下のコードの実行を試みたところ、
118
+ やはりエラーが出ました。
119
+
120
+
121
+ ```python
122
+ import ffmpeg
123
+ file = '音声ファイル名'
124
+ sr = 16000
125
+ out, _ = (ffmpeg.input(file, threads=0).output("-", format="s16le", acodec="pcm_s16le", ac=1, ar=sr).run(cmd=["ffmpeg", "-nostdin"], capture_stdout=True, capture_stderr=True))
126
+
127
+ ```
128
+
129
+
130
+ ```python
131
+ FileNotFoundError Traceback (most recent call last)
132
+ ~\AppData\Local\Temp/ipykernel_13216/2098733105.py in <module>
133
+ 2 file = 'testsample.mp3'
134
+ 3 sr = 16000
135
+ ----> 4 out, _ = (ffmpeg.input(file, threads=0).output("-", format="s16le", acodec="pcm_s16le", ac=1, ar=sr).run(cmd=["ffmpeg", "-nostdin"], capture_stdout=True, capture_stderr=True))
136
+
137
+ ~\anaconda3\envs\pip-env\lib\site-packages\ffmpeg\_run.py in run(stream_spec, cmd, capture_stdout, capture_stderr, input, quiet, overwrite_output)
138
+ 318 pipe_stderr=capture_stderr,
139
+ 319 quiet=quiet,
140
+ --> 320 overwrite_output=overwrite_output,
141
+ 321 )
142
+ 322 out, err = process.communicate(input)
143
+
144
+ ~\anaconda3\envs\pip-env\lib\site-packages\ffmpeg\_run.py in run_async(stream_spec, cmd, pipe_stdin, pipe_stdout, pipe_stderr, quiet, overwrite_output)
145
+ 283 stderr_stream = subprocess.PIPE if pipe_stderr or quiet else None
146
+ 284 return subprocess.Popen(
147
+ --> 285 args, stdin=stdin_stream, stdout=stdout_stream, stderr=stderr_stream
148
+ 286 )
149
+ 287
150
+
151
+ ~\anaconda3\envs\pip-env\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
152
+ 798 c2pread, c2pwrite,
153
+ 799 errread, errwrite,
154
+ --> 800 restore_signals, start_new_session)
155
+ 801 except:
156
+ 802 # Cleanup if the child failed starting.
157
+
158
+ ~\anaconda3\envs\pip-env\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
159
+ 1205 env,
160
+ 1206 os.fspath(cwd) if cwd is not None else None,
161
+ -> 1207 startupinfo)
162
+ 1208 finally:
163
+ 1209 # Child is launched. Close the parent's copy of those pipe
164
+
165
+ FileNotFoundError: [WinError 2] 指定されたファイルが見つかりません。
166
+ ```
167
+
115
168
  ### 補足情報(FW/ツールのバージョンなど)
116
169
  python 3.7.11
117
170
  whisper 1.0

1

エラーの詳細を追記

2022/10/17 22:20

投稿

chem_search
chem_search

スコア30

test CHANGED
File without changes
test CHANGED
@@ -9,7 +9,65 @@
9
9
  ### 発生している問題・エラーメッセージ
10
10
 
11
11
  ```
12
+ FileNotFoundError Traceback (most recent call last)
13
+ ~\AppData\Local\Temp/ipykernel_4848/290471416.py in <module>
14
+ 5 path = ".\\testsample.mp3"
15
+ 6
16
+ ----> 7 result = model.transcribe(path, verbose=True, language='ja')
17
+ 8 print(result["text"])
18
+
19
+ ~\anaconda3\envs\pip-env\lib\site-packages\whisper\transcribe.py in transcribe(model, audio, verbose, temperature, compression_ratio_threshold, logprob_threshold, no_speech_threshold, condition_on_previous_text, **decode_options)
20
+ 82 decode_options["fp16"] = False
21
+ 83
22
+ ---> 84 mel = log_mel_spectrogram(audio)
23
+ 85
24
+ 86 if decode_options.get("language", None) is None:
25
+
26
+ ~\anaconda3\envs\pip-env\lib\site-packages\whisper\audio.py in log_mel_spectrogram(audio, n_mels)
27
+ 109 if not torch.is_tensor(audio):
28
+ 110 if isinstance(audio, str):
29
+ --> 111 audio = load_audio(audio)
30
+ 112 audio = torch.from_numpy(audio)
31
+ 113
32
+
33
+ ~\anaconda3\envs\pip-env\lib\site-packages\whisper\audio.py in load_audio(file, sr)
34
+ 42 ffmpeg.input(file, threads=0)
35
+ 43 .output("-", format="s16le", acodec="pcm_s16le", ac=1, ar=sr)
36
+ ---> 44 .run(cmd=["ffmpeg", "-nostdin"], capture_stdout=True, capture_stderr=True)
37
+ 45 )
38
+ 46 except ffmpeg.Error as e:
39
+
40
+ ~\anaconda3\envs\pip-env\lib\site-packages\ffmpeg\_run.py in run(stream_spec, cmd, capture_stdout, capture_stderr, input, quiet, overwrite_output)
41
+ 318 pipe_stderr=capture_stderr,
42
+ 319 quiet=quiet,
43
+ --> 320 overwrite_output=overwrite_output,
44
+ 321 )
45
+ 322 out, err = process.communicate(input)
46
+
47
+ ~\anaconda3\envs\pip-env\lib\site-packages\ffmpeg\_run.py in run_async(stream_spec, cmd, pipe_stdin, pipe_stdout, pipe_stderr, quiet, overwrite_output)
48
+ 283 stderr_stream = subprocess.PIPE if pipe_stderr or quiet else None
49
+ 284 return subprocess.Popen(
50
+ --> 285 args, stdin=stdin_stream, stdout=stdout_stream, stderr=stderr_stream
51
+ 286 )
52
+ 287
53
+
54
+ ~\anaconda3\envs\pip-env\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
55
+ 798 c2pread, c2pwrite,
56
+ 799 errread, errwrite,
57
+ --> 800 restore_signals, start_new_session)
58
+ 801 except:
59
+ 802 # Cleanup if the child failed starting.
60
+
61
+ ~\anaconda3\envs\pip-env\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
62
+ 1205 env,
63
+ 1206 os.fspath(cwd) if cwd is not None else None,
64
+ -> 1207 startupinfo)
65
+ 1208 finally:
66
+ 1209 # Child is launched. Close the parent's copy of those pipe
67
+
12
68
  FileNotFoundError: [WinError 2] 指定されたファイルが見つかりません。
69
+
70
+
13
71
  ```
14
72
 
15
73
  ### 該当のソースコード