readbeyond / aeneas

aeneas is a Python/C library and a set of tools to automagically synchronize audio and text (aka forced alignment)
http://www.readbeyond.it/aeneas/
GNU Affero General Public License v3.0
2.45k stars 218 forks source link

trying to use aeneas an python -errors reading mp3/wav audiofile not supported #246

Closed jossiekat closed 4 years ago

jossiekat commented 4 years ago

from aeneas.executetask import ExecuteTask from aeneas.task import Task

create Task object

config_string = u"task_language=eng|is_text_type=plain|os_task_file_format=json" task = Task(config_string=config_string) task.audio_file_path_absolute =os.path.abspath("./a.mp3") task.text_file_path_absolute = os.path.abspath("./a.txt") task.sync_map_file_path_absolute = "syncmap.json"

process Task

ExecuteTask(task).execute()

output sync map to file

task.output_sync_map_file()

os : mac catalina python 3.8

got an error

FFPROBEUnsupportedFormatError Traceback (most recent call last) /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/aeneas/audiofile.py in read_properties(self) 359 logger=self.logger --> 360 ).read_properties(self.file_path) 361 self.log(u"Reading properties with FFPROBEWrapper... done")

/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/aeneas/ffprobewrapper.py in read_properties(self, audio_file_path) 283 if results[self.STDOUT_DURATION] is None: --> 284 self.log_exc(u"No duration found in stdout or stderr. Unsupported audio file format?", None, True, FFPROBEUnsupportedFormatError) 285

/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/aeneas/logger.py in log_exc(self, message, exc, critical, raise_type) 350 raise_message = u"%s : %s" % (message, exc) --> 351 raise raise_type(raise_message) 352

FFPROBEUnsupportedFormatError: No duration found in stdout or stderr. Unsupported audio file format?

During handling of the above exception, another exception occurred:

AudioFileUnsupportedFormatError Traceback (most recent call last)

in 5 config_string = u"task_language=eng|is_text_type=plain|os_task_file_format=json" 6 task = Task(config_string=config_string) ----> 7 task.audio_file_path_absolute =os.path.abspath("./fucu.wav") 8 task.text_file_path_absolute = os.path.abspath("./a.txt") 9 task.sync_map_file_path_absolute = "syncmap.json" /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/aeneas/task.py in audio_file_path_absolute(self, audio_file_path_absolute) 118 def audio_file_path_absolute(self, audio_file_path_absolute): 119 self.__audio_file_path_absolute = audio_file_path_absolute --> 120 self._populate_audio_file() 121 122 @property /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/aeneas/task.py in _populate_audio_file(self) 239 logger=self.logger 240 ) --> 241 self.audio_file.read_properties() 242 else: 243 self.log(u"audio_file_path_absolute is None") /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/aeneas/audiofile.py in read_properties(self) 363 self.log_exc(u"Unable to call ffprobe executable", None, True, AudioFileProbeError) 364 except (FFPROBEUnsupportedFormatError, FFPROBEParsingError): --> 365 self.log_exc(u"Audio file format not supported by ffprobe", None, True, AudioFileUnsupportedFormatError) 366 367 # save relevant properties in results inside the audiofile object /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/aeneas/logger.py in log_exc(self, message, exc, critical, raise_type) 349 if exc is not None: 350 raise_message = u"%s : %s" % (message, exc) --> 351 raise raise_type(raise_message) 352 353 def log(self, message): AudioFileUnsupportedFormatError: Audio file format not supported by ffprobe
jossiekat commented 4 years ago

Updated ffmpeg and the problem was solved.