2noise / ChatTTS

A generative speech model for daily dialogue.
https://2noise.com
GNU Affero General Public License v3.0
30.53k stars 3.32k forks source link

报ffmpeg的错 #675

Open yzp656892924 opened 1 month ago

yzp656892924 commented 1 month ago
Traceback (most recent call last):
  File "/home/jeff/.local/lib/python3.10/site-packages/gradio/queueing.py", line 541, in process_events
    response = await route_utils.call_process_api(
  File "/home/jeff/.local/lib/python3.10/site-packages/gradio/route_utils.py", line 276, in call_process_api
    output = await app.get_blocks().process_api(
  File "/home/jeff/.local/lib/python3.10/site-packages/gradio/blocks.py", line 1938, in process_api
    data = await self.postprocess_data(block_fn, result["prediction"], state)
  File "/home/jeff/.local/lib/python3.10/site-packages/gradio/blocks.py", line 1761, in postprocess_data
    prediction_value = block.postprocess(prediction_value)
  File "/home/jeff/.local/lib/python3.10/site-packages/gradio/components/audio.py", line 267, in postprocess
    file_path = processing_utils.save_audio_to_cache(
  File "/home/jeff/.local/lib/python3.10/site-packages/gradio/processing_utils.py", line 235, in save_audio_to_cache
    audio_to_file(sample_rate, data, filename, format=format)
  File "/home/jeff/.local/lib/python3.10/site-packages/gradio/processing_utils.py", line 566, in audio_to_file
    file = audio.export(filename, format=format)
  File "/home/jeff/.local/lib/python3.10/site-packages/pydub/audio_segment.py", line 970, in export
    raise CouldntEncodeError(
pydub.exceptions.CouldntEncodeError: Encoding failed. ffmpeg/avlib returned error code: 1

Command:['ffmpeg', '-y', '-f', 'wav', '-i', '/tmp/tmpe0ajdsyp', '-f', 'mp3', '/tmp/tmpovwb68jl']

Output from ffmpeg/avlib:

ffmpeg version 4.4.4 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04)
  configuration: --enable-cuda --enable-cuvid --enable-gpl --enable-shared --enable-libx264 --enable-nonfree --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, wav, from '/tmp/tmpe0ajdsyp':
  Duration: 00:00:10.53, bitrate: 384 kb/s
  Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 24000 Hz, mono, s16, 384 kb/s
Automatic encoder selection failed for output stream #0:0. Default encoder for format mp3 (codec mp3) is probably disabled. Please choose an encoder manually.
Error selecting an encoder for stream 0:0

用Gradio页面生成音频的时候,funcs.py中的generate_audio方法执行完成之后,报ffmpeg的错

fumiama commented 1 month ago

说明你用的ffmpeg版本有问题。尝试更新ffmpeg版本。

ScottDeng114514 commented 1 day ago

你的ffmpeg没有MP3编码器,卸载了,然后安装下面这个版本

conda install conda-forge/label/cf202003::ffmpeg