wvsharber / BeatMapSynthesizer

Automatic Beat Saber mapper for custom songs
MIT License
70 stars 15 forks source link

FileNotFoundError on startupinfo #40

Closed nbanyan closed 4 years ago

nbanyan commented 4 years ago

I ran pip install ffmpeg, but installing that lib didn't remove the warning.

(base) D:\Downloads\Utilities\BeatMapSynthesizer-master>python beatmapsynth.py "Music/Ehrling - Sthlm-Sunset.wav" "Sthlm Sunset by Ehrling" Hard rate_modulated_segmented_HMM E:\anaconda3\lib\site-packages\pydub\utils.py:170: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning) Loading Song... Song loaded successfully! Mapping with rate modulated segmented Hidden Markov Model... E:\anaconda3\lib\site-packages\pandas\core\reshape\merge.py:1108: UserWarning: You are merging on int and float columns where the float values are not equal to their int representation UserWarning, Mapping done! Writing files to disk... Converting music file... Traceback (most recent call last): File "beatmapsynth.py", line 719, in beat_map_synthesizer(args.song_path, args.song_name, args.difficulty, args.model, args.k, args.version) File "beatmapsynth.py", line 50, in beat_map_synthesizer rate_modulated_segmented_HMM_mapper(song_path, song_name, difficulty, version = version, k = k) File "beatmapsynth.py", line 512, in rate_modulated_segmented_HMM_mapper music_file_converter(song_path) File "beatmapsynth.py", line 125, in music_file_converter AudioSegment.from_wav(song_path).export('song.egg', format='ogg') File "E:\anaconda3\lib\site-packages\pydub\audio_segment.py", line 904, in export p = subprocess.Popen(conversion_command, stdin=devnull, stdout=subprocess.PIPE, stderr=subprocess.PIPE) File "E:\anaconda3\lib\subprocess.py", line 800, in init restore_signals, start_new_session) File "E:\anaconda3\lib\subprocess.py", line 1207, in _execute_child startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specified

wvsharber commented 4 years ago

Is this error only occurring if you try to run the program with .wav files? ffmpeg always seemed a little buggy to me so I'm not surprised it looks to be involved in this error. Unfortunately, I don't really understand what's going wrong here. My instinct is to suggest trying again with a .mp3 file or .ogg file because I know those work, but obviously that is only a workaround and not a solution.

Can you let me know if you get the same error with different format song files?

theace0296 commented 4 years ago

To install ffmpeg on Windows you have to go to their website, download the Windows .exe files, then add those to your path. More detailed instructions can be found here: https://www.youtube.com/watch?v=qjtmgCb8NcE

nbanyan commented 4 years ago

The mp3 gives an unknown format error, giving me the impression that mp3 isn't supported (error trace below). I'll try to find a different mp3 in case there's something weird with the one I'm using.

(base) D:\Downloads\Utilities\BeatMapSynthesizer-master>python beatmapsynth.py "Music/Ehrling---Sthlm-Sunset.mp3" "Sthlm Sunset by Ehrling" Hard rate_modulated_segmented_HMM E:\anaconda3\lib\site-packages\pydub\utils.py:170: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning) Loading Song... E:\anaconda3\lib\site-packages\librosa\core\audio.py:161: UserWarning: PySoundFile failed. Trying audioread instead. warnings.warn('PySoundFile failed. Trying audioread instead.') Traceback (most recent call last): File "E:\anaconda3\lib\site-packages\librosa\core\audio.py", line 129, in load with sf.SoundFile(path) as sf_desc: File "E:\anaconda3\lib\site-packages\soundfile.py", line 629, in init self._file = self._open(file, mode_int, closefd) File "E:\anaconda3\lib\site-packages\soundfile.py", line 1184, in _open "Error opening {0!r}: ".format(self.name)) File "E:\anaconda3\lib\site-packages\soundfile.py", line 1357, in _error_check raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace')) RuntimeError: Error opening 'Music/Ehrling---Sthlm-Sunset.mp3': File contains data in an unknown format.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "beatmapsynth.py", line 719, in beat_map_synthesizer(args.song_path, args.song_name, args.difficulty, args.model, args.k, args.version) File "beatmapsynth.py", line 50, in beat_map_synthesizer rate_modulated_segmented_HMM_mapper(song_path, song_name, difficulty, version = version, k = k) File "beatmapsynth.py", line 499, in rate_modulated_segmented_HMM_mapper bpm, beat_times, y, sr = beat_features(song_path) File "beatmapsynth.py", line 182, in beat_features y, sr = librosa.load(song_path) File "E:\anaconda3\lib\site-packages\librosa\core\audio.py", line 162, in load y, sr_native = audioread_load(path, offset, duration, dtype) File "E:\anaconda3\lib\site-packages\librosa\core\audio.py", line 186, in __audioread_load with audioread.audio_open(path) as input_file: File "E:\anaconda3\lib\site-packages\audioread\init__.py", line 116, in audio_open raise NoBackendError() audioread.exceptions.NoBackendError

nbanyan commented 4 years ago

Installing ffmpeg fixed the FileNotFoundError error. Running on an ogg seems consistent, but it annoyingly deletes the ogg file. The KeyError is now the primary error, but seems to be most common with the 'segmented_HMM' model when using wav or mp3 while using ogg seems reliable regardless of the model. Thank you for your help. Now to see what they look like in game 😄

wvsharber commented 4 years ago

Running on an ogg seems consistent, but it annoyingly deletes the ogg file.

I just fixed this problem. It shouldn't delete the original file anymore.