myshell-ai / OpenVoice

Instant voice cloning by MIT and MyShell.
https://research.myshell.ai/open-voice
MIT License
29.88k stars 2.94k forks source link

Failed to load audio: ffmpeg: error while loading shared libraries: #115

Open philosadelphos opened 10 months ago

philosadelphos commented 10 months ago

Hi! Many thanks for the brilliant work! When executing demo_part1.ipynb step 4:

reference_speaker = 'resources/example_reference.mp3'
target_se, audio_name = se_extractor.get_se(reference_speaker, tone_color_converter, target_dir='processed', vad=True)

I received the following error:


CalledProcessError Traceback (most recent call last) File ~/miniconda3/envs/openvoice/lib/python3.9/site-packages/whisper/audio.py:58, in load_audio(file, sr) 57 try: ---> 58 out = run(cmd, capture_output=True, check=True).stdout 59 except CalledProcessError as e:

File ~/miniconda3/envs/openvoice/lib/python3.9/subprocess.py:528, in run(input, capture_output, timeout, check, *popenargs, **kwargs) 527 if check and retcode: --> 528 raise CalledProcessError(retcode, process.args, 529 output=stdout, stderr=stderr) 530 return CompletedProcess(process.args, retcode, stdout, stderr)

CalledProcessError: Command '['ffmpeg', '-nostdin', '-threads', '0', '-i', 'resources/example_reference.mp3', '-f', 's16le', '-ac', '1', '-acodec', 'pcm_s16le', '-ar', '16000', '-']' returned non-zero exit status 127.

The above exception was the direct cause of the following exception:

RuntimeError Traceback (most recent call last) Cell In[4], line 2 1 reference_speaker = 'resources/example_reference.mp3' ----> 2 target_se, audio_name = se_extractor.get_se(reference_speaker, tone_color_converter, target_dir='processed', vad=True)

File ~/AI_DL_MODELS/GIT/OpenVoice/se_extractor.py:141, in get_se(audio_path, vc_model, target_dir, vad) 139 wavs_folder = audio_path 140 elif vad: --> 141 wavs_folder = split_audio_vad(audio_path, target_dir=target_dir, audio_name=audio_name) 142 else: 143 wavs_folder = split_audio_whisper(audio_path, target_dir=target_dir, audio_name=audio_name)

File ~/AI_DL_MODELS/GIT/OpenVoice/se_extractor.py:79, in split_audio_vad(audio_path, audio_name, target_dir, split_seconds) 77 def split_audio_vad(audio_path, audio_name, target_dir, split_seconds=10.0): 78 SAMPLE_RATE = 16000 ---> 79 audio_vad = get_audio_tensor(audio_path) 80 segments = get_vad_segments( 81 audio_vad, 82 output_sample=True, (...) 85 method="silero", 86 ) 87 segments = [(seg["start"], seg["end"]) for seg in segments]

File ~/miniconda3/envs/openvoice/lib/python3.9/site-packages/whisper_timestamped/transcribe.py:1265, in get_audio_tensor(audio, device) 1263 def get_audio_tensor(audio, device="cpu"): 1264 if isinstance(audio, str): -> 1265 audio = whisper.load_audio(audio) 1266 if isinstance(audio, np.ndarray): 1267 audio = torch.Tensor(audio)

File ~/miniconda3/envs/openvoice/lib/python3.9/site-packages/whisper/audio.py:60, in load_audio(file, sr) 58 out = run(cmd, capture_output=True, check=True).stdout 59 except CalledProcessError as e: ---> 60 raise RuntimeError(f"Failed to load audio: {e.stderr.decode()}") from e 62 return np.frombuffer(out, np.int16).flatten().astype(np.float32) / 32768.0

RuntimeError: Failed to load audio: ffmpeg: error while loading shared libraries: libopenh264.so.5: cannot open shared object file: No such file or directory

What could be the reason for the missing file.

Also in step 2, I've received warnings and missing keys:

/home/pedro/miniconda3/envs/openvoice/lib/python3.9/site-packages/torch/cuda/init.py:88: UserWarning: CUDA initialization: CUDA unknown error - this may be due to an incorrectly set up environment, e.g. changing env variable CUDA_VISIBLE_DEVICES after program start. Setting the available devices to be zero. (Triggered internally at /opt/conda/conda-bld/pytorch_1670525539683/work/c10/cuda/CUDAFunctions.cpp:109.) return torch._C._cuda_getDeviceCount() > 0 Loaded checkpoint 'checkpoints/base_speakers/EN/checkpoint.pth' missing/unexpected keys: [] [] Loaded checkpoint 'checkpoints/converter/checkpoint.pth' missing/unexpected keys: [] []

Thank you

ara-vardanyan commented 7 months ago

You don't have ffmpeg installed on your device or the path to ffmpeg in your environment variables aren't set correctly. Install ffmpeg and restart your ide after adding the path to your environment and you should be good to go.