Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

视频识别没问题,音频识别报错,好像是要求16k采样率才能用? #18

Closed
bbeyondllove opened this issue Mar 6, 2024 · 4 comments

Comments

@bbeyondllove
Copy link

prediction = await anyio.to_thread.run_sync(

File "C:\Python310\lib\site-packages\anyio\to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "C:\Python310\lib\site-packages\anyio_backends_asyncio.py", line 2144, in run_sync_in_worker_thread
return await future
File "C:\Python310\lib\site-packages\anyio_backends_asyncio.py", line 851, in run
result = context.run(func, *args)
File "C:\Python310\lib\site-packages\gradio\utils.py", line 689, in wrapper
response = f(*args, **kwargs)
File "D:\gopath\src\ParaClipper\paraclipper\launch.py", line 22, in audio_recog
return audio_clipper.recog(audio_input, sd_switch, hotwords=hotwords)
File "D:\gopath\src\ParaClipper\paraclipper\videoclipper.py", line 28, in recog
assert sr == 16000, "16kHz sample rate required, {} given.".format(sr)
AssertionError: 16kHz sample rate required, 32000 given.

@R1ckShi
Copy link
Collaborator

R1ckShi commented Mar 7, 2024

请拉取最新代码重试,现在audio自动通过librosa进行重采样

@bbeyondllove
Copy link
Author

可以了谢谢。

@R1ckShi R1ckShi closed this as completed Mar 7, 2024
@yingw
Copy link

yingw commented Apr 7, 2024

我这里重新采样也没用,报 AttributeError: 'NoneType' object has no attribute 'format' , 在:

File "/home/yinguowei/AI/FunClip/funclip/launch.py", line 21, in audio_recog
return audio_clipper.recog(audio_input, sd_switch, hotwords=hotwords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/yinguowei/AI/FunClip/funclip/videoclipper.py", line 32, in recog
logging.warning("Input wav shape: {}, only first channel reserved.").format(data.shape)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'format'

好像是data类型不行。

后来尝试把音频转成 wav、16000采样率、单通道,就是不重新采样才可以

@escalate007
Copy link

我这里重新采样也没用,报 AttributeError: 'NoneType' object has no attribute 'format' , 在:

File "/home/yinguowei/AI/FunClip/funclip/launch.py", line 21, in audio_recog return audio_clipper.recog(audio_input, sd_switch, hotwords=hotwords) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/yinguowei/AI/FunClip/funclip/videoclipper.py", line 32, in recog logging.warning("Input wav shape: {}, only first channel reserved.").format(data.shape) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'format'

好像是data类型不行。

后来尝试把音频转成 wav、16000采样率、单通道,就是不重新采样才可以

我也这样做的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants